From ca757e67ddb42aea2cf4d5db6f395bb5a75a0b49 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Sun, 4 Jan 2026 16:27:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/controller/AuthController.php | 2 +- app/common/model/CorpFeishuApp.php | 2 +- app/common/service/AuthService.php | 4 ++-- app/common/utils/Feishu.php | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) 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'] ];