$email])) { throw new Exception(lang('Account does not exist')); } if ($user->password != md5($password)) { throw new Exception(lang('Account password error')); } if ('true' == $refresh) { $token = make_token(); $user->token = $token; if (!$user->save()) { throw new Exception(lang('Token refresh failed')); } } } catch (Exception $e) { $this->response($e->getMessage(), null, 500); } $this->response('success', ['token' => $user->token]); } }