当前位置: 首页>>代码示例>>PHP>>正文


PHP Log::model方法代码示例

本文整理汇总了PHP中Log::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::model方法的具体用法?PHP Log::model怎么用?PHP Log::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Log的用法示例。


在下文中一共展示了Log::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionProfile

 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionProfile($username = '')
 {
     $this->layout = '//layouts/column1';
     if (!$username and Yii::app()->user->isGuest) {
         Yii::app()->user->setReturnUrl(Yii::app()->getRequest()->url);
         $this->redirect(array('site/login'));
     }
     if (!$username) {
         $this->redirect(array('profile/' . Yii::app()->user->name));
     }
     if (!($this->model = User::model()->find('username=:username', array(':username' => $username)))) {
         throw new CHttpException(404, 'The username ' . $username . ' does not exist.');
     }
     //$this->model=$this->loadModel($id);
     $this->model->country = Country::model()->findByPk($this->model->country_id)->name;
     $status = Yii::app()->db->createCommand()->select('*')->from('user_status')->queryRow();
     $this->model->status = $status['name'];
     $type = Yii::app()->db->createCommand()->select('*')->from('user_type')->queryRow();
     $this->model->type = $type['name'];
     $this->model->country_created = Country::model()->findByPk($this->model->country_id_created)->name;
     $stat_subs = Subject::model()->count('user_id=:user_id', array(':user_id' => $this->model->id));
     $stat_comments = Comment::model()->count('user_id=:user_id', array(':user_id' => $this->model->id));
     $stat_usage_counter = Log::model()->count('user_id=:user_id', array(':user_id' => $this->model->id));
     $last_log_line = Log::model()->find(array('limit' => 2, 'offset' => 1, 'order' => 't.id DESC', 'params' => array(':user_id' => $this->model->id)));
     $this->render('view', array('model' => $this->model, 'stat_subs' => $stat_subs, 'stat_comments' => $stat_comments, 'stat_last_online' => $last_log_line->time, 'stat_usage_counter' => $stat_usage_counter));
 }
开发者ID:jjsub,项目名称:samesub,代码行数:30,代码来源:UserController.php

示例2: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Log::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:vitaliy7711,项目名称:pdnsops,代码行数:13,代码来源:LogController.php

示例3: loadModel

 public function loadModel($id)
 {
     $model = Log::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     // if(!$model->hasAccess(Yii::app()->user->id))
     //    throw new CHttpException(403,'Access Denaid');
     return $model;
 }
开发者ID:hkhateb,项目名称:linet3,代码行数:10,代码来源:LogController.php

示例4: actionIndex

 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     if (!($snapFeed = Yii::app()->cache->get('snapFeed'))) {
         $curl = curl_init();
         curl_setopt($curl, CURLOPT_URL, 'http://www.snapfrozen.com.au/feed/atom/');
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
         $snapFeed = curl_exec($curl);
         curl_close($curl);
         Yii::app()->cache->set('snapFeed', $snapFeed, 60 * 60 * 24);
     }
     $RecentActivity = Log::model()->findAll(array('limit' => 10, 'order' => 'logtime DESC', 'condition' => 'level="info"'));
     $this->render('index', array('snapFeed' => simplexml_load_string($snapFeed), 'feedLimit' => 5, 'RecentActivity' => $RecentActivity));
 }
开发者ID:snapfrozen,项目名称:snapcms,代码行数:17,代码来源:SiteController.php

