當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User::setEy方法代碼示例

本文整理匯總了PHP中Model\User::setEy方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::setEy方法的具體用法?PHP User::setEy怎麽用?PHP User::setEy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Model\User的用法示例。


在下文中一共展示了User::setEy方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addReport

 /**
  * 添加報表
  * @param type $content 表報內容
  * @param type $taskId 任務ID | 主要用於任務日誌追加為報表
  * @return type
  */
 public static function addReport($content, $taskId = '')
 {
     $findReport = self::db('report')->where('report_date = :report_date AND user_id = :user_id')->find(array('report_date' => date('Y-m-d'), 'user_id' => $_SESSION['team']['user_id']))['report_id'];
     if (empty($findReport)) {
         $findReport = self::db('report')->insert(array('report_date' => date('Y-m-d'), 'user_id' => $_SESSION['team']['user_id'], 'department_id' => $_SESSION['team']['user_department_id']));
         \Model\User::setEy($_SESSION['team']['user_id'], '1');
     } else {
         //防止由於用戶遷移部門,導致獲取當天報表失敗
         self::db('report')->where('report_id = :report_id')->update(array('department_id' => $_SESSION['team']['user_department_id'], 'noset' => array('report_id' => $findReport)));
     }
     if (!empty($taskId)) {
         $task = \Model\Content::findContent('task', $taskId, 'task_id');
         $data['task_id'] = $task['task_id'];
         $data['task_title'] = $task['task_title'];
         $data['task_status'] = $task['task_status'];
     }
     $data['report_id'] = $findReport;
     $data['report_content'] = $content;
     return $report_content = self::db('report_content')->insert($data);
 }
開發者ID:tarscoding,項目名稱:PESCMS-TEAM,代碼行數:26,代碼來源:Report.class.php

示例2: check

 /**
  * 更改任務狀態
  */
 public function check()
 {
     $data['noset']['task_id'] = $this->isP('task_id', '請選擇任務');
     $task = $this->db('task AS t')->field("t.*, group_concat(tc.check_user_id) AS check_user_id ")->join("{$this->prefix}task_check AS tc ON tc.task_id = t.task_id")->where('t.task_id = :task_id ')->group('t.task_id')->find(array('task_id' => $data['noset']['task_id']));
     if (empty($task) || $task['task_delete'] == '1') {
         $this->error('任務不存在');
     }
     $checker = explode(',', $task['check_user_id']);
     $data['task_status'] = empty($_POST['task_status']) ? '2' : $this->p('task_status');
     $this->db()->transaction();
     switch ($data['task_status']) {
         case '2':
             if ($_SESSION['team']['user_id'] != $task['task_user_id']) {
                 $this->error('您不是本任務執行人');
             }
             $noticeUser = $checker;
             $noticeType = '3';
             $dynamicType = '3';
             //提交審核,增加EY值
             \Model\User::setEy($_SESSION['team']['user_id'], '1');
             break;
         case '3':
         case '4':
             if (!in_array($_SESSION['team']['user_id'], $checker)) {
                 $this->error('您沒有權限處理本任務');
             }
             $noticeUser = array($task['task_user_id']);
             $noticeType = $data['task_status'] == '3' ? '4' : '6';
             $dynamicType = $data['task_status'] == '3' ? '' : '4';
             $eyValue = $data['task_status'] == '3' ? '-2' : '1';
             \Model\User::setEy($task['task_user_id'], $eyValue);
             break;
         default:
             $this->error('未知的任務狀態');
     }
     //每個狀態變更,都表示一個完成時間
     $data['task_completetime'] = time();
     $updateResultt = $this->db('task')->where('task_id = :task_id')->update($data);
     if (empty($updateResultt)) {
         $this->db()->rollBack();
         $this->error('提交任務失敗');
     }
     //狀態為3需要判斷是否有任務補充說明提交
     if ($data['task_status'] == 3) {
         $supplement['task_id'] = $data['noset']['task_id'];
         $supplement['task_supplement_content'] = $this->p('content');
         $supplement['task_supplement_file'] = !empty($_POST['file']) && is_array($_POST['file']) ? implode(',', $_POST['file']) : '';
         $supplement['task_supplement_time'] = time();
         if (!empty($supplement['task_supplement_content']) || !empty($supplement['task_supplement_file'])) {
             $addSupplement = $this->db('task_supplement')->insert($supplement);
             if (empty($addSupplement)) {
                 $this->db()->rollBack();
                 $this->error('添加任務補充說明失敗');
             }
         }
     }
     //生成係統消息
     foreach ($noticeUser as $value) {
         $sendNotice = \Model\Notice::addNotice($value, $data['noset']['task_id'], $noticeType, $task['task_mail']);
         if (empty($sendNotice)) {
             $this->db()->rollBack();
             $this->error('生成係統消息出錯!');
         }
     }
     //生成個人動態
     if (!empty($dynamicType)) {
         $addDynamic = \Model\Dynamic::addDynamic($task['task_user_id'], $data['noset']['task_id'], $dynamicType);
         if (empty($addDynamic)) {
             $this->db()->rollBack();
             $this->error('更新用戶動態失敗');
         }
     }
     $this->db()->commit();
     $this->success('任務狀態已更新!', $this->url('Team-Task-view', array('id' => $data['noset']['task_id'])));
 }
