This commit is contained in:
候学杰 2019-02-18 14:21:36 +08:00
parent 4b9b69b9b0
commit b4b7643789
2 changed files with 19 additions and 6 deletions

View File

@ -97,11 +97,6 @@ class Auth
$this->id = $this->config['apps']['op']['id']; $this->id = $this->config['apps']['op']['id'];
$this->secret = $this->config['apps']['op']['secret']; $this->secret = $this->config['apps']['op']['secret'];
break; break;
case 'payment':
case 'paymeny_api':
$this->id = $this->config['apps']['payment']['id'];
$this->secret = $this->config['apps']['payment']['secret'];
break;
} }
return $this; return $this;
} }
@ -141,6 +136,16 @@ class Auth
return $info; return $info;
} }
/**
* 退出登录
* @param $token
* @return array
* @throws \JsonRpc\Exception\RpcServerException
*/
public function logout($token){
return $info = $this->rpc->call('oauth.logout', [$this->id, $this->secret, $token]);
}
/** /**
* 获取用户组 * 获取用户组
* @param null $token * @param null $token

View File

@ -70,7 +70,15 @@ class PdAuthServiceProvider extends ServiceProvider
}); });
$this->app['router']->get('api/auth/logout', function (Request $request) { $this->app['router']->get('api/auth/logout', function (Request $request) {
app('pd.auth')->logout(); $token = $request->header('Authorization', $request->cookie(Authenticate::CookieName));
$cookie = new Cookie(Authenticate::CookieName, '', time());
app('pd.auth')->logout($token);
return response()->json([
'code' => 0,
'message' => '',
'data' => [],
])->withCookie($cookie);
}); });
} }