This commit is contained in:
2025-03-22 18:30:38 +08:00
parent e58ed1ee14
commit 504bf7885c
8 changed files with 24 additions and 17 deletions
+11 -9
View File
@@ -25,9 +25,14 @@ class FeishuController
*/ */
public function getinfo(Request $request) public function getinfo(Request $request)
{ {
$config = Util::getParam($request, '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)){ if(Util::isEmpty($config)){
$config = $this->config; return Util::fail(null,trans('sign_not_null'));
} }
// 获取凭证 // 获取凭证
@@ -48,13 +53,10 @@ class FeishuController
public function getSign(Request $request) public function getSign(Request $request)
{ {
// 获取凭证 $res = [['xinyouhe'=>'新友合'],['mbaf'=>'MAGIC BRIDGE AUTO FZE']];
$certificate = config('feishu'); // foreach ($certificate as $k => $v) {
// $res []=['id'=>$k,'name'=>$k];
$res = []; // }
foreach ($certificate as $k => $v) {
$res []=['id'=>$k,'name'=>$k];
}
return Util::success($res,trans('success')); return Util::success($res,trans('success'));
} }
+1 -1
View File
@@ -62,7 +62,7 @@ class UserController
$result['token'] = $token; $result['token'] = $token;
$result['feishu_openid'] = FeishuUser::where('user_id', $userId)->value('open_id'); $result['feishu_openid'] = FeishuUser::where('user_id', $userId)->value('open_id');
if (Util::isEmpty($language)) { if (!Util::isEmpty($language)) {
User::where('id', $userId) User::where('id', $userId)
->update(['language' => $language]); ->update(['language' => $language]);
locale($language); locale($language);
+5 -2
View File
@@ -1,6 +1,6 @@
<?php <?php
namespace process; namespace app\process;
use app\controller\FeishuController; use app\controller\FeishuController;
use app\model\Customer; use app\model\Customer;
@@ -11,10 +11,11 @@ use Workerman\Crontab\Crontab;
class Task class Task
{ {
public function onWorkerStart() public function onWorkerStart()
{ {
// 每半小时执行一次 // 每半小时执行一次
new Crontab('30/* * * * *', function () { new Crontab('1/* * * * * *', function () {
echo date('Y-m-d H:i:s') . "\n"; echo date('Y-m-d H:i:s') . "\n";
$customer = Customer::where(['follow_next', '<=', time() + 3600]) $customer = Customer::where(['follow_next', '<=', time() + 3600])
->where(['follow_next', '>', time()]) ->where(['follow_next', '>', time()])
@@ -31,6 +32,8 @@ class Task
$host = $parsedUrl['host']; $host = $parsedUrl['host'];
$port = isset($parsedUrl['port']) ? ':' . $parsedUrl['port'] : ''; $port = isset($parsedUrl['port']) ? ':' . $parsedUrl['port'] : '';
$url = $host .$port. '/pages/customer/detile?id='.$customer->id; $url = $host .$port. '/pages/customer/detile?id='.$customer->id;
$item->warn = 1;
$item->update();
FeishuController::class->send($feishuUser->open_id, '跟进提醒', '您有新的跟进提醒', $url); FeishuController::class->send($feishuUser->open_id, '跟进提醒', '您有新的跟进提醒', $url);
} }
} }
+1 -1
View File
@@ -192,7 +192,7 @@ class FeishuService
"client_id" => $this->appId, "client_id" => $this->appId,
"client_secret" => $this->appSecret, "client_secret" => $this->appSecret,
"code" => $code, "code" => $code,
"redirect_uri" => 'http://219.157.255.213:8085/pages/index/webview' "redirect_uri" => $redirect_uri
]; ];
return $this->requestResult('authen/v2/oauth/token'); return $this->requestResult('authen/v2/oauth/token');
} }
+2 -2
View File
@@ -4,7 +4,7 @@ return [
'xinyouhe' => [ 'xinyouhe' => [
'appId' => "cli_a73e1e6406fa501c", 'appId' => "cli_a73e1e6406fa501c",
'appSecret' => "9cMfxujjGG9JPmNfNcOwUdCoIXqaM1wY", '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", 'scope' => "contact:user.base:readonly contact:contact.base:readonly contact:user.employee_id:readonly im:message:send_as_bot",
'state' => "xinyouhe", 'state' => "xinyouhe",
'baseUri' => "https://open.feishu.cn/open-apis/" 'baseUri' => "https://open.feishu.cn/open-apis/"
@@ -12,7 +12,7 @@ return [
'mbaf' => [ 'mbaf' => [
'appId' => "cli_a75839fb4ff85028", 'appId' => "cli_a75839fb4ff85028",
'appSecret' => "VsqLvwsRzpmisBVbrTIuKdNCvRCO447d", '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", 'scope' => "contact:user.base:readonly contact:contact.base:readonly contact:user.employee_id:readonly im:message:send_as_bot",
'state' => "mbaf", 'state' => "mbaf",
'baseUri' => "https://open.larksuite.com/open-apis/" 'baseUri' => "https://open.larksuite.com/open-apis/"
+1 -1
View File
@@ -60,6 +60,6 @@ return [
] ]
], ],
'task' => [ 'task' => [
'handler' => process\Task::class 'handler' => app\process\Task::class
], ],
]; ];
+1
View File
@@ -23,4 +23,5 @@ return [
'car_type_not_null' => ' preference_not_null', 'car_type_not_null' => ' preference_not_null',
'channel_not_null' => ' channel not null', 'channel_not_null' => ' channel not null',
'email_consistent' => ' Inconsistent email addresses', 'email_consistent' => ' Inconsistent email addresses',
'sign_not_null' => ' No affiliated company has been set',
]; ];
+1
View File
@@ -23,4 +23,5 @@ return [
'car_type_not_null' => ' 偏好不能为空', 'car_type_not_null' => ' 偏好不能为空',
'channel_not_null' => ' 渠道不能为空', 'channel_not_null' => ' 渠道不能为空',
'email_consistent' => ' 邮箱不一致', 'email_consistent' => ' 邮箱不一致',
'sign_not_null' => ' 未设置所属公司',
]; ];