示例#1
0
 /**
  * 处理登录操作
  *
  * @return Response
  * @author yangyifan <*****@*****.**>
  */
 public function postLogin(UserLoginRequest $request)
 {
     $login_status = UserModel::login($request->only('email', 'password', 'readme'));
     switch ($login_status) {
         case 1:
             return $this->response(200, trans('response.success'), [], true, action('Home\\IndexController@getIndex'));
         case -1:
         case -3:
             return $this->response(401, trans('response.admin_not_exists'));
         case -2:
             return $this->response(401, trans('response.admin_disable'));
     }
     //登陆失败
     return $this->response(401, trans('response.unauthorized'));
 }
 /**
  * 处理登录操作
  *
  * @return Response
  * @author yangyifan <*****@*****.**>
  */
 public function postLogin(UserLoginRequest $request)
 {
     $login_status = UserModel::login($request->only('email', 'password', 'readme'));
     switch ($login_status) {
         case 1:
             $url = !empty(Session::get('HTTP_REFERER')) && $_SERVER['HTTP_REFERER'] != action('Home\\UserController@getLogin') ? Session::get('HTTP_REFERER') : action('User\\IndexController@getIndex');
             return $this->response(200, trans('response.success'), [], true, $url);
         case -1:
         case -3:
             return $this->response(401, trans('response.admin_not_exists'));
         case -2:
             return $this->response(401, trans('response.admin_disable'));
     }
     //登陆失败
     return $this->response(401, trans('response.unauthorized'));
 }