示例5: actionGetStudentInfo

 /**
  * 获取学员详细信息
  */
 public function actionGetStudentInfo()
 {
     if (!isset($_REQUEST['userId']) || !isset($_REQUEST['token']) || !isset($_REQUEST['memberId'])) {
         $this->_return('MSG_ERR_LESS_PARAM');
     }
     $user_id = trim(Yii::app()->request->getParam('userId', null));
     $token = trim(Yii::app()->request->getParam('token', null));
     $memberId = trim(Yii::app()->request->getParam('memberId', null));
     // 用户ID格式错误
     if (!ctype_digit($user_id)) {
         $this->_return('MSG_ERR_FAIL_USER');
     }
     // 用户不存在,返回错误
     if ($user_id < 1) {
         $this->_return('MSG_ERR_NO_USER');
     }
     if (empty($memberId) || $memberId <= 0) {
         $this->_return('MSG_ERR_FAIL_STUDENT');
     }
     // 验证要添加的memberId是否和userId有绑定关系存在
     $existMemberId = User::model()->existUserIdMemberId($user_id, $memberId);
     if (!$existMemberId) {
         $this->_return('MSG_ERR_FAIL_MEMBER');
     }
     // 验证token
     if (Token::model()->verifyToken($user_id, $token)) {
         // 获取学员详细信息
         $data = Student::model()->getStudentInfo($memberId);
         if (!$data) {
             $this->_return('MSG_NO_MEMBER');
         }
         // 增加用户操作log
         $action_id = 2301;
         $params = '';
         foreach ($_REQUEST as $key => $value) {
             $params .= $key . '=' . $value . '&';
         }
         $params = substr($params, 0, -1);
         Log::model()->action_log($user_id, $action_id, $params);
         $this->_return('MSG_SUCCESS', $data);
     } else {
         $this->_return('MSG_ERR_TOKEN');
     }
 }
开发者ID:hucongyang,项目名称:student_cnhutong,代码行数:47,代码来源:StudentController.php

示例6: _return

 public function _return($error_code, $data = NULL)
 {
     require 'ErrorCode.php';
     $this->runtime->stop();
     if (isset($GLOBALS['_SERVER']['REQUEST_URI'])) {
         $temp_arr = explode('?', $GLOBALS['_SERVER']['REQUEST_URI']);
         if (isset($temp_arr[0])) {
             $temp1_arr = explode('index.php', $temp_arr[0]);
             if (isset($temp1_arr[1])) {
                 $action_arr = explode('/', $temp1_arr[1]);
                 $user_id = trim(Yii::app()->request->getParam('user_id'));
                 if (isset($action_arr[1]) && isset($action_arr[2])) {
                     Log::model()->_time_log($action_arr[1], $action_arr[2], $this->runtime->spent(), $user_id);
                 }
             }
         }
     }
     //
     if (!isset($GLOBALS['__APPID']) || $GLOBALS['__APPID'] == '') {
         $GLOBALS['__APPID'] = 10;
     }
     if (!$data) {
         $dstr = json_encode(array('error' => $_error_code[$GLOBALS['__APPID']][$error_code][1], 'success' => $_error_code[$GLOBALS['__APPID']][$error_code][0]));
         exit(str_replace('\\/', '/', $dstr));
         /*	5.3.* 的版本不支持JSON_UNESCAPED_SLASHES参数
         			exit(json_encode(array('error' => $_error_code[$error_code][1],
         							   'success' => $_error_code[$error_code][0]), JSON_UNESCAPED_SLASHES));
         			*/
     } else {
         $dstr = json_encode(array('error' => $_error_code[$GLOBALS['__APPID']][$error_code][1], 'success' => $_error_code[$GLOBALS['__APPID']][$error_code][0], 'result' => $data));
         exit(str_replace('\\/', '/', $dstr));
         /*	5.3.* 的版本不支持JSON_UNESCAPED_SLASHES参数
         			exit(json_encode(array('error' => $_error_code[$error_code][1],
         							   'success' => $_error_code[$error_code][0],
         							   'result' => $data), JSON_UNESCAPED_SLASHES));
         							   */
     }
 }
开发者ID:hucongyang,项目名称:goddess,代码行数:38,代码来源:ApiPublicController.php

