diff --git a/app/common/controller/AuthController.php b/app/common/controller/AuthController.php index 93c39fb..ba87140 100644 --- a/app/common/controller/AuthController.php +++ b/app/common/controller/AuthController.php @@ -31,7 +31,7 @@ class AuthController extends BaseController public function feishuScope(Request $request) { try { - $result = (new AuthService())->feishuAuthorize($request->corp_abbr, $request->system_code); + $result = (new AuthService())->feishuAuthorize($request->corp_abbr, $request->system_code, $request->is_mob); return $this->success($result); } catch (\Throwable $e) { return $this->error($e->getMessage()); diff --git a/app/common/model/CorpFeishuApp.php b/app/common/model/CorpFeishuApp.php index 8019a0b..53dcecf 100644 --- a/app/common/model/CorpFeishuApp.php +++ b/app/common/model/CorpFeishuApp.php @@ -40,7 +40,7 @@ class CorpFeishuApp extends Model /** * 允许自动填充模型字段 */ - protected $fillable = ['id', 'corp_id', 'system_id', 'name', 'tenant_key', 'app_id', 'app_secret', 'base_uri', 'r_url', 'scopes', 'state', 'sort', 'status', 'created_at', 'updated_at']; + protected $fillable = ['id', 'corp_id', 'system_id', 'name', 'tenant_key', 'app_id', 'app_secret', 'base_uri', 'm_url', 'r_url', 'scopes', 'state', 'sort', 'status', 'created_at', 'updated_at']; /** * 不允许自动填充模型字段 diff --git a/app/common/service/AuthService.php b/app/common/service/AuthService.php index 149e966..a675025 100644 --- a/app/common/service/AuthService.php +++ b/app/common/service/AuthService.php @@ -13,12 +13,12 @@ class AuthService /** * 飞书授权 */ - public function feishuAuthorize(string $corpAbbr, string $systemCcode) + public function feishuAuthorize(string $corpAbbr, string $systemCcode, $mobile) { $logic = new AuthLogic(); $certificate = $logic->feishuAppInfo($corpAbbr, $systemCcode); $feishu = new Feishu($certificate['app_id'], $certificate['app_secret'], $certificate['abbr']); - return ['auth_url' => $feishu->authorize($certificate)]; + return ['auth_url' => $feishu->authorize($certificate, $mobile)]; } /** diff --git a/app/common/utils/Feishu.php b/app/common/utils/Feishu.php index 8428f1c..e10672c 100644 --- a/app/common/utils/Feishu.php +++ b/app/common/utils/Feishu.php @@ -91,11 +91,11 @@ class Feishu /** * 授权 */ - public function authorize($certificate, $url = 'authen/v1/authorize') + public function authorize($certificate,$mobile, $url = 'authen/v1/authorize') { $arr = [ 'app_id' => $certificate['app_id'], - 'redirect_uri' => $certificate['r_url'], + 'redirect_uri' => $mobile == 1 ? $certificate['m_url'] : $certificate['r_url'], 'scope' => $certificate['scope'], 'state' => $certificate['state'] ];