開發者ID:tarscoding,項目名稱:PESCMS-TEAM,代碼行數:78,代碼來源:Task.class.php

示例3: action

 public function action()
 {
     //創建任務的uid,此處必須注意,$_POST的信息必定是字符串
     $_POST['create_id'] = (string) $_SESSION['team']['user_id'];
     //進行一些基礎表單信息入庫
     $this->db()->transaction();
     $addResult = \Model\Content::addContent();
     if ($addResult['status'] == false) {
         $this->db()->rollBack();
         $this->error($addResult['mes']);
     }
     //生成任務站內通知,accept_id為1表示本部門,反之需要部門責任人審核任務
     if ($_POST['accept_id'] == '1') {
         $sendNoticeResult = \Model\Notice::addNotice($_POST['user_id'], $addResult['mes'], '1', $_POST['mail']);
         if ($sendNoticeResult == false) {
             $this->db()->rollBack();
             $this->error('生成新任務通知失敗');
         }
     } else {
         $department = \Model\Content::findContent('department', $_POST['department_id'], 'department_id');
         if (empty($department['department_header'])) {
             $this->db()->rollBack();
             $this->error('該部門沒有負責人,無法創建任務');
         }
         $department_header = explode(',', $department['department_header']);
         foreach ($department_header as $v) {
             $sendNoticeResult = \Model\Notice::addNotice($v, $addResult['mes'], '5', $_POST['mail']);
             if ($sendNoticeResult == false) {
                 $this->db()->rollBack();
                 $this->error('生成部門審核通知失敗');
             }
         }
     }
     //添加任務審核人,不論是否設置對應的審核人,部門審核人都將成為審核人之一。
     $checkUserList = empty($department_header) ? explode(',', $_POST['check_user_id']) : array_unique(array_merge_recursive(explode(',', $_POST['check_user_id']), $department_header));
     foreach ($checkUserList as $v) {
         $addCheckResult = $this->db('task_check')->insert(array('task_id' => $addResult['mes'], 'check_user_id' => $v));
         if ($addCheckResult == false) {
             $this->db()->rollBack();
             $this->error('添加審核人失敗');
         }
         $sendNoticeResult = \Model\Notice::addNotice($v, $addResult['mes'], '2', $_POST['mail']);
         if ($sendNoticeResult == false) {
             $this->db()->rollBack();
             $this->error('生成指派通知失敗');
         }
         \Model\User::setEy($v, '1');
     }
     $addDynamic = \Model\Dynamic::addDynamic($_SESSION['team']['user_id'], $addResult['mes'], '1');
     if (empty($addDynamic)) {
         $this->db()->rollBack();
         $this->error('更新用戶動態失敗');
     }
     $this->db()->commit();
     if (!empty($_POST['back_url'])) {
         $url = $_POST['back_url'];
     } else {
         $url = $this->url('Team-' . MODULE . '-index');
     }
     $this->success($GLOBALS['_LANG']['CONTENT']['ADD_CONTENT_SUCCESS'], $url);
 }
開發者ID:tarscoding,項目名稱:PESCMS-TEAM,代碼行數:61,代碼來源:Task.class.php


注:本文中的Model\User::setEy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。