示例7: 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 {
             // 增加用户操作log
             $action_id = 2401;
             $params = '';
             foreach ($_REQUEST as $key => $value) {
                 $params .= $key . '=' . $value . '&';
             }
             $params = substr($params, 0, -1);
             Log::model()->action_log(0, $action_id, $params);
             $this->_return('MSG_SUCCESS', $data);
         }
     } else {
         $this->_return('MSG_ERR_FAIL_PLATFORM|APP_ID');
     }
 }
开发者ID:hucongyang,项目名称:student_cnhutong,代码行数:41,代码来源:CommonController.php

示例8: actionGoldUnlockPhoto

 /**
  * 金币解锁照片
  *
  * @param int $user_id
  * @param int $goddess_id
  * @param int $token
  * @param int $image_id
  *
  */
 public function actionGoldUnlockPhoto()
 {
     // 参数检查
     if (!isset($_REQUEST['user_id']) || !isset($_REQUEST['token']) || !isset($_REQUEST['goddess_id']) || !isset($_REQUEST['image_id'])) {
         $this->_return('MSG_ERR_LESS_PARAM');
     }
     $user_id = trim(Yii::app()->request->getParam('user_id'));
     $token = trim(Yii::app()->request->getParam('token'));
     $goddess_id = trim(Yii::app()->request->getParam('goddess_id'));
     $image_id = trim(Yii::app()->request->getParam('image_id'));
     $now = date("Y-m-d H:i:s");
     if (!is_numeric($user_id)) {
         $this->_return('MSG_ERR_FAIL_PARAM');
     }
     //用户不存在 返回错误
     if ($user_id < 1) {
         $this->_return('MSG_ERR_NO_USER');
     }
     if (!Goddess::model()->isExitsGoddess($goddess_id)) {
         //不存在此女神
         $this->_return("MSG_ERR_NO_EXIST_GODDESS");
     }
     //验证token
     if (Token::model()->verifyToken($user_id, $token, $GLOBALS['__APPID'])) {
         //金币解锁照片
         $res = Goddess::model()->GoldUnlockPhoto($user_id, $goddess_id, $image_id);
         switch ($res) {
             case -1:
                 $this->_return('MSG_ERR_NO_FOUND_IMG');
             case -2:
                 $this->_return('MSG_ERR_FAIL_UNLOCKED');
             case -3:
                 $this->_return('MSG_ERR_NO_GOLD');
             default:
                 break;
         }
         $memo = $res['log']['gold'];
         //记录日志 金币解锁照片
         Log::model()->_photo_log($user_id, $goddess_id, $image_id, 'GOLD_UNLOCK_IMG', date('Y-m-d H:i:s'), $memo);
     } else {
         $this->_return('MSG_ERR_TOKEN');
     }
     // 发送返回值
     $this->_return('MSG_SUCCESS', $res['result']);
 }
开发者ID:hucongyang,项目名称:goddess,代码行数:54,代码来源:GoddessController.php

