public function actionUserAction() { if (!isset($_REQUEST['userId'])) { $this->_return('MSG_ERR_LESS_PARAM'); } $userId = Yii::app()->request->getParam('userId', NULL); $data = LogUserAction::model()->getUserAction($userId); $this->_return('MSG_SUCCESS', $data); }
/** * action_id : 2114 * 用户在app中获取积分历史 * @token $token string --登录token * @userId $userId int --用户id * @return result 调用返回结果 * @return msg 调用返回结果说明 * @return data 调用返回数据 */ public function actionGetUserPointHistory() { if (!isset($_REQUEST['token']) || !isset($_REQUEST['userId']) || !isset($_REQUEST['historyId'])) { $this->_return('MSG_ERR_LESS_PARAM'); } $token = Yii::app()->request->getParam('token', NULL); $userId = Yii::app()->request->getParam('userId', NULL); $historyId = Yii::app()->request->getParam('historyId', NULL); if (!ctype_digit($userId)) { $this->_return('MSG_ERR_FAIL_USER'); } if (!ctype_digit($historyId)) { $this->_return('MSG_ERR_HISTORY_ID'); } // 用户user/token验证 $userToken = UserToken::model()->IsToken($userId, $token); if (!$userToken) { $this->_return('MSG_ERR_FAIL_TOKEN'); // MSG_ERR_FAIL_TOKEN } $data = UserScoreHistory::model()->userPointHistory($userId, $historyId); if ($data === 20030) { $this->_return('MSG_ERR_NULL_HISTORY'); } // TODO : add log $actionId = 2114; $params = ''; foreach ($_REQUEST as $key => $value) { $params .= $key . '=' . $value . '&'; } LogUserAction::model()->userAction($userId, $actionId, $params); $this->_return('MSG_SUCCESS', $data); }
/** * action_id : 2306 * 学员在APP中对自己的课时进行请假或者取消请假的操作 * @param userId -- 用户ID * @param token -- 用户验证token * @param memberId -- 用户当前绑定的学员所对应的ID * @param lessonStudentId -- 课程的唯一排课编号 * @param leaveType -- 请假类型 1表示请假,2表示取消请假 * @return result 调用返回结果 * @return msg 调用返回结果说明 * @return data 调用返回数据 */ public function actionLessonStudentLeave() { // 检查参数 if (!isset($_REQUEST['userId']) || !isset($_REQUEST['token']) || !isset($_REQUEST['memberId']) || !isset($_REQUEST['lessonStudentId']) || !isset($_REQUEST['leaveType'])) { $this->_return('MSG_ERR_LESS_PARAM'); } $userId = Yii::app()->request->getParam('userId', NULL); $token = Yii::app()->request->getParam('token', NULL); $memberId = Yii::app()->request->getParam('memberId', NULL); $lessonStudentId = Yii::app()->request->getParam('lessonStudentId', NULL); $leaveType = Yii::app()->request->getParam('leaveType', NUll); $aType = array(1, 2); if (!in_array($leaveType, $aType)) { $this->_return('MSG_ERR_LEAVE_TYPE'); } $data = HtLessonStudent::model()->lessonStudentLeave($userId, $token, $memberId, $lessonStudentId, $leaveType); if ($data === 20008) { $this->_return('MSG_ERR_FAIL_USER'); } elseif ($data === 20007) { $this->_return('MSG_ERR_FAIL_TOKEN'); } elseif ($data === 20017) { $this->_return('MSG_ERR_FAIL_MEMBER'); } elseif ($data === 20021) { $this->_return('MSG_ERR_LESSON_STUDENT_ID'); } elseif ($data === 20031) { $this->_return('MSG_ERR_LEAVE_TYPE'); } elseif ($data === 20032) { $this->_return('MSG_ERR_NO_LEAVE'); } elseif ($data === 20033) { $this->_return('MSG_ERR_NO_CANCEL_LEAVE'); } // TODO : add log $actionId = 2306; $params = ''; foreach ($_REQUEST as $key => $value) { $params .= $key . '=' . $value . '&'; } LogUserAction::model()->userAction($userId, $actionId, $params); $this->_return('MSG_SUCCESS', $data); }
/** * action_id : 2206 * @userId $userId -- 用户ID * @shareType $shareType -- 分享类型 1-文章,2-题库测试 * @shareId $shareId -- 分享对应文章ID/对应测试ID。类型决定所传ID * @platform $platform -- 用户分享文章或测试的平台 1-微信,2-QQ ... * 获取APP中所有分享成功的相关数据 * @return result 调用返回结果 * @return msg 调用返回结果说明 * @return data 调用返回数据 */ public function actionPostShareInfo() { if (!isset($_REQUEST['userId']) || !isset($_REQUEST['shareType']) || !isset($_REQUEST['shareId']) || !isset($_REQUEST['platform'])) { $this->_return('MSG_ERR_LESS_PARAM'); } $userId = Yii::app()->request->getParam('userId', NULL); $shareType = Yii::app()->request->getParam('shareType', NULL); $shareId = Yii::app()->request->getParam('shareId', NULL); $platform = Yii::app()->request->getParam('platform', NULL); if (!ctype_digit($userId)) { $this->_return('MSG_ERR_FAIL_USER'); } if (!in_array($shareType, [1, 2])) { $this->_return('MSG_ERR_FAIL_SHARE_TYPE'); } if (!ctype_digit($shareId)) { $this->_return('MSG_ERR_FAIL_SHARE_ID'); } if (!ctype_digit($platform)) { $this->_return('MSG_ERR_FAIL_PLATFORM'); } $data = LogUserShare::model()->postShareInfo($userId, $shareType, $shareId, $platform); // TODO : add log $actionId = 2203; $params = ''; foreach ($_REQUEST as $key => $value) { $params .= $key . '=' . $value . '&'; } LogUserAction::model()->userAction($userId, $actionId, $params); $this->_return('MSG_SUCCESS', $data); }
/** * action_id : 2505 * 获取秦汉胡同老师作品详情 * @param userId -- 用户ID * @param produceId -- 作品对应ID * @return result 调用返回结果 * @return msg 调用返回结果说明 * @return data 调用返回数据 */ public function actionGetTeacherProductInfo() { if (!isset($_REQUEST['userId']) || !isset($_REQUEST['productId'])) { $this->_return('MSG_ERR_LESS_PARAM'); } $userId = Yii::app()->request->getParam('userId', NULL); $productId = Yii::app()->request->getParam('productId', NULL); if (!ctype_digit($userId)) { $this->_return('MSG_ERR_FAIL_USER'); } if (!ctype_digit($productId)) { $this->_return('MSG_ERR_FAIL_PRODUCE_ID'); } $data = ComTeacher::model()->getTeacherProductInfo($productId); // TODO : add log $actionId = 2505; $params = ''; foreach ($_REQUEST as $key => $value) { $params .= $key . '=' . $value . '&'; } LogUserAction::model()->userAction($userId, $actionId, $params); $this->_return('MSG_SUCCESS', $data); }
/** * action_id : 2403 * 用户完成测试试卷后提交试卷 * @userId $userId -- 用户ID * @token $token -- 用户验证token * @subject $testId -- 本次测试对应编号 * @answer $answer -- 提交答案 * @return result 调用返回结果 * @return msg 调用返回结果说明 * @return data 调用返回数据 */ public function actionPostTestAnswer() { // 检查参数 if (!isset($_REQUEST['userId']) || !isset($_REQUEST['token']) || !isset($_REQUEST['testId']) || !isset($_REQUEST['answer'])) { $this->_return('MSG_ERR_LESS_PARAM'); } $userId = Yii::app()->request->getParam('userId', NULL); $token = Yii::app()->request->getParam('token', NULL); $testId = Yii::app()->request->getParam('testId', NULL); $answer = Yii::app()->request->getParam('answer', NULL); $data = UserQuestionHistory::model()->postTestAnswer($userId, $token, $testId, $answer); if ($data === 20008) { $this->_return('MSG_ERR_FAIL_USER'); } elseif ($data === 20007) { $this->_return('MSG_ERR_FAIL_TOKEN'); } elseif ($data === 20012) { $this->_return('MSG_ERR_FAIL_TESTID'); } elseif ($data === 20023) { $this->_return('MSG_ERR_QUESTION'); } // TODO : add log $actionId = 2403; $params = ''; foreach ($_REQUEST as $key => $value) { $params .= $key . '=' . $value . '&'; } LogUserAction::model()->userAction($userId, $actionId, $params); $this->_return('MSG_SUCCESS', $data); }