38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
|
// +----------------------------------------------------------------------
|
|
namespace app\controller\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();
|
|
}
|
|
}
|