public function login() { $account = $this->request->post('account'); $password = $this->request->post('password'); if (!$account || !$password) { $this->error('参数不能为空'); } $user = \app\common\model\User::where('username|email|mobile', $account)->find(); if (!$user || $user->password !== \app\api\library\Auth::instance()->getEncryptPassword($password, $user->salt)) { $this->error('账号或密码错误'); } \app\api\library\Auth::instance()->direct($user->id); $this->success('登录成功', ['userinfo' => \app\api\library\Auth::instance()->getUserinfo()]); }