// +---------------------------------------------------------------------- namespace app\controller\admin\auth; use app\controller\Base; use app\services\auth\AuthService; use app\services\SocialiteService; class Index extends Base{ public function login(AuthService $service){ try { $data = $service->login($this->request); $this->data['data'] = $data; } catch (\think\Exception $e) { $this->data['code'] = 0; $this->data['message'] = $e->getMessage(); } return $this->data; } /** * @title 第三方账号登录 */ public function socialite(){ //实例化第三方登录服务 $service = new SocialiteService(); return $service->login(); } }