$email])) { throw new Exception('账号不存在'); } if ($user->password != md5($password)) { throw new Exception('账号密码错误'); } if ('true' == $refresh) { $token = make_token(); $user->token = $token; if (!$user->save()) { throw new Exception('Token 刷新失败'); } } } catch (Exception $e) { $this->response($e->getMessage(), null, 500); } $this->response('success', ['token' => $user->token]); } }