示例9: actionIosVerify

 /**
  * IOS IAP 支付验证
  * $uid
  * $token
  * $item_id
  * $receipt
  */
 public function actionIosVerify()
 {
     // error_log(json_encode($_POST));
     if (!isset($_REQUEST['receipt']) || !isset($_REQUEST['uid']) || !isset($_REQUEST['token']) || !isset($_REQUEST['trade_no'])) {
         $this->_return('MSG_ERR_LESS_PARAM');
     }
     /*沙盒测试开关,正式发布时,需置为false**********************************/
     $isSandbox = true;
     /********************************************************************/
     $receipt = Yii::app()->request->getParam('receipt');
     $uid = trim(Yii::app()->request->getParam('uid'));
     $token = trim(Yii::app()->request->getParam('token'));
     $trade_no = Yii::app()->request->getParam('trade_no');
     $now = date('Y-m-d H:i:s');
     if (!Token::model()->verifyToken($uid, $token, $GLOBALS['__APPID'])) {
         $this->_return('MSG_ERR_TOKEN');
         //#token 错误
     }
     $param = array('uid' => $uid, 'receipt' => $receipt, 'create_ts' => $now, 'trade_no' => $trade_no);
     $trade_info = Pay::model()->getTradeInfo($trade_no);
     if ($trade_info['uid'] != $uid || $trade_info['status'] != 0) {
         Pay::model()->recordIOSIAPInfo($param);
         Log::model()->_pay_log($uid, 'ORDER_IOS_IAP_VERIFY_WRONG', $now, $trade_no, "无效或重复的订单");
         $this->_return('MSG_ISO_PAY_WRONG');
     }
     if ($isSandbox) {
         $endpoint = 'https://sandbox.itunes.apple.com/verifyReceipt';
     } else {
         $endpoint = 'https://buy.itunes.apple.com/verifyReceipt';
     }
     $postData = json_encode(array('receipt-data' => $receipt));
     $ch = curl_init($endpoint);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_POST, true);
     //curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
     //curl_setopt($ch, CURLOPT_TIMEOUT, 30);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
     //这两行一定要加,不加会报SSL 错误
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
     $response = curl_exec($ch);
     $errno = curl_errno($ch);
     $errmsg = curl_error($ch);
     curl_close($ch);
     if ($errno != 0) {
         Log::model()->_pay_log($uid, 'ORDER_IOS_IAP_VERIFY_WRONG', $now, trade_no, $errno . ">" . $errmsg);
         Pay::model()->recordIOSIAPInfo($param);
         $this->_return('MSG_ISO_PAY_WRONG');
     }
     $param['verify_data'] = $response;
     $data = json_decode($response);
     if (!is_object($data)) {
         Log::model()->_pay_log($uid, 'ORDER_IOS_IAP_VERIFY_WRONG', $now, $trade_no, '不能解析返回数据>' . $response);
         Pay::model()->recordIOSIAPInfo($param);
         $this->_return('MSG_ISO_PAY_WRONG');
         //throw new Exception('Invalid response data');
     }
     if (!isset($data->status) || $data->status != 0) {
         Log::model()->_pay_log($uid, 'ORDER_IOS_IAP_VERIFY_FAIL', $now, $trade_no);
         Pay::model()->recordIOSIAPInfo($param);
         $this->_return('MSG_ISO_PAY_FAIL');
     }
     $add_coin = $trade_info['coin'] + $trade_info['free'];
     Pay::model()->iosPaySuccess($uid, $trade_no, $add_coin);
     Pay::model()->recordIOSIAPInfo($param);
     Log::model()->_pay_log($uid, 'ORDER_IOS_IAP_VERIFY_OK', $now, $trade_no);
     $res = array('gold' => $add_coin);
     $this->_return('MSG_SUCCESS', $res);
 }
开发者ID:hucongyang,项目名称:goddess,代码行数:76,代码来源:PayController.php

示例10: actionDelete

 public function actionDelete()
 {
     $id = Yii::app()->request->getParam('id');
     $qr = $this->loadModel($id);
     Log::model()->deleteAll('qr_id = :qr_id', array(':qr_id' => $id));
     $qr->delete();
     Utility::setFlash(Yii::t('dict', 'Deleted successfully.'), 'success');
     $this->redirect(array('list'));
 }
开发者ID:priyranjansingh,项目名称:getleads,代码行数:9,代码来源:QrController.php

