/** * 版本升级 * $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'); } }
public function actionGetActivities() { $data = Common::model()->getActivities(); $this->_return('MSG_SUCCESS', $data); }
/** * 软件兑换金币 * * @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; }
/** * 女神分类筛选 * * @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; } else { $data[$k]['followed'] = 0; } } } $this->_return('MSG_SUCCESS', $data); }
/** * 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)); }
/** * 获得某用户 某女神 未关注 图片 详细信息 * * @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; }
/** * 教师提交补课信息 * @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; } }
/** * 根据规则 抽一张图 * @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: $random_arr_1 = 4; break; case 6: case 7: case 8: $random_arr_1 = 5; break; case 9: case 10: case 11: $random_arr_1 = 6; break; case 12: case 13: case 14: $random_arr_1 = 7; break; case 15: case 16: case 17: $random_arr_1 = 2; break; } unset($status_arr[$random_arr_1]); $random_arr_2 = array_rand($status_arr, 1); $random[0] = $random_arr_1; $random[1] = $random_arr_2; $return_arr[1] = $this->getRandomCard($random[0]); $return_arr[2] = $this->getRandomCard($random[1]); if ($type == 2) { if ($random[0] == 2) { $type = 0; } $card_type = $random[0]; $card_val = $return_arr[1]['val']; $vit = $return_arr[1]['vit']; $liking = $return_arr[1]['liking']; $gold = $return_arr[1]['gold']; $flowers = $return_arr[1]['flowers']; $url = $return_arr[1]['url']; if ($i == 1) { $return_arr[0]['type'] = $return_arr[1]['type']; $return_arr[0]['url'] = $return_arr[1]['url']; $return_arr[1]['type'] = 1; $return_arr[1]['url'] = $photo_info['url']; } if ($i == 2) { $return_arr[0]['type'] = $return_arr[1]['type']; $return_arr[0]['url'] = $return_arr[1]['url']; $return_arr[1]['type'] = $return_arr[2]['type']; $return_arr[1]['url'] = $return_arr[2]['url']; $return_arr[2]['type'] = 1; $return_arr[2]['url'] = $photo_info['url']; } } unset($return_arr[1]['val']); unset($return_arr[1]['vit']); unset($return_arr[1]['liking']); unset($return_arr[1]['gold']); unset($return_arr[1]['flowers']); unset($return_arr[2]['val']); unset($return_arr[2]['vit']); unset($return_arr[2]['liking']); unset($return_arr[2]['gold']); unset($return_arr[2]['flowers']); // var_dump($return_arr);exit; if ($GLOBALS['__VERSION'] > '1.0') { $guess = array('cards' => $return_arr, 'image_id' => (int) $photo_id, 'thumb' => $url_thumb, 'unlock_num' => $unlock_num, 'all_num' => $all_num, 'type' => $type, 'card_type' => $card_type, 'val' => $card_val, 'vit' => $vit, 'liking' => $liking, 'gold' => $gold, 'flowers' => $flowers); } else { $url = $return_arr[0]['url']; $guess = array('image_id' => (int) $photo_id, 'url' => $url, 'thumb' => $url_thumb, 'unlock_num' => $unlock_num, 'all_num' => $all_num, 'type' => $type, 'card_type' => $card_type, 'val' => $card_val, 'vit' => $vit, 'liking' => $liking, 'gold' => $gold, 'flowers' => $flowers); } return $guess; }
public function actionSoftwareOnOff() { $res = Common::model()->getSoftwareOnoff(); switch ($res) { //系统繁忙,请稍后再试 case -1: $this->_return('MSG_ERR_SOFTWARE_OFF'); default: break; } // 发送返回值 $this->_return('MSG_SUCCESS'); }
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); }
/** * 提交任务签到接口: * 教师在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; } }
/** * 提交课时请假信息 * @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; } }