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


PHP Common::model方法代碼示例

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


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

示例1: actionUpdateVersion

 /**
  * 版本升級
  * $GLOBALS['__PLATFORM']   係統平台: 1-Android; 2-iOS
  * $GLOBALS['__APP_ID']     應用編號: 10-學員端; 11-教師端
  */
 public function actionUpdateVersion()
 {
     $platform = intval(trim($GLOBALS['__PLATFORM']));
     $app_id = intval(trim($GLOBALS['__APP_ID']));
     $plat = array(1, 2);
     // 平台數組: 1-Android; 2-iOS
     $app = array(10, 11);
     // 應用編號數組: 10-學員端; 11-教師端
     if (in_array($platform, $plat, true) && in_array($app_id, $app, true)) {
         $result = Common::model()->updateVersion($platform, $app_id);
         if ($result === false) {
             $this->_return('MSG_ERR_UNKOWN');
         }
         $data = array();
         if (isset($result['newVersion'])) {
             if (strcmp($_REQUEST['app_version'], $result['newVersion']) != 0) {
                 $data = $result;
             }
         }
         if (empty($data)) {
             $this->_return('MSG_ERR_FAIL_UPDATE_VERSION');
         } else {
             $this->_return('MSG_SUCCESS', $data);
         }
     } else {
         $this->_return('MSG_ERR_FAIL_PLATFORM|APP_ID');
     }
 }
開發者ID:hucongyang,項目名稱:student_cnhutong,代碼行數:33,代碼來源:CommonController.php

示例2: actionGetActivities

 public function actionGetActivities()
 {
     $data = Common::model()->getActivities();
     $this->_return('MSG_SUCCESS', $data);
 }
開發者ID:hucongyang,項目名稱:student_cnhutong,代碼行數:5,代碼來源:CommonController.php

示例3: software_to_gold

 /**
  * 軟件兌換金幣
  *
  * @param unknown $user_id
  */
 public function software_to_gold($user_id, $software_id)
 {
     try {
         $con_characters = Yii::app()->db_characters;
         $trans_characters = $con_characters->beginTransaction();
         $table_name = sprintf('software_%02s', dechex($user_id % 256));
         $ret = $con_characters->createCommand()->select('id')->from($table_name)->where('software_id=:ID AND status=1')->bindParam(':ID', $software_id, PDO::PARAM_INT, 11)->order('id DESC')->queryRow();
         if ($ret) {
             return -2;
         } else {
             //查詢軟件推薦
             $software_info = Common::model()->getSoftware($software_id);
             if (!$software_info) {
                 return -3;
             }
             //獲取用戶基本信息
             $player = Characters::model()->getCharactersInfo($user_id);
             //金幣購買體力
             $param['gold'] = (int) $player['gold'] + (int) $software_info[0]['gold'];
             //更新 加金幣
             Characters::model()->updateCharacters($user_id, $param);
             //解鎖女神 加金幣日誌
             $gold_params = array('user_id' => $user_id, 'type' => 10, 'value' => $software_info[0]['gold'], 'gold' => $param['gold'], 'create_ts' => date("Y-m-d H:i:s"));
             Gold::model()->createGold($user_id, $gold_params);
             //軟件換金幣記錄
             $p = array('user_id' => $user_id, 'software_id' => $software_id, 'gold' => $software_info[0]['gold'], 'status' => 1);
             $con_characters->createCommand()->insert($table_name, $p);
             //提交事務
             $trans_characters->commit();
             //獲取角色信息
             $info = Characters::model()->getCharactersInfo($user_id);
             $return['log']['gold'] = $software_info[0]['gold'];
             $return['log']['gold_after'] = $param['gold'];
             $return['result'] = array('point' => (int) $info['point'], 'exp' => (int) $info['exp'], 'vit' => (int) $info['vit'], 'vit_time' => (int) $info['vit_time'], 'level' => (int) $info['level'], 'gold' => (int) $info['gold'], 'flowers' => (int) $info['flowers']);
         }
     } catch (Exception $e) {
         error_log($e);
         $trans_characters->rollback();
         return -1;
     }
     return $return;
 }
開發者ID:hucongyang,項目名稱:goddess,代碼行數:47,代碼來源:User.php

