Merge branch 'pc' into dev
This commit is contained in:
@@ -32,7 +32,7 @@ class AuthController extends BaseController
|
|||||||
public function feishuScope(Request $request)
|
public function feishuScope(Request $request)
|
||||||
{
|
{
|
||||||
try {
|
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);
|
return $this->success($result);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return $this->error($e->getMessage().$e->getLine().$e->getFile());
|
return $this->error($e->getMessage().$e->getLine().$e->getFile());
|
||||||
|
|||||||
@@ -314,10 +314,12 @@ class AuthLogic
|
|||||||
public function feishuAppInfo(string $app_id, string $systemCode='')
|
public function feishuAppInfo(string $app_id, string $systemCode='')
|
||||||
{
|
{
|
||||||
$fsAppInfo = CorpFeishuApp::where('app_id', $app_id)->first();
|
$fsAppInfo = CorpFeishuApp::where('app_id', $app_id)->first();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'app_id' => $fsAppInfo->app_id,
|
'app_id' => $fsAppInfo->app_id,
|
||||||
'app_secret' => $fsAppInfo->app_secret,
|
'app_secret' => $fsAppInfo->app_secret,
|
||||||
'r_url' => $fsAppInfo->r_url,
|
'r_url' => $fsAppInfo->r_url,
|
||||||
|
'm_url' => $fsAppInfo->m_url,
|
||||||
'scope' => $fsAppInfo->scopes,
|
'scope' => $fsAppInfo->scopes,
|
||||||
'state' => $fsAppInfo->state,
|
'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();
|
$logic = new AuthLogic();
|
||||||
$certificate = $logic->feishuAppInfo($app_id, $systemCcode);
|
$certificate = $logic->feishuAppInfo($app_id, $systemCcode);
|
||||||
$feishu = new Feishu($certificate['app_id'], $certificate['app_secret'], 'xinyouhe');
|
$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 = [
|
$arr = [
|
||||||
'app_id' => $certificate['app_id'],
|
'app_id' => $certificate['app_id'],
|
||||||
'redirect_uri' => $certificate['r_url'],
|
'redirect_uri' => $redirect_uri,
|
||||||
'scope' => $certificate['scope'],
|
'scope' => $certificate['scope'],
|
||||||
'state' => $certificate['state']
|
'state' => $certificate['state']
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user