Example #1
0
 public function beforeAction($action)
 {
     $_token = \yii::$app->request->post_get('token');
     //判断token是否合法
     $user_id = TokenService::getService()->getIdByToken($_token);
     if (is_int($user_id) && $user_id < 0) {
         exit(\common\helpers\JsonHelper::returnError($user_id));
     }
     $_POST['data']['user_id'] = $user_id;
     return true;
 }