pc端回调
This commit is contained in:
@@ -32,7 +32,7 @@ class AuthController extends BaseController
|
||||
public function feishuScope(Request $request)
|
||||
{
|
||||
try {
|
||||
$result = (new AuthService())->feishuAuthorize($request->get('app_id'), $request->system_code, $request->is_mob);
|
||||
$result = (new AuthService())->feishuAuthorize($request->get('app_id'), $request->system_code, $request->get('is_pc','0'));
|
||||
return $this->success($result);
|
||||
} catch (\Throwable $e) {
|
||||
return $this->error($e->getMessage().$e->getLine().$e->getFile());
|
||||
|
||||
@@ -314,10 +314,12 @@ class AuthLogic
|
||||
public function feishuAppInfo(string $app_id, string $systemCode='')
|
||||
{
|
||||
$fsAppInfo = CorpFeishuApp::where('app_id', $app_id)->first();
|
||||
|
||||
return [
|
||||
'app_id' => $fsAppInfo->app_id,
|
||||
'app_secret' => $fsAppInfo->app_secret,
|
||||
'r_url' => $fsAppInfo->r_url,
|
||||
'm_url' => $fsAppInfo->m_url,
|
||||
'scope' => $fsAppInfo->scopes,
|
||||
'state' => $fsAppInfo->state,
|
||||
];
|
||||
|
||||
@@ -13,12 +13,12 @@ class AuthService
|
||||
/**
|
||||
* 飞书授权
|
||||
*/
|
||||
public function feishuAuthorize(string $app_id, string $systemCcode, $mobile)
|
||||
public function feishuAuthorize(string $app_id, string $systemCcode, $is_pc)
|
||||
{
|
||||
$logic = new AuthLogic();
|
||||
$certificate = $logic->feishuAppInfo($app_id, $systemCcode);
|
||||
$feishu = new Feishu($certificate['app_id'], $certificate['app_secret'], 'xinyouhe');
|
||||
return ['auth_url' => $feishu->authorize($certificate, $mobile)];
|
||||
return ['auth_url' => $feishu->authorize($certificate, $is_pc)];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -92,11 +92,12 @@ class Feishu
|
||||
/**
|
||||
* 授权
|
||||
*/
|
||||
public function authorize($certificate,$mobile, $url = 'authen/v1/authorize')
|
||||
public function authorize($certificate,$is_pc, $url = 'authen/v1/authorize')
|
||||
{
|
||||
$redirect_uri = $is_pc==1?$certificate['r_url']:$certificate['m_url'];
|
||||
$arr = [
|
||||
'app_id' => $certificate['app_id'],
|
||||
'redirect_uri' => $certificate['r_url'],
|
||||
'redirect_uri' => $redirect_uri,
|
||||
'scope' => $certificate['scope'],
|
||||
'state' => $certificate['state']
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user