userinfo; return $this->success('ok', $user); } public function login(ApiAuthService $authService) { $data = $this->request->post(); try{ validate(UserValidate::class)->scene('login')->check($data); $user = $authService->login($data['username'],$data['password']); }catch (ValidateException $e) { return $this->error($e->getError()); }catch (\Exception $e){ return $this->error($e->getMessage()); } return $this->success('ok', $user); } }