本文整理汇总了PHP中Func::touchImg方法的典型用法代码示例。如果您正苦于以下问题:PHP Func::touchImg方法的具体用法?PHP Func::touchImg怎么用?PHP Func::touchImg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Func
的用法示例。
在下文中一共展示了Func::touchImg方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: basicAction
/**
* 合作机构基本信息
*/
public function basicAction($uni_id)
{
//判断是否是ajax
if ($this->request->isAjax()) {
$validate = new \Validate();
$data['union_logo'] = $validate->getPost('union_logo');
//机构logo
$data['union_name'] = $validate->getPost('union_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{2,30}$/iu'));
//机构名称
//验证参数
if ($validate->getMessage()) {
$this->end(400);
}
//生成机构logo,缩略图
if ($data['union_logo']) {
$data['union_logo'] = \Func::touchImg($data['union_logo'], 'union_logo');
//监测图片是否生成成功
if (!$data['union_logo']) {
\FileUtil::getInstance()->unlink(UPLOAD_PATH . $data['union_logo']);
$this->end(400);
}
}
$this->end((new \Union())->updUnionBasic($this->session->get('id'), $uni_id, $data));
}
//机构id
$uni_id = (int) $uni_id;
//获取基本数据
$basic = (new \Union())->getUnionBasic($uni_id);
//加载js
$this->assets->addJs('backend/mt-js/union.js');
$this->view->setVars(['uni_id' => $uni_id, 'basic' => $basic]);
}
示例2: newAction
/**
* 新增属性
*/
public function newAction()
{
//检查是否是ajax请求
if ($this->request->isAjax()) {
$validate = new \Validate();
$data['att_img'] = $validate->getPost('att_img', \Validate::base64());
//属性图
$data['att_name'] = $validate->getPost('att_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{2,30}$/iu'));
//属性名称
$data['att_sort'] = $validate->getPost('att_sort', \Validate::int());
//排序
//验证数据
if ($validate->getMessage()) {
$this->end(400);
}
//生成学校logo,缩略图
$data['att_img'] = \Func::touchImg($data['att_img'], 'att_img');
//将生成的图片地址存入img,用户失败时删除
$img = [UPLOAD_PATH . $data['att_img'], UPLOAD_PATH . $data['att_img']];
//监测图片是否全部生成成功
if (!$data['att_img']) {
\FileUtil::getInstance()->unlink($img);
}
//新增高校
$result = (new \Attribute())->addAttribute($this->session->get('id'), $data);
if ($result != 200) {
\FileUtil::getInstance()->unlink($img);
}
$this->end($result);
}
//加载所需js
$this->assets->addJs('backend/mt-js/attribute-new.js');
}
示例3: addAction
/**
* 回答接口
*/
public function addAction()
{
//取值,参数验证,签名验证
$vars = ['mem_id', 'mem_mark', 'empty_ans_id', 'mem_relation_id', 'que_id', 'ans_content', 'is_img', 'sign'];
$this->beforeGetVarExecVerify($vars, 'post');
//判断是否是图片
if ($this->data['is_img'] == 1) {
$this->data['ans_content'] = \Func::touchImg($this->data['ans_content'], 'ans');
if (!$this->data['ans_content']) {
$this->throwMessage(ILLEGAL_IMAGE);
}
}
//默认执行回答提问方法
$func = 'addAnswer';
//需要的字段
$field = ['mem_id', 'mem_mark', 'mem_relation_id', 'que_id', 'ans_content'];
//根据可空回答id,empty_ans_id判断是否执行追问方法
if ($this->data['empty_ans_id']) {
array_push($field, $this->data['empty_ans_id']);
$func = 'addAnswerAsk';
}
//转义回答内容
$this->data['ans_content'] = mb_substr(\Func::escape($this->data['ans_content']), 0, 250, 'utf-8');
//获取执行状态,执行失败,并且是图片信息,则删除上传的图片
$add_status = $this->callModelFunc('Answer', $func, $field);
if ($add_status != OK && $this->data['is_img'] == 1) {
\FileUtil::getInstance()->unlink(PUBLIC_PATH . $this->data['ans_content']);
}
$this->throwMessage($add_status);
}
示例4: detailAction
/**
* 修改友情链接
*/
public function detailAction($link_id)
{
//判断是否是ajax
if ($this->request->isAjax()) {
$validate = new \Validate();
$data['link_id'] = $validate->getPost('link_id', \Validate::int());
//数据id
$data['link_name'] = $validate->getPost('link_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{1,30}$/iu'));
//友情链接名称
$data['link_url'] = $validate->getPost('link_url', \Validate::regex('/^(http(s)?:\\/\\/)/'), ['slashes' => true, 'html' => true]);
//链接url
$data['link_sort'] = $validate->getPost('link_sort', \Validate::between(99999999, 0));
//友情链接排序
$data['link_logo'] = $validate->getPost('link_logo');
//友情链接logo
//验证参数
if ($validate->getMessage()) {
$this->end(400);
}
//生成友情链接logo
if ($data['link_logo']) {
$data['link_logo'] = \Func::touchImg($data['link_logo'], 'link_logo');
if (!$data['link_logo']) {
$this->end(400);
}
}
//修改友情链接
$result = (new \Link())->updLink($this->session->get('id'), $data);
if ($result != 200) {
\FileUtil::getInstance()->unlink(UPLOAD_PATH . $data['link_logo']);
}
$this->end($result);
}
//数据id
$link_id = (int) $link_id;
//热点文章详情数据
$basic = (new \Link())->getLinkDetail($link_id);
//加载js
$this->assets->addJs('backend/mt-js/link.js');
$this->view->setVars(['basic' => $basic]);
}
示例5: applyAction
/**
* 申请智囊
*/
public function applyAction()
{
//取值,参数验证,签名验证
$vars = ['mem_id', 'mem_mark', 'sage_realname', 'sage_cardid', 'sage_pic_above', 'sage_pic_below', 'tag_ides', 'sign'];
$this->beforeGetVarExecVerify($vars, 'post');
//生成身份证正反面图片
$this->data['sage_pic_above'] = \Func::touchImg($this->data['sage_pic_above'], 'sage');
$this->data['sage_pic_below'] = \Func::touchImg($this->data['sage_pic_below'], 'sage');
$images = [$this->data['sage_pic_above'], $this->data['sage_pic_below']];
if (!$this->data['sage_pic_above'] || !$this->data['sage_pic_below']) {
\FileUtil::getInstance()->unlink($images, PUBLIC_PATH);
$this->throwMessage(ILLEGAL_IMAGE);
}
//需要的字段
$field = ['mem_id', 'mem_mark', 'sage_realname', 'sage_cardid', 'sage_pic_above', 'sage_pic_below', 'tag_ides'];
$add_status = $this->callModelFunc('Sage', 'addSage', $field);
if ($add_status != OK) {
\FileUtil::getInstance()->unlink($images, PUBLIC_PATH);
}
$this->throwMessage($add_status);
}
示例6: addAction
/**
* 新增提问
*/
public function addAction()
{
//取值,参数验证,签名验证
$vars = ['mem_id', 'mem_mark', 'que_content', 'que_img', 'que_reward', 'tag_ides', 'sign'];
$this->beforeGetVarExecVerify($vars, 'post');
//图片操作
$this->data['que_img'] = json_decode($this->data['que_img'], true);
$this->data['que_img'] = is_array($this->data['que_img']) ? $this->data['que_img'] : [];
$images = [];
if (!empty($this->data['que_img'])) {
$i = 1;
foreach ($this->data['que_img'] as $key => $val) {
//数组格式不合法
if (!isset($val['img'])) {
\FileUtil::getInstance()->unlink($images, PUBLIC_PATH);
$this->throwMessage(ILLEGAL_ARRAY);
}
//非法的图片
if (!($images[] = \Func::touchImg($val['img'], 'que'))) {
\FileUtil::getInstance()->unlink($images, PUBLIC_PATH);
$this->throwMessage(ILLEGAL_IMAGE);
}
//控制提问最多可上传的数量
$i++;
if ($i > QUESTION_MAX_IMAGE) {
break;
}
}
}
//处理字段
$this->data['que_img'] = $images;
$this->data['que_content'] = \Func::escape($this->data['que_content']);
//所需字段
$field = ["mem_id", "mem_mark", "que_content", "que_img", "que_reward", "tag_ides"];
$add_status = $this->callModelFunc('Question', 'addQuestion', $field);
if ($add_status != OK) {
\FileUtil::getInstance()->unlink($images, PUBLIC_PATH);
}
$this->throwMessage($add_status);
}
示例7: detailAction
/**
* 培训详情
* parmar $col_id 学校id
*/
public function detailAction($tra_id)
{
//检查是否是ajax请求
if ($this->request->isAjax()) {
$validate = new \Validate();
$data['tra_logo'] = $validate->getPost('tra_logo');
//机构logo
$data['tra_thumb'] = $validate->getPost('tra_thumb');
//机构缩略图
$data['tra_name'] = $validate->getPost('tra_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{2,30}$/iu'));
//学校名称
$data['tra_cat_id'] = $validate->getPost('tra_cat_id', \Validate::int());
//机构分类
$data['tra_system'] = $validate->getPost('tra_system', \Validate::int());
//上课类型
$data['tra_click'] = $validate->getPost('tra_click', \Validate::int());
//上课类型
$data['is_join'] = $validate->getPost('is_join', \Validate::scopeCall('Setting', 'getJoin'));
//官方合作
$data['home_type'] = $validate->getPost('is_home', \Validate::scopeCall('Setting', 'getHome'));
//包住宿
$data['hire_type'] = $validate->getPost('is_hire', \Validate::scopeCall('Setting', 'getHire'));
//包就业
$data['tra_tel'] = $validate->getPost('tra_tel', \Validate::length(60, 0), ['slashes' => true, 'html' => true]);
//联系电话
$data['tra_url'] = $validate->getPost('tra_url', \Validate::regex('/^(http(s)?:\\/\\/[^\'"\\s]+)?$/'));
//机构官网
$data['pro_code'] = $validate->getPost('pro_code', \Validate::regex('/^[1-9]\\d{5}$/'));
//机构所在省份编码
$data['city_code'] = $validate->getPost('city_code', \Validate::regex('/^[1-9]\\d{5}$/'));
//机构所在城市编码
$data['area_code'] = $validate->getPost('area_code', \Validate::regex('/^[1-9]\\d{5}$/'));
//机构所在区县编码
$data['dist_code'] = $validate->getPost('dist_code', \Validate::regex('/^0|(^[1-9]\\d{5})$/'));
//机构所在城市编码
$data['tra_addr'] = $validate->getPost('tra_addr', \Validate::length(100, 0), ['slashes' => true, 'html' => true]);
//详细地址
$data['tra_summary'] = $validate->getPost('tra_summary', \Validate::length(100000, 0), ['slashes' => true]);
//机构简介
$data['tra_key'] = $validate->getPost('tra_key', \Validate::regex('/^([a-z0-9\\x{4e00}-\\x{9fa5}]{1,10}([\\s,][a-z0-9\\x{4e00}-\\x{9fa5}]{1,10}){0,9})?$/iu'));
//关键词
$data['tra_desc'] = $validate->getPost('tra_desc', \Validate::length(250, 0), ['slashes' => true, 'html' => true]);
//验证数据
if ($validate->getMessage()) {
$this->end(400);
}
//生成学校logo,缩略图
$tra_logo = \Func::touchImg($data['tra_logo'], 'tra_logo');
$tra_thumb = \Func::touchImg($data['tra_thumb'], 'tra_thumb');
//将生成的图片地址存入img,用户失败时删除
$img = [UPLOAD_PATH . $data['tra_logo'], UPLOAD_PATH . $data['tra_thumb']];
//监测图片是否全部生成成功
if ($data['tra_logo'] && !$tra_logo || $data['tra_thumb'] && !$tra_thumb) {
\FileUtil::getInstance()->unlink($img);
$this->end(400);
}
$data['tra_logo'] = $tra_logo;
$data['tra_thumb'] = $tra_thumb;
if (!$tra_logo) {
unset($data['tra_logo']);
}
if (!$tra_thumb) {
unset($data['tra_thumb']);
}
//修改高校
$result = (new \Train())->updateTrain($this->session->get('id'), $tra_id, $data);
if ($result != 200) {
\FileUtil::getInstance()->unlink($img);
}
$this->end($result);
}
//高校id
$tra_id = (int) $tra_id;
//获取学校基本信息
$detail = (new \Train())->getDetail($tra_id);
if ($detail == 404) {
$this->dispatcher->forward(['controller' => 'error', 'action' => 'error404']);
}
//获取学校已存在属性
$att_id = (new \College())->getAttId($tra_id);
//获取省份数据
$provinces = (new \Site())->getProvince();
//城市数据
$city = (new \Site())->getCity($detail['pro_code']);
//区县数据
$area = (new \Site())->getArea($detail['city_code']);
//城市数据
$district = (new \Site())->getDist($detail['city_code']);
//工程属性
$category = (new \Train())->getCategory();
// print_r($detail);die;
//加载所需js
$this->assets->addJs('backend/js/datetime/bootstrap-datepicker.js');
$this->assets->addJs('backend/js/editors/summernote/summernote.js');
$this->assets->addJs('backend/mt-js/train-detail.js');
// 加载公共部分
//.........这里部分代码省略.........
示例8: detailAction
/**
* 新增学校课程
*/
public function detailAction($tra_id, $cou_id)
{
//检查是否是ajax请求
if ($this->request->isAjax()) {
$validate = new \Validate();
$data['tra_id'] = (int) $tra_id;
//学校ID
$data['cou_id'] = (int) $cou_id;
//课程ID
$data['cou_thumb'] = $validate->getPost('cou_thumb');
//学校缩略图
$data['spe_id'] = $validate->getPost('spe_id', \Validate::int());
//分类ID
$data['cou_name'] = $validate->getPost('cou_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{2,30}$/iu'));
//课程名称
$data['cou_sort'] = $validate->getPost('cou_sort', \Validate::int());
//课程排序
$data['cou_price'] = $validate->getPost('cou_price', \Validate::regex('/^[a-z0-9\\.\\/\\(\\)\\(\\)\\x{4e00}-\\x{9fa5}]{0,30}$/iu'));
//课程价格
$data['cou_system'] = $validate->getPost('cou_system', \Validate::int());
//上课类型
$data['is_hot'] = $validate->getPost('is_hot', \Validate::int());
//是否热门
$data['cou_summary'] = $validate->getPost('cou_summary', \Validate::nil(), ['slashes' => true]);
//课程简介
$data['cou_key'] = $validate->getPost('cou_key', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{1,10}([\\s,][a-z0-9\\x{4e00}-\\x{9fa5}]{1,10}){0,9}$/iu'));
//关键词
$data['cou_desc'] = $validate->getPost('cou_desc', \Validate::length(250, 2), ['slashes' => true, 'html' => true]);
//描述
$data['cou_trait'] = $validate->getPost('cou_trait', \Validate::length(250, 2), ['slashes' => true, 'html' => true]);
//优势
$data['tea_id'] = $validate->getPost('tea_id');
$data['cou_addr'] = $validate->getPost('cou_addr');
//验证数据
if ($validate->getMessage()) {
$this->end(400);
}
//验证机构是否存在
if (!(new \Train())->getDetail($tra_id)) {
$this->end(404);
}
//生成课程缩略图
$cou_thumb = \Func::touchImg($data['cou_thumb'], 'cou_thumb');
//将生成的图片地址存入img,用户失败时删除
$img = [UPLOAD_PATH . $data['cou_thumb']];
//监测图片是否全部生成成功
if ($data['cou_thumb'] && !$cou_thumb) {
\FileUtil::getInstance()->unlink($img);
$this->end(400);
}
$data['cou_thumb'] = $cou_thumb;
//修改高校课程
$result = (new \Course())->UpdateCourse($this->session->get('id'), $data);
if ($result != 200) {
$this->end($result);
}
$this->end($result);
}
//获取参数
$cou_id = (int) $cou_id;
$tra_id = (int) $tra_id;
//获取详细信息
$detail = (new \Course())->getDetail($cou_id);
if ($detail == 404) {
$this->end(404);
}
//获取一级分类
$categorys = (new \Course())->getCategory();
//获取教师列表
$teachers = (new \TrainTeacher())->getTeacherList($tra_id)['list'];
//获取课程教师
$tea_id = (new \Course())->getTeacher($cou_id);
//获取地址列表
$cou_addr = (new \Course())->getAddress($cou_id);
$address = '';
foreach ($cou_addr as $val) {
$address .= ',' . $val['cou_add_content'];
}
//加载所需js
$this->assets->addJs('backend/js/editors/summernote/summernote.js');
$this->assets->addJs('backend/mt-js/bootstrap-tagsinput.js');
$this->assets->addJs('backend/mt-js/course-detail.js');
$this->view->setLayout('train');
$this->view->setVars(['detail' => $detail, 'tra_id' => $tra_id, 'categorys' => $categorys, 'teachers' => $teachers, 'tea_id' => $tea_id, 'cou_addr' => $cou_addr, 'address' => $address]);
}
示例9: detailAction
/**
* 修改banner
*/
public function detailAction($ban_id)
{
//判断是否是ajax
if ($this->request->isAjax()) {
$validate = new \Validate();
$data['ban_id'] = $validate->getPost('ban_id', \Validate::int());
//数据id
$data['ban_sort'] = $validate->getPost('ban_sort', \Validate::between(99999999, 0));
//图片排序
$data['ban_url'] = $validate->getPost('ban_url', \Validate::regex('/^(http(s)?:\\/\\/)/'), ['slashes' => true, 'html' => true]);
//图片url
$data['ban_alt'] = $validate->getPost('ban_alt', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{1,30}$/iu'));
//图片介绍
$data['ban_start_date'] = $validate->getPost('ban_start_date', \Validate::time('yyyy-mm-dd'));
//开始时间
$data['ban_end_date'] = $validate->getPost('ban_end_date', \Validate::time('yyyy-mm-dd'));
//结束时间
$ban_img = $validate->getPost('ban_img');
//banner图片
//验证参数
if ($validate->getMessage()) {
$this->end(400);
}
//生成banner图片
if ($ban_img) {
$ban_img = \Func::touchImg($ban_img, 'banner');
if (!$ban_img) {
$this->end(400);
}
}
//修改banner
$result = (new \Banner())->updBanner($this->session->get('id'), $data, $ban_img);
if ($result != 200) {
\FileUtil::getInstance()->unlink(UPLOAD_PATH . $ban_img);
}
$this->end($result);
}
//数据id
$ban_id = (int) $ban_id;
//banner详情数据
$basic = (new \Banner())->getBannerDetail($ban_id);
//加载js
$this->assets->addJs('backend/js/datetime/bootstrap-datepicker.js');
$this->assets->addJs('backend/mt-js/banner.js');
$this->view->setVars(['basic' => $basic]);
}
示例10: setHeadAction
/**
* 设置头像
*/
public function setHeadAction()
{
$vars = ['mem_id', 'mem_head', 'mem_mark', 'sign'];
$this->beforeGetVarExecVerify($vars, 'post');
//生成图片
$this->data['mem_head'] = \Func::touchImg($this->data['mem_head'], 'head');
if (!$this->data['mem_head']) {
$this->throwMessage(ILLEGAL_IMAGE);
}
//修改头像
$field = ['mem_id', 'mem_mark', 'mem_head'];
$upd_status = $this->callModelFunc('Member', 'updMemHead', $field);
if ($upd_status != OK) {
$this->throwMessage($upd_status);
}
$this->throwMessage(OK, ['mem_head' => \Func::setImg($this->data['mem_head'])]);
}
示例11: tralistAction
public function tralistAction($tra_id)
{
//判断是否是ajax
if ($this->request->isAjax()) {
$validate = new \Validate();
$tra_scene = $validate->getPost('scene', \Validate::arr());
$tra_id = (int) $tra_id;
if ($validate->getMessage()) {
$this->end(400);
}
//新增的图片
$new_img = [];
//处理图片
foreach ($tra_scene as $key => $val) {
//检查字段是否设置
if (!isset($val['img']) || !isset($val['content']) || !isset($val['sort'])) {
\FileUtil::getInstance()->unlink($new_img);
$this->end(400);
}
//清除错误信息
$validate->clearMessage();
//验证字段
$tra_scene[$key]['sort'] = (int) $val['sort'];
//图片排序
$tra_scene[$key]['content'] = $validate->execute($val['content'], \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{1,30}$/iu'));
//图片介绍
if ($validate->getMessage()) {
\FileUtil::getInstance()->unlink($new_img);
$this->end(400);
}
//创建学校风光图,并验证是否创建成功
$tra_scene[$key]['img'] = \Func::touchImg($val['img'], 'tra_scene');
if (!$val['img']) {
\FileUtil::getInstance()->unlink($new_img);
$this->end(400);
}
//将生成成功的图片存入数组
$new_img[] = UPLOAD_PATH . $tra_scene[$key]['img'];
}
//修改风光图
$result = (new \Scene())->updTrainScene($this->session->get('id'), $tra_id, $tra_scene);
//未修改成功,则删除新增的图片
if ($result != 200) {
\FileUtil::getInstance()->unlink($new_img);
}
$this->end($result);
}
//学校id
$tra_id = (int) $tra_id;
//获取学校风光图
$scene = (new \Scene())->getTrainScene($tra_id);
//加载js
$this->assets->addJs('backend/mt-js/scene-tralist.js');
$this->view->setLayout("train");
$this->view->setVars(['tra_id' => $tra_id, 'scene' => $scene]);
}
示例12: detailAction
/**
* 高校教师的详细信息
*/
public function detailAction($col_tea_id)
{
//判断是否ajax
if ($this->request->isAjax()) {
$validate = new \Validate();
$data['col_id'] = $validate->getPost('col_id', \Validate::int());
//学校id
$data['tea_id'] = $validate->getPost('tea_id', \Validate::int());
//教师id
$data['tea_name'] = $validate->getPost('tea_name', \Validate::length(15, 2));
//教师名称
$data['tea_degree'] = $validate->getPost('tea_degree', \Validate::length(10, 2));
//教师学位
$data['tea_position'] = $validate->getPost('tea_position', \Validate::length(20, 2));
//教师职位
$data['tea_college'] = $validate->getPost('tea_college', \Validate::length(30, 2));
//毕业学校
$data['tea_sort'] = $validate->getPost('tea_sort', \Validate::length(99999999, 0));
//排序
$data['tea_summary'] = $validate->getPost('tea_summary', \Validate::length(255, 2));
//教师简介
$data['tea_head'] = $validate->getPost('tea_head');
//教师头像
//验证参数
if ($validate->getMessage()) {
$this->end(400);
}
//生成教师头像
if ($data['tea_head']) {
$data['tea_head'] = \Func::touchImg($data['tea_head'], 'tea_head');
if (!$data['tea_head']) {
$this->end(400);
}
}
$this->end((new \CollegeTeacher())->updTeacher($this->session->get('id'), $data));
}
//教师id
$col_tea_id = (int) $col_tea_id;
//教师数据
$teacher = (new \CollegeTeacher())->getTeacherDetail($col_tea_id);
$this->view->setVars(['col_tea_id' => $col_tea_id, 'teacher' => $teacher, 'col_id' => $teacher['col_id']]);
}
示例13: setHeadAction
/**
* 设置头像
*/
public function setHeadAction()
{
$vars = ['mem_id', 'mem_head', 'mem_mark', 'sign'];
//获取数据
list($mem_id, $mem_head, $mem_mark, $sign) = \Verify::getPost($vars);
//验证参数
if (\Verify::getMessage()) {
$this->throwMessage(PARAMETER_FAIL, \Verify::getMessage());
}
//生产图片
$mem_head = \Func::touchImg($mem_head, 'head');
if (!$mem_head) {
$this->throwMessage(ILLEGAL_IMAGE);
}
//验证签名
if (!$this->verifySign($mem_id, $sign)) {
$this->throwMessage(ILLEGAL_SIGN);
}
//修改头像
$this->throwMessage((new \Member())->updMemHead($mem_id, $mem_mark, $mem_head), ['mem_head' => $mem_head]);
}
示例14: detailAction
/**
* 知名校友的详细信息
*/
public function detailAction($col_alu_id)
{
//判断是否ajax
if ($this->request->isAjax()) {
$validate = new \Validate();
$data['col_id'] = $validate->getPost('col_id', \Validate::int());
//学校id
$data['alu_id'] = $validate->getPost('alu_id', \Validate::int());
//校友id
$data['alu_name'] = $validate->getPost('alu_name', \Validate::length(15, 2));
//校友名称
$data['alu_desc'] = $validate->getPost('alu_desc', \Validate::length(255, 2));
//校友简介
$data['alu_src'] = $validate->getPost('alu_src');
//资料来源
$data['alu_head'] = $validate->getPost('alu_head');
//校友头像
//验证参数
if ($validate->getMessage()) {
$this->end(400);
}
//生成校友头像
if ($data['alu_head']) {
$data['alu_head'] = \Func::touchImg($data['alu_head'], 'alu_head');
if (!$data['alu_head']) {
$this->end(400);
}
}
$this->end((new \CollegeAlumnus())->updAlumnus($this->session->get('id'), $data));
}
//校友id
$col_alu_id = (int) $col_alu_id;
//校友数据
$alumnus = (new \CollegeAlumnus())->getAlumnusDetail($col_alu_id);
$this->view->setVars(['col_alu_id' => $col_alu_id, 'alumnus' => $alumnus, 'col_id' => $alumnus['col_id']]);
}
示例15: detailAction
/**
* 修改banner新闻
*/
public function detailAction($news_com_id)
{
//判定是否是ajax
if ($this->request->isAjax()) {
$validate = new \Validate();
$data['news_ban_id'] = $validate->getPost('news_ban_id', \Validate::int());
//banner新闻id
$data['news_id'] = $validate->getPost('news_id', \Validate::int());
//新闻id
$data['news_ban_img'] = $validate->getPost('news_ban_img');
//banner图片
$data['news_ban_alt'] = $validate->getPost('news_ban_alt', \Validate::regex('/^[\\da-z\\x{4e00}-\\x{9fa5}]{1,30}$/iu'));
//banner图片介绍
$data['news_ban_sort'] = $validate->getPost('news_ban_sort', \Validate::regex('/^(0|[1-9]\\d{0,7})$/'));
//banner新闻排序
$data['news_ban_status'] = $validate->getPost('news_ban_status', \Validate::scopeCall('Setting', 'getStatus'));
//显示状态
//验证参数
if ($validate->getMessage()) {
$this->end(400);
}
//创建banner图片
$img = $data['news_ban_img'];
$data['news_ban_img'] = \Func::touchImg($img, 'news_ban');
if ($img && !$data['news_ban_img']) {
$this->end(400);
}
$result = (new \NewsBanner())->updNewsBanner($this->session->get('id'), $data);
if ($result != 200 && is_file(UPLOAD_PATH . $img)) {
unlink(UPLOAD_PATH . $img);
}
$this->end($result);
}
//新闻推荐id
$news_com_id = (int) $news_com_id;
//获取新闻推荐详情
$detail = (new \NewsBanner())->getDetail($news_com_id);
if ($detail == 404) {
$this->notFound();
}
$this->view->setVars(['detail' => $detail]);
}