accountService = $accountService; } public function index(Request $request) { // 入口页面禁止缓存,保证每次更新后普通刷新即可加载最新版本 return response() ->view('index') ->header('Cache-Control', 'no-store, no-cache, must-revalidate') ->header('Pragma', 'no-cache') ->header('Expires', '0') ->header('X-Accel-Expires', '0'); } /** * 动漫音频管理平台入口 * * @param Request $request * @return \Illuminate\Contracts\View\View */ public function animeIndex(Request $request) { // 入口页面禁止缓存,保证每次更新后普通刷新即可加载最新版本 return response() ->view('animeIndex') ->header('Cache-Control', 'no-store, no-cache, must-revalidate') ->header('Pragma', 'no-cache') ->header('Expires', '0') ->header('X-Accel-Expires', '0'); } /** * 登录 * * @param Request $request * @return mixed * @throws ApiException */ public function login(Request $request) { $all = $request->all(); $account = trim(getProp($all, 'account')); $passwd = trim(getProp($all, 'passwd')); if (strlen($account) < 1 || strlen($passwd) < 1) { Utils::throwError(ErrorConst::PARAM_ERROR_CODE); } // 登录 $user = $this->accountService->login($account, $passwd); return $this->success($user); } /** * 退出登录 * * @return mixed */ public function logout() { // 当前登录用户 $token = Site::getToken(); // 退出 $result = $this->accountService->logout($token); return $this->success(['success' => $result ? 1 : 0]); } public function userInfo() { // 登录 $user = $this->accountService->userInfo(); return $this->success($user); } }