find(); if(!$user){ throw new \Exception('账号或密码错误'); } if($user->password!=md5(md5($password.$user->salt))){ throw new \Exception('账号或密码错误'); } if($user->status!='normal'){ throw new \Exception('账号已经被禁用'); } if($terminal==1 && strpos($user->role, "3") === false){ throw new \Exception('账号已经被禁用'); } //刷新token $token = MysqlAdapter::login($token, $user); $user->loginfailure = 0; $user->logintime = time(); $user->loginip = request()->ip(); $user->save(); Cache::store('redis')->set('user_info_'.$user->id, $user->toArray(), Config::get('app.user_login.keepalive_time')); return ['userinfo'=>$user,'token'=>$token, 'page' => 'worker']; } public function updateToken(int $uid, array $arr) { return UserToken::where('user_id', $uid)->update($arr); } }