示例11: actionInviting

 /**
  * 拒绝/接受 好友邀请
  *
  * @param string $user_id
  * @param string $token
  * @param string $friend_id
  * @param string $status   1-已确认, 2-拒绝, 3-取消
  */
 public function actionInviting()
 {
     // 参数检查
     if (!isset($_REQUEST['user_id']) || !isset($_REQUEST['token']) || !isset($_REQUEST['friend_id']) || !isset($_REQUEST['status'])) {
         $this->_return('MSG_ERR_LESS_PARAM');
     }
     $user_id = trim(Yii::app()->request->getParam('user_id'));
     $token = trim(Yii::app()->request->getParam('token'));
     $status = trim(Yii::app()->request->getParam('status'));
     $friend_id = trim(Yii::app()->request->getParam('friend_id'));
     if ($status != 1 && $status != 2 && $status != 3) {
         $this->_return('MSG_ERR_FAIL_PARAM');
     }
     if (!is_numeric($user_id) || !is_numeric($friend_id)) {
         $this->_return('MSG_ERR_FAIL_PARAM');
     }
     //用户不存在 返回错误
     if ($user_id < 1) {
         $this->_return('MSG_ERR_NO_USER');
     }
     //用户不存在 返回错误
     if ($friend_id < 1) {
         $this->_return('MSG_ERR_NO_USER');
     }
     //验证token
     if (!Token::model()->verifyToken($user_id, $token, $GLOBALS['__APPID'])) {
         $this->_return('MSG_ERR_TOKEN');
     }
     $ids = array();
     $ids = UserFriend::model()->newFriendMess($user_id);
     $friend = array();
     foreach ($ids as $id) {
         $friend[] = $id['friend_user_id'];
     }
     if (!in_array($friend_id, $friend)) {
         $this->_return('MSG_ERR_NO_FRIEND_REQ');
     }
     $friend_transaction = Yii::app()->db_friend->beginTransaction();
     try {
         UserFriend::model()->updateFriend($user_id, $friend_id, $status);
         $friend_transaction->commit();
         //log 日志
         $memo = $user_id . '|' . $friend_id . '|' . $status;
         Log::model()->_user_log($user_id, 'REPLY_INVITATION', date("Y-m-d H:i:s"), $memo);
     } catch (Exception $e) {
         error_log($e);
         $friend_transaction->rollback();
         $this->_return('MSG_ERR_UNKOWN');
     }
     $this->_return('MSG_SUCCESS');
 }
开发者ID:hucongyang,项目名称:goddess,代码行数:59,代码来源:FriendController.php

示例12: actionLessonStudentLeave

 /**
  *  用户提交课时请假信息
  */
 public function actionLessonStudentLeave()
 {
     if (!isset($_REQUEST['userId']) || !isset($_REQUEST['token']) || !isset($_REQUEST['lessonStudentId']) || !isset($_REQUEST['memberId']) || !isset($_REQUEST['dateTime']) || !isset($_REQUEST['reason']) || !isset($_REQUEST['courseId'])) {
         $this->_return('MSG_ERR_LESS_PARAM');
     }
     $user_id = trim(Yii::app()->request->getParam('userId', null));
     $token = trim(Yii::app()->request->getParam('token', null));
     $lessonStudentId = trim(Yii::app()->request->getParam('lessonStudentId', null));
     $memberId = trim(Yii::app()->request->getParam('memberId', null));
     $dateTime = trim(Yii::app()->request->getParam('dateTime', null));
     $reason = trim(Yii::app()->request->getParam('reason', null));
     $courseId = trim(Yii::app()->request->getParam('courseId', null));
     // 用户名不存在,返回错误
     if (!ctype_digit($user_id) || $user_id < 1) {
         $this->_return('MSG_ERR_NO_USER');
     }
     if (empty($lessonStudentId) || $lessonStudentId < 1) {
         $this->_return('MSG_ERR_FAIL_LESSON_STUDENT_ID');
     }
     // 规范提前请假时间
     $leaveTime = Lesson::model()->isLessonLeaveTime($lessonStudentId);
     if ($leaveTime < 1) {
         $this->_return('MSG_ERR_FAIL_LEAVE_TIME');
     }
     if (Lesson::model()->isExistLessonStudentId($lessonStudentId)) {
         $this->_return('MSG_EXIST_LESSON_STUDENT_ID');
     }
     if (!ctype_digit($memberId) || $memberId < 1) {
         $this->_return('MSG_NO_MEMBER');
     }
     if (!ctype_digit($courseId) || $courseId < 1) {
         $this->_return('MSG_NO_MEMBER');
     }
     // 验证日期格式合法
     if (!$this->isDate($dateTime)) {
         $this->_return('MSG_ERR_FAIL_DATE_FORMAT');
     }
     // 验证token
     if (Token::model()->verifyToken($user_id, $token)) {
         // 提交课时请假信息
         $lesson = Lesson::model()->lessonStudentLeave($memberId, $courseId, $lessonStudentId, $dateTime, $reason);
         // 增加用户操作log
         $action_id = 2202;
         $params = '';
         foreach ($_REQUEST as $key => $value) {
             $params .= $key . '=' . $value . '&';
         }
         $params = substr($params, 0, -1);
         Log::model()->action_log($user_id, $action_id, $params);
         //            if ($lesson) {
         //                $this->_return('MSG_SUCCESS');
         //            } else {
         //                $this->_return('MSG_ERR_UNKOWN');
         //            }
         $this->_return('MSG_SUCCESS');
     } else {
         $this->_return('MSG_ERR_TOKEN');
     }
 }
