From 504bf7885c74dffc02ac3cc2a6be9e863256e1d1 Mon Sep 17 00:00:00 2001 From: "HESU\\HESU" <1696136552@qq.com> Date: Sat, 22 Mar 2025 18:30:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/FeishuController.php | 22 ++++++++++++---------- app/controller/UserController.php | 2 +- app/process/Task.php | 7 +++++-- app/service/FeishuService.php | 2 +- config/feishu.php | 4 ++-- config/process.php | 2 +- resource/translations/en/messages.php | 1 + resource/translations/zh_CN/messages.php | 1 + 8 files changed, 24 insertions(+), 17 deletions(-) diff --git a/app/controller/FeishuController.php b/app/controller/FeishuController.php index 5ded1ef..ecc0c57 100644 --- a/app/controller/FeishuController.php +++ b/app/controller/FeishuController.php @@ -25,9 +25,14 @@ class FeishuController */ public function getinfo(Request $request) { - $config = Util::getParam($request, 'config'); - if (Util::isEmpty($config)) { - $config = $this->config; +// $config = Util::getParam($request, 'config'); +// if (Util::isEmpty($config)) { +// $config = $this->config; +// } + $userId = $request->user['id']; + $config = User::where('id',$userId)->value('sign'); + if(Util::isEmpty($config)){ + return Util::fail(null,trans('sign_not_null')); } // 获取凭证 @@ -48,13 +53,10 @@ class FeishuController public function getSign(Request $request) { - // 获取凭证 - $certificate = config('feishu'); - - $res = []; - foreach ($certificate as $k => $v) { - $res []=['id'=>$k,'name'=>$k]; - } + $res = [['xinyouhe'=>'新友合'],['mbaf'=>'MAGIC BRIDGE AUTO FZE']]; +// foreach ($certificate as $k => $v) { +// $res []=['id'=>$k,'name'=>$k]; +// } return Util::success($res,trans('success')); } diff --git a/app/controller/UserController.php b/app/controller/UserController.php index 0e16d1b..2054ca0 100644 --- a/app/controller/UserController.php +++ b/app/controller/UserController.php @@ -62,7 +62,7 @@ class UserController $result['token'] = $token; $result['feishu_openid'] = FeishuUser::where('user_id', $userId)->value('open_id'); - if (Util::isEmpty($language)) { + if (!Util::isEmpty($language)) { User::where('id', $userId) ->update(['language' => $language]); locale($language); diff --git a/app/process/Task.php b/app/process/Task.php index 1f8aa04..6ee46c1 100644 --- a/app/process/Task.php +++ b/app/process/Task.php @@ -1,6 +1,6 @@ where(['follow_next', '>', time()]) @@ -31,6 +32,8 @@ class Task $host = $parsedUrl['host']; $port = isset($parsedUrl['port']) ? ':' . $parsedUrl['port'] : ''; $url = $host .$port. '/pages/customer/detile?id='.$customer->id; + $item->warn = 1; + $item->update(); FeishuController::class->send($feishuUser->open_id, '跟进提醒', '您有新的跟进提醒', $url); } } diff --git a/app/service/FeishuService.php b/app/service/FeishuService.php index 8638d30..65b2f33 100644 --- a/app/service/FeishuService.php +++ b/app/service/FeishuService.php @@ -192,7 +192,7 @@ class FeishuService "client_id" => $this->appId, "client_secret" => $this->appSecret, "code" => $code, - "redirect_uri" => 'http://219.157.255.213:8085/pages/index/webview' + "redirect_uri" => $redirect_uri ]; return $this->requestResult('authen/v2/oauth/token'); } diff --git a/config/feishu.php b/config/feishu.php index 4b30c07..e99c5ae 100644 --- a/config/feishu.php +++ b/config/feishu.php @@ -4,7 +4,7 @@ return [ 'xinyouhe' => [ 'appId' => "cli_a73e1e6406fa501c", 'appSecret' => "9cMfxujjGG9JPmNfNcOwUdCoIXqaM1wY", - 'rUrl' => "http://219.157.255.213:25321/feishu/auth", + 'rUrl' => "http://219.157.255.213:8085/pages/index/webview", 'scope' => "contact:user.base:readonly contact:contact.base:readonly contact:user.employee_id:readonly im:message:send_as_bot", 'state' => "xinyouhe", 'baseUri' => "https://open.feishu.cn/open-apis/" @@ -12,7 +12,7 @@ return [ 'mbaf' => [ 'appId' => "cli_a75839fb4ff85028", 'appSecret' => "VsqLvwsRzpmisBVbrTIuKdNCvRCO447d", - 'rUrl' => "http://219.157.255.213:25321/feishu/auth", + 'rUrl' => "http://219.157.255.213:8085/pages/index/webview", 'scope' => "contact:user.base:readonly contact:contact.base:readonly contact:user.employee_id:readonly im:message:send_as_bot", 'state' => "mbaf", 'baseUri' => "https://open.larksuite.com/open-apis/" diff --git a/config/process.php b/config/process.php index 691ca88..fe56911 100644 --- a/config/process.php +++ b/config/process.php @@ -60,6 +60,6 @@ return [ ] ], 'task' => [ - 'handler' => process\Task::class + 'handler' => app\process\Task::class ], ]; diff --git a/resource/translations/en/messages.php b/resource/translations/en/messages.php index a618b4d..e58e791 100644 --- a/resource/translations/en/messages.php +++ b/resource/translations/en/messages.php @@ -23,4 +23,5 @@ return [ 'car_type_not_null' => ' preference_not_null', 'channel_not_null' => ' channel not null', 'email_consistent' => ' Inconsistent email addresses', + 'sign_not_null' => ' No affiliated company has been set', ]; \ No newline at end of file diff --git a/resource/translations/zh_CN/messages.php b/resource/translations/zh_CN/messages.php index 12f04cf..04b6f8d 100644 --- a/resource/translations/zh_CN/messages.php +++ b/resource/translations/zh_CN/messages.php @@ -23,4 +23,5 @@ return [ 'car_type_not_null' => ' 偏好不能为空', 'channel_not_null' => ' 渠道不能为空', 'email_consistent' => ' 邮箱不一致', + 'sign_not_null' => ' 未设置所属公司', ]; \ No newline at end of file