本文整理匯總了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]);
}