开发者ID:hucongyang,项目名称:student_cnhutong,代码行数:62,代码来源:LessonController.php

示例13: model

	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Syslog the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
开发者ID:proditis,项目名称:echofish,代码行数:9,代码来源:Archive.php

示例14: actionSoftwareToGold

 public function actionSoftwareToGold()
 {
     // 参数检查
     if (!isset($_REQUEST['user_id']) || !isset($_REQUEST['token']) || !isset($_REQUEST['software_id'])) {
         $this->_return('MSG_ERR_LESS_PARAM');
     }
     $user_id = trim(Yii::app()->request->getParam('user_id'));
     $token = trim(Yii::app()->request->getParam('token'));
     $software_id = trim(Yii::app()->request->getParam('software_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'])) {
         //
         $res = User::model()->software_to_gold($user_id, $software_id);
         switch ($res) {
             //系统繁忙,请稍后再试
             case -1:
                 $this->_return('MSG_ERR_UNKOWN');
                 //软件金币已经领取,不能重复领取
             //软件金币已经领取,不能重复领取
             case -2:
                 $this->_return('MSG_ERR_SOFTWARE_TO_GOLD');
             case -3:
                 $this->_return('MSG_ERR_FAIL_SEARCH');
             default:
                 break;
         }
         $memo = '';
         //软件兑换金币
         Log::model()->_gold_log($user_id, $res['log']['gold'], $res['log']['gold_after'], 'GOLD_SOFTWARE_TO_GOLD', date('Y-m-d H:i:s'), $memo);
     }
     // 发送返回值
     $this->_return('MSG_SUCCESS', $res['result']);
 }
开发者ID:hucongyang,项目名称:goddess,代码行数:40,代码来源:UserController.php

示例15: actionOnOff

 public function actionOnOff()
 {
     // 参数检查
     if (!isset($_REQUEST['user_id']) || !isset($_REQUEST['token']) || !isset($_REQUEST['open'])) {
         $this->_return('MSG_ERR_LESS_PARAM');
     }
     $user_id = trim(Yii::app()->request->getParam('user_id'));
     $token = trim(Yii::app()->request->getParam('token'));
     $status = trim(Yii::app()->request->getParam('open'));
     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'])) {
         $param['push_enabled'] = $status;
         // 如果由更新参数 那么更新
         if (!empty($param)) {
             try {
                 Characters::model()->updateCharacters($user_id, $param);
                 // 更新角色信息表  日志 防打扰
                 Log::model()->_goddess_log($user_id, '', 'DO_NOT_DISTURB', date("Y-m-d H:i:s"), '');
                 // 发送返回值
                 $this->_return('MSG_SUCCESS');
             } catch (Exception $e) {
                 error_log($e);
                 $this->_return('MSG_ERR_UNKOWN');
             }
         }
     } else {
         $this->_return('MSG_ERR_TOKEN');
     }
 }
开发者ID:hucongyang,项目名称:goddess,代码行数:36,代码来源:CommonController.php


注:本文中的Log::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。