示例4: actionFilter

 /**
  * 女神分類篩選
  *
  * @param string $type          0-最新,1-最熱 默認0
  * @param string $tag_id        關鍵字,標簽
  * @param string $page          頁號
  * @param string $page_size     頁大小 需傳遞,服務端可僅支持幾種固定pageSize
  *
  */
 public function actionFilter()
 {
     // 參數檢查
     if (!isset($_REQUEST['page']) || !isset($_REQUEST['page_size'])) {
         $this->_return('MSG_ERR_LESS_PARAM');
     }
     $now = date("Y-m-d H:i:s");
     $type = trim(Yii::app()->request->getParam('type'));
     $page = trim(Yii::app()->request->getParam('page'));
     $page_size = trim(Yii::app()->request->getParam('page_size'));
     $tag_id = trim(Yii::app()->request->getParam('tag_id'));
     if (!is_numeric($tag_id)) {
         $this->_return('MSG_ERR_FAIL_PARAM');
     }
     $tag = Common::model()->getLabel();
     $lable = array();
     foreach ($tag as $key => $v) {
         $lable[] = $v['id'];
     }
     if (!in_array($tag_id, $lable)) {
         //沒有這個標簽
         $this->_return('MSG_ERR_NO_FOUND_TAG');
     }
     $type = empty($type) ? 0 : $type;
     if ($type != 1 && $type != 0) {
         $this->_return('MSG_ERR_FAIL_PARAM');
     }
     $data = Goddess::model()->filterGoddessList($tag_id, $type, $page, $page_size);
     if ($data === false) {
         $this->_return('MSG_ERR_UNKOWN');
     }
     $now = date("Y-m-d H:i:s");
     $user_id = trim(Yii::app()->request->getParam('user_id'));
     $token = trim(Yii::app()->request->getParam('token'));
     $followed = array();
     if (isset($user_id) && !empty($user_id)) {
         if (!is_numeric($user_id)) {
             $this->_return('MSG_ERR_FAIL_PARAM');
         }
         //用戶不存在 返回錯誤
         if ($user_id < 1) {
             $this->_return('MSG_ERR_NO_USER');
         }
         //驗證token
         if (Token::model()->verifyToken($user_id, $token, $GLOBALS['__APPID'])) {
             $followed = Follow::model()->followedList($user_id);
         }
     }
     foreach ($data as $k => $r) {
         if (is_array($r) && !empty($r)) {
             //增加圖片
             $rand = mt_rand(1, 100);
             if ($rand == 1) {
                 $picLv = 10;
             } elseif ($rand == 2 || $rand == 3) {
                 $picLv = 9;
             } elseif ($rand > 2 && $rand < 6) {
                 $picLv = 8;
             } elseif ($rand > 5 && $rand < 10) {
                 $picLv = 7;
             } elseif ($rand > 9 && $rand < 15) {
                 $picLv = 6;
             } elseif ($rand > 14 && $rand < 21) {
                 $picLv = 5;
             } elseif ($rand > 20 && $rand < 28) {
                 $picLv = 4;
             } elseif ($rand > 27 && $rand < 36) {
                 $picLv = 3;
             } elseif ($rand > 35 && $rand < 45) {
                 $picLv = 2;
             } else {
                 $picLv = 1;
             }
             $t = Photo::model()->heroinePhotosIds($r['goddess_id'], $picLv);
             $p = array();
             if (!empty($t)) {
                 $tKey = array_rand($t, 1);
                 $p = Photo::model()->photoInfo($t[$tKey]['photo_id']);
             }
             unset($p['heroine_id']);
             unset($p['devit']);
             $p = array();
             if (empty($p)) {
                 $p = Photo::model()->single($r['goddess_id']);
             }
             if ($p === false) {
                 $p = null;
             }
             $data[$k]['photo'] = $p;
             if (in_array($r['goddess_id'], $followed)) {
                 $data[$k]['followed'] = 1;
//.........這裏部分代碼省略.........
開發者ID:hucongyang,項目名稱:goddess,代碼行數:101,代碼來源:GoddessController.php

示例5: actionGenerateIapTradeno

 /**
  * IOS IAP獲取服務器訂單號
  */
 public function actionGenerateIapTradeno()
 {
     if (!isset($_REQUEST['token']) || !isset($_REQUEST['uid']) || !isset($_REQUEST['item_id'])) {
         $this->_return('MSG_ERR_LESS_PARAM');
     }
     $uid = trim(Yii::app()->request->getParam('uid'));
     $token = trim(Yii::app()->request->getParam('token'));
     $goods_id = Yii::app()->request->getParam('item_id');
     $pay_type = 102;
     //IOS IAP
     if (!Token::model()->verifyToken($uid, $token, $GLOBALS['__APPID'])) {
         $this->_return('MSG_ERR_TOKEN');
         //#token 錯誤
     }
     if (!User::model()->isSetPassword($uid)) {
         $this->_return('MSG_ERR_UNSET_PASSWORD');
     }
     $goods_info = Common::model()->getGoodsInfo($goods_id);
     if (!is_array($goods_info)) {
         $this->_return('MSG_ERR_FAIL_PARAM');
     }
     // 支付訂單創建
     $out_trade_no = Pay::model()->createOrder($uid, $goods_info, $GLOBALS['__APPID'], $pay_type, $GLOBALS['__CHANNEL'], $GLOBALS['__PLATFORM']);
     if ($out_trade_no < 0) {
         $this->_return('MSG_ERR_UNKOWN');
     }
     Log::model()->_pay_log($uid, 'CREATE_ORDER', date('Y-m-d H:i:s'), $out_trade_no);
     $this->_return('MSG_SUCCESS', array('trade_no' => $out_trade_no));
 }
開發者ID:hucongyang,項目名稱:goddess,代碼行數:32,代碼來源:PayController.php

示例6: getNoFollowPhotoInfo

 /**
  * 獲得某用戶 某女神  未關注  圖片 詳細信息
  *
  * @param unknown $user_id
  * @param unknown $heroine_id
  * @param number $level
  * @return unknown
  */
 public function getNoFollowPhotoInfo($user_id, $heroine_id, $level = 0)
 {
     //隨機取照片等級 '等級'=> '概率'
     $prize_arr = array('1' => 70, '2' => 14, '3' => 10, '4' => 5, '5' => 1);
     $rlevel = Common::model()->get_rand($prize_arr);
     //獲取該女神的所有照片ID 列表
     $heroine_photoIds = $this->heroinePhotosIds($heroine_id, $rlevel);
     //查詢解鎖照片
     $user_photos = $this->unlockPhotosIds($user_id, $heroine_id);
     //去重
     $ids = Common::model()->array_dif($heroine_photoIds, $user_photos);
     unset($user_photos);
     unset($heroine_photoIds);
     $photoinfo = array();
     if ($ids) {
         //隨機取
         $photo_id = Common::model()->randData($ids);
         $photoinfo = Photo::model()->photoInfo($photo_id['photo_id']);
     }
     return $photoinfo;
 }
開發者ID:hucongyang,項目名稱:goddess,代碼行數:29,代碼來源:Photo.php

示例7: postExtraLesson

 /**
  * 教師提交補課信息
  * @param $user_id
  * @param $departmentId
  * @param $courseId
  * @param $classroomId
  * @param $extraTime
  * @param $studentJson
  * @param $extraReason
  * @return array|bool
  */
 public function postExtraLesson($user_id, $departmentId, $courseId, $classroomId, $extraTime, $studentJson, $extraReason)
 {
     $data = array();
     $nowTime = date('Y-m-d H:i:s');
     try {
         $con_user = Yii::app()->cnhutong;
         // 補課表添加數據
         $result1 = $con_user->createCommand()->insert('com_extra', array('member_id' => $user_id, 'extra_time' => $extraTime, 'department_id' => $departmentId, 'course_id' => $courseId, 'classroom_id' => $classroomId, 'create_time' => $nowTime, 'update_time' => $nowTime, 'flag' => 1, 'status' => 1, 'type' => 2, 'reason' => $extraReason));
         // 獲取補課表id
         $extraId = Yii::app()->cnhutong->getLastInsertID();
         $studentNameArr = array();
         // 補課詳情表添加數據
         foreach ($studentJson as $row) {
             $result2 = $con_user->createCommand()->insert('com_extra_detail', array('extra_id' => $extraId, 'member_id' => $row['studentId'], 'status' => 0, 'create_time' => $nowTime, 'update_time' => $nowTime, 'create_user_id' => 0, 'update_user_id' => 0));
             if (Common::model()->getNameById($row['studentId'])) {
                 $studentNameArr[] = Common::model()->getNameById($row['studentId']);
             }
         }
         // 推送相關補課消息給相應老師
         // 申請人名稱
         $userName = Common::model()->getNameById($user_id);
         // 學員名稱
         $studentNames = implode(' ', $studentNameArr);
         // 加課時間 $extraTime
         // 課程
         $courseName = Common::model()->getCourseById($courseId);
         // 校區
         $departmentName = Common::model()->getDepartmentById($departmentId);
         // 老師
         $teacherName = Common::model()->getNameById($user_id);
         // 教室
         $classroomName = Common::model()->getClassroomById($classroomId);
         // 理由 備注 $extraReason
         $msg_content = " 申請人: {$userName} &8424 學員: {$studentNames} &8424 時間: {$extraTime} &8424 課程: {$courseName} &8424 老師: {$teacherName} &8424 教室: {$departmentName}/{$classroomName} &8424 備注: {$extraReason} ";
         $msg_title = '老師補課申請';
         $alert_content = $teacherName . " 提交了 " . $extraTime . " 的補課申請";
         // 添加老師補課消息
         Notice::model()->insertNotice($user_id, $user_id, 1, null, $extraId, 3, $msg_title, $msg_content, $nowTime, 1, 0);
         $push = Push::model()->pushMsg(11, $user_id, '3', $msg_title, $alert_content);
         if ($push) {
             return true;
         } else {
             return false;
         }
     } catch (Exception $e) {
         error_log($e);
         return false;
     }
 }
開發者ID:hucongyang,項目名稱:student_cnhutong,代碼行數:60,代碼來源:User.php

示例8: getGuess

 /**
  * 根據規則 抽一張圖
  * @param unknown $user_id
  * @param unknown $goddess_id
  * @param unknown $liking
  * @return number|multitype:number Ambigous <number, unknown> Ambigous <number, mixed, unknown>
  */
 public function getGuess($user_id, $goddess_id, $liking)
 {
     $con_game = Yii::app()->db_game;
     $table_name = sprintf('guess_%02s', dechex($user_id % 256));
     //根據女神ID 查詢解鎖照片數  總照片數 解鎖照片ID
     $user_photos = Photo::model()->unlockPhotosIds($user_id, $goddess_id);
     if (count($user_photos) > 0) {
         $heroine_photoIds_temp = array();
         for ($i = 1; $i <= 10; $i++) {
             $heroine_photoIds = Photo::model()->heroinePhotosIds($goddess_id, $i);
             $all_num = count($heroine_photoIds);
             $ids = Common::model()->array_dif($heroine_photoIds, $user_photos);
             if (count($ids) != 0) {
                 $temp = $i;
                 break;
             }
         }
         $unlock_num = count($ids);
     } else {
         $i = 0;
         $heroine_photoIds = Photo::model()->heroinePhotosIds($goddess_id, 1);
         $all_num = count($heroine_photoIds);
         $ids = $heroine_photoIds;
         $unlock_num = count($ids);
     }
     if (count($heroine_photoIds) == 0) {
         return array('err' => -6);
     }
     //判定好感等級, 不到等級 不能參加 猜牌
     if ((int) $liking['level'] < (int) $i) {
         return array('err' => -3);
     }
     foreach ($ids as $k => $v) {
         $temp = $v;
         break;
     }
     $photo_id = (int) $temp['photo_id'];
     $photo_info = Photo::model()->photoInfo($photo_id);
     //查詢這張照片已經猜圖幾次  每多一次 增加5% 幾率;
     $guess_res = $con_game->createCommand()->select('count(*) as count')->from($table_name)->where('photo_id=:ID AND status=1 AND user_id=:USERID AND game_type = 0')->bindParam(':ID', $photo_id, PDO::PARAM_INT, 11)->bindParam(':USERID', $user_id, PDO::PARAM_INT, 11)->queryRow();
     $add_rate = 0;
     if ($guess_res['count'] != 0) {
         $sel_guess_res = $con_game->createCommand()->select('*')->from($table_name)->where('photo_id=:ID AND status=0 AND card_type = 8 AND user_id=:USERID')->bindParam(':ID', $photo_id, PDO::PARAM_INT, 11)->bindParam(':USERID', $user_id, PDO::PARAM_INT, 11)->queryRow();
         if ($sel_guess_res) {
             $sel_guess_res['unlock_num'] = $unlock_num;
             $sel_guess_res['all_num'] = $all_num;
             $sel_guess_res['url'] = $photo_info['url'];
             $sel_guess_res['thumb'] = $photo_info['url'];
             return array('err' => -5, 'result' => $sel_guess_res);
         }
         //查詢是否猜牌是否5的倍數  如果是5次,查詢是否已經擦塗過
         if ($guess_res['count'] % 5 == 0) {
             $num = $guess_res['count'] / 5;
             $guess_res = $con_game->createCommand()->select('count(id) as count')->from($table_name)->where('photo_id=:ID AND status=1 AND card_type = 8 AND user_id=:USERID')->bindParam(':ID', $photo_id, PDO::PARAM_INT, 11)->bindParam(':USERID', $user_id, PDO::PARAM_INT, 11)->queryRow();
             if ($num > $guess_res['count']) {
                 $guess = array('image_id' => (int) $photo_id, 'unlock_num' => $unlock_num, 'all_num' => $all_num, 'url' => $photo_info['url'], 'thumb' => $photo_info['url'], 'type' => 3, 'vit' => 0, 'liking' => 0, 'gold' => 0, 'flowers' => 0);
                 return array('err' => -4, 'result' => $guess);
             }
         }
         $add_rate = $guess_res['count'] % 5 * 5;
     }
     $liking = Liking::model()->getLikingRow($photo_info['level']);
     //按等級抽女神牌幾率
     $rate = $liking['rate'] + $add_rate;
     //剩餘牌幾率
     $status_rate = 100 - (int) $rate;
     //0 空牌 1目標牌 2效果牌
     $prize_arr = array('1' => $rate, '2' => $status_rate);
     $type = Common::model()->get_rand($prize_arr);
     $card_type = $type;
     $card_val = 0;
     $vit = 0;
     $liking = 0;
     $gold = 0;
     $flowers = 0;
     $i = rand(1, 2);
     //隨機取效果牌 0無效牌  3體力 4好感 5獲得金幣 6盜走金幣 7獲得玫瑰花
     $return_arr[0]['url'] = $photo_info['url'];
     $url_thumb = $photo_info['url'];
     if ($type == 1) {
         $return_arr[0]['url'] = $photo_info['url'];
         $return_arr[0]['type'] = 1;
     }
     $status_arr = Yii::app()->params['game_arr'][$GLOBALS['__APPID']]['status_card'];
     $r_1 = rand(1, 17);
     switch ($r_1) {
         case 1:
         case 2:
             $random_arr_1 = 3;
             break;
         case 3:
         case 4:
         case 5:
//.........這裏部分代碼省略.........
開發者ID:hucongyang,項目名稱:goddess,代碼行數:101,代碼來源:Guess.php

示例9: actionSoftwareOnOff

 public function actionSoftwareOnOff()
 {
     $res = Common::model()->getSoftwareOnoff();
     switch ($res) {
         //係統繁忙,請稍後再試
         case -1:
             $this->_return('MSG_ERR_SOFTWARE_OFF');
         default:
             break;
     }
     // 發送返回值
     $this->_return('MSG_SUCCESS');
 }
開發者ID:hucongyang,項目名稱:goddess,代碼行數:13,代碼來源:UserController.php

示例10: actionSoftware

 public function actionSoftware()
 {
     // 參數檢查
     if (!isset($_REQUEST['user_id']) || !isset($_REQUEST['token'])) {
         $this->_return('MSG_ERR_LESS_PARAM');
     }
     $user_id = trim(Yii::app()->request->getParam('user_id'));
     $token = trim(Yii::app()->request->getParam('token'));
     //
     $res = Common::model()->getSoftwareList($user_id);
     // 發送返回值
     $this->_return('MSG_SUCCESS', $res);
 }
開發者ID:hucongyang,項目名稱:goddess,代碼行數:13,代碼來源:CommonController.php

示例11: postSign

 /**
  * 提交任務簽到接口:
  * 教師在App中提交學員課時簽到信息
  * @param $user_id
  * @param $lessonJson
  * @return bool|int
  */
 public function postSign($user_id, $lessonJson)
 {
     $nowTime = date('Y-m-d H:m:i');
     try {
         $con_task = Yii::app()->cnhutong;
         $table_name = 'ht_lesson_student';
         // 按照課時ID進行簽到,ht_lesson_student: status_id = 1(老師簽到),step = 0 正常, step = 1 補課, step = 2 缺勤, step = 6 請假
         foreach ($lessonJson as $row) {
             // 需要對$lessonJson裏麵的數值做判斷 if... step = 0 增加一條消息記錄,jPush推送學員用戶; step = 2|6 增加一條補課機會記錄
             $result = $con_task->createCommand()->update($table_name, array('status_id' => 1, 'step' => $row['step']), 'id = :id', array(':id' => $row['lessonStudentId']));
             if ($row['step'] == 2 || $row['step'] == 6) {
                 // 判斷 step = 2|6 添加補課機會記錄
                 self::insertExtraChance($row['lessonStudentId'], $row['step']);
             } elseif ($row['step'] == 0) {
                 // step = 0 增加一條消息記錄,jPush推送學員用戶發送銷課通知
                 $acceptIdArr = self::getAcceptIdByLessonStudentId($row['lessonStudentId']);
                 // $acceptArr = array(); 則表示為該學員未綁定任何user_id 隻記錄消息,不推送
                 if ($acceptIdArr && $acceptIdArr[0]['user_id']) {
                     foreach ($acceptIdArr as $acceptId) {
                         $lessonDetail = Common::model()->getLessonDetailById($row['lessonStudentId']);
                         // 推送相關補課消息給相應老師
                         // 學員名稱
                         $studentName = $lessonDetail['studentName'];
                         // 時間
                         $dateTime = $lessonDetail['date'] . ' ' . $lessonDetail['time'];
                         // 課程
                         $courseName = $lessonDetail['course'];
                         // 課時
                         $lesson_cnt_charged = $lessonDetail['lesson_cnt_charged'];
                         // 校區
                         $departmentName = $lessonDetail['department'];
                         // 老師
                         $teacherName = Common::model()->getNameById($user_id);
                         // 教室
                         $classroomName = $lessonDetail['classroom'];
                         // 學員
                         $studentId = $lessonDetail['studentId'];
                         // 理由 備注 $extraReason
                         $msg_content = " 學員: {$studentName} &8424 時間: {$dateTime} &8424 課程: {$courseName} &8424 課時: {$lesson_cnt_charged} &8424 老師: {$teacherName} &8424 教室: {$departmentName}/{$classroomName} ";
                         $msg_title = '銷課通知';
                         $alert_content = $studentName . " 完成了 " . $courseName;
                         $push = Push::model()->pushMsg(10, $acceptId['user_id'], '1', $msg_title, $alert_content);
                         //                            if ($push) {
                         //                                return true;
                         //                            } else {
                         //                                return false;
                         //                            }
                     }
                     // 添加老師銷課消息
                     Notice::model()->insertNotice($user_id, $studentId, 1, null, null, 1, $msg_title, $msg_content, $nowTime, 1, 0);
                 } else {
                     // 記錄消息,不推送
                     $lessonDetail = Common::model()->getLessonDetailById($row['lessonStudentId']);
                     // 推送相關補課消息給相應老師
                     // 學員名稱
                     $studentName = $lessonDetail['studentName'];
                     // 時間
                     $dateTime = $lessonDetail['date'] . ' ' . $lessonDetail['time'];
                     // 課程
                     $courseName = $lessonDetail['course'];
                     // 課時
                     $lesson_cnt_charged = $lessonDetail['lesson_cnt_charged'];
                     // 校區
                     $departmentName = $lessonDetail['department'];
                     // 老師
                     $teacherName = Common::model()->getNameById($user_id);
                     // 教室
                     $classroomName = $lessonDetail['classroom'];
                     // 學員
                     $studentId = $lessonDetail['studentId'];
                     // 理由 備注 $extraReason
                     $msg_content = " 學員: {$studentName} &8424 時間: {$dateTime} &8424 課程: {$courseName} &8424 課時: {$lesson_cnt_charged} &8424 老師: {$teacherName} &8424 教室: {$departmentName}/{$classroomName} ";
                     $msg_title = '銷課通知';
                     // 添加老師銷課消息
                     Notice::model()->insertNotice($user_id, $studentId, 1, null, null, 1, $msg_title, $msg_content, $nowTime, 1, 0);
                 }
             } else {
                 return false;
             }
             //                return true;        // 不加會返回null
         }
     } catch (Exception $e) {
         error_log($e);
         return false;
     }
 }
開發者ID:hucongyang,項目名稱:student_cnhutong,代碼行數:93,代碼來源:Task.php

示例12: lessonStudentLeave

 /**
  * 提交課時請假信息
  * @param $memberId
  * @param $courseId
  * @param $lessonStudentId
  * @param $dateTime
  * @param $reason
  * @return bool
  */
 public function lessonStudentLeave($memberId, $courseId, $lessonStudentId, $dateTime, $reason)
 {
     $nowTime = date('Y-m-d H:i:s');
     try {
         $con_user = Yii::app()->cnhutong;
         $table_name = 'com_leave';
         // 請假表記錄請假詳情
         $data = $con_user->createCommand()->insert($table_name, array('member_id' => $memberId, 'course_id' => $courseId, 'lesson_student_id' => $lessonStudentId, 'leave_time' => $dateTime, 'create_time' => $nowTime, 'update_time' => $nowTime, 'flag' => 2, 'status' => 1, 'reason' => $reason));
         $leaveId = Yii::app()->cnhutong->getLastInsertID();
         // 學員請假直接修改課表課時狀態
         $dataLeave = $con_user->createCommand()->update('ht_lesson_student', array('step' => 6), 'id = :lessonStudentId', array(':lessonStudentId' => $lessonStudentId));
         // 根據課時id獲得學員id (ht_lesson_student),再根據學員id獲得綁定的user_id(com_user_member)
         $lessonDetail = Common::model()->getLessonDetailById($lessonStudentId);
         // 推送相關請假消息給相應老師
         // 學員名稱
         $studentName = $lessonDetail['studentName'];
         // 時間
         $dateTime = $lessonDetail['date'] . ' ' . $lessonDetail['time'];
         // 課程
         $courseName = $lessonDetail['course'];
         // 課時
         $lesson_cnt_charged = $lessonDetail['lesson_cnt_charged'];
         // 校區
         $departmentName = $lessonDetail['department'];
         // 老師
         $teacherId = $lessonDetail['teacherId'];
         // 教室
         $classroomName = $lessonDetail['classroom'];
         // 理由 備注 $extraReason
         $msg_content = " 學員: {$studentName} &8424 時間: {$dateTime} &8424 課程: {$courseName} &8424 課時: {$lesson_cnt_charged} &8424 教室: {$departmentName}/{$classroomName} &8424 備注: {$reason} ";
         $msg_title = '學員請假通知';
         $alert_content = $dateTime . " 的 " . $courseName . " 有一位學員請假";
         // 添加學員請假消息
         // 教師
         Notice::model()->insertNotice($memberId, $teacherId, 2, $leaveId, null, 2, $msg_title, $msg_content, $nowTime, 1, 0);
         // 學生
         Notice::model()->insertNotice($memberId, $memberId, 2, $leaveId, null, 2, $msg_title, $msg_content, $nowTime, 1, 0);
         $push = Push::model()->pushMsg(11, $teacherId, '2', $msg_title, $alert_content);
         //            if ($push) {
         //                return true;
         //            } else {
         //                return false;
         //            }
     } catch (Exception $e) {
         error_log($e);
         return false;
     }
 }
開發者ID:hucongyang,項目名稱:student_cnhutong,代碼行數:57,代碼來源:Lesson.php


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