修改部分问题
This commit is contained in:
@@ -34,7 +34,7 @@ class FeishuController
|
||||
if(Util::isEmpty($config)){
|
||||
return Util::fail(null,trans('sign_not_null'));
|
||||
}
|
||||
|
||||
|
||||
// 获取凭证
|
||||
$certificate = config('feishu.'.$config);
|
||||
$arr = [
|
||||
@@ -100,50 +100,27 @@ class FeishuController
|
||||
$state = explode("_", $param['state']);
|
||||
//$userId = $request->user['id'];
|
||||
$userId = $state[1];
|
||||
$user = FeishuUser::where('id', $userId)->first();
|
||||
$user = FeishuUser::create();
|
||||
// $user = FeishuUser::where('id', $userId)->first();
|
||||
// $user = FeishuUser::create();
|
||||
|
||||
//保存用户open_id
|
||||
$user->user_id = $userId;
|
||||
$user->sign = $state[0];
|
||||
$user->tenant_key = $rst['data']['tenant_key'];
|
||||
$user->open_id = $rst['data']['open_id'];
|
||||
$user->feishu_user_id = $rst['data']['user_id'];
|
||||
$user->union_id = $rst['data']['union_id'];
|
||||
$user->save();
|
||||
// //保存用户open_id
|
||||
// $user->user_id = $userId;
|
||||
// $user->sign = $state[0];
|
||||
// $user->tenant_key = $rst['data']['tenant_key'];
|
||||
// $user->open_id = $rst['data']['open_id'];
|
||||
// $user->feishu_user_id = $rst['data']['user_id'];
|
||||
// $user->union_id = $rst['data']['union_id'];
|
||||
// $user->save();
|
||||
|
||||
// var_dump($rst);
|
||||
// array(3) {
|
||||
// ["code"]=>
|
||||
// int(0)
|
||||
// ["data"]=>
|
||||
// array(11) {
|
||||
// ["avatar_big"]=>
|
||||
// string(168) "https://s1-imfile.feishucdn.com/static-resource/v1/v3_00ie_7cc82f38-0a89-43d4-8b2c-d90fc9d9176g~?image_size=640x640&cut_type=&quality=&format=image&sticker_format=.webp"
|
||||
// ["avatar_middle"]=>
|
||||
// string(168) "https://s1-imfile.feishucdn.com/static-resource/v1/v3_00ie_7cc82f38-0a89-43d4-8b2c-d90fc9d9176g~?image_size=240x240&cut_type=&quality=&format=image&sticker_format=.webp"
|
||||
// ["avatar_thumb"]=>
|
||||
// string(166) "https://s1-imfile.feishucdn.com/static-resource/v1/v3_00ie_7cc82f38-0a89-43d4-8b2c-d90fc9d9176g~?image_size=72x72&cut_type=&quality=&format=image&sticker_format=.webp"
|
||||
// ["avatar_url"]=>
|
||||
// string(166) "https://s1-imfile.feishucdn.com/static-resource/v1/v3_00ie_7cc82f38-0a89-43d4-8b2c-d90fc9d9176g~?image_size=72x72&cut_type=&quality=&format=image&sticker_format=.webp"
|
||||
// ["en_name"]=>
|
||||
// string(9) "李佳博"
|
||||
// ["mobile"]=>
|
||||
// string(14) "+8615738985690"
|
||||
// ["name"]=>
|
||||
// string(9) "李佳博"
|
||||
// ["open_id"]=>
|
||||
// string(35) "ou_37bb7cfc4311c858ea32461700fa1a43"
|
||||
// ["tenant_key"]=>
|
||||
// string(16) "14e7bc0fe5985740"
|
||||
// ["union_id"]=>
|
||||
// string(35) "on_a3fdbca48cd9477a140c7f2167a63691"
|
||||
// ["user_id"]=>
|
||||
// string(8) "481g947d"
|
||||
// }
|
||||
// ["msg"]=>
|
||||
// string(7) "success"
|
||||
// }
|
||||
$user = new FeishuUser();
|
||||
$user->firstOrCreate([
|
||||
'user_id' => $userId,
|
||||
'sign' => $state[0],
|
||||
'tenant_key' => $rst['data']['tenant_key'],
|
||||
'open_id' => $rst['data']['open_id'],
|
||||
'feishu_user_id' => $rst['data']['user_id'],
|
||||
'union_id' => $rst['data']['union_id']
|
||||
]);
|
||||
|
||||
// return json($rst);
|
||||
return Util::success($rst['data'], trans('success'));
|
||||
|
||||
@@ -145,11 +145,13 @@ class UserController
|
||||
$data = [
|
||||
'mobile' => $mobile,
|
||||
'email' => $email,
|
||||
'name' => $name,
|
||||
'name' => '用户_'.rand(111111, 999999),
|
||||
'sex' => $sex,
|
||||
'role' => 1,
|
||||
'password' => $hashedPassword,
|
||||
'status' => 0,
|
||||
'avatar' => 'vehicle_album/20250322/175585eeebcf44e8c2a2d50a5e8b5388_67ded58ca1011.jpg',
|
||||
'sn' => substr(uniqid(), -8)
|
||||
];
|
||||
|
||||
if (Util::isEmpty($id)) {
|
||||
@@ -180,7 +182,9 @@ class UserController
|
||||
unset($user->password);
|
||||
$user['feishu_openid'] = FeishuUser::where('user_id', $userId)->value('open_id');
|
||||
$user['country_name'] = Country::where('id', $user['country_id'])->value('cn_addr');
|
||||
|
||||
$user['avatar_url'] = $user['avatar'];
|
||||
$ossservice = new \app\service\OssService();
|
||||
$user['avatar'] = $user['avatar'] ? $ossservice->generatePrivateUrl($user['avatar']) : '';
|
||||
return Util::success($user, trans('save_success'));
|
||||
}
|
||||
|
||||
@@ -198,6 +202,8 @@ class UserController
|
||||
$country_id = Util::getParam($request, 'country_id');
|
||||
$sign = Util::getParam($request, 'sign');
|
||||
$id = $request->user['id'];
|
||||
$avatar = Util::getParam($request, 'avatar_url');
|
||||
$mobile = Util::getParam($request, 'mobile');
|
||||
|
||||
$data = [
|
||||
'name' => $name,
|
||||
@@ -205,6 +211,8 @@ class UserController
|
||||
'position' => $position,
|
||||
'country_id' => $country_id,
|
||||
'sign' => $sign,
|
||||
'avatar' => $avatar,
|
||||
'mobile' => $mobile
|
||||
];
|
||||
|
||||
$res = User::where('id', $id)
|
||||
|
||||
+34
-9
@@ -20,29 +20,54 @@ class Task
|
||||
echo date('Y-m-d H:i:s') . "\n";
|
||||
Log::info('send follow start',[time()]);
|
||||
// FeishuController::send('xinyouhe','ou_e33bb3017ada6c4781398a68e55a4696', '跟进提醒', '您有新的跟进提醒', '');
|
||||
$customer = Customer::where(['follow_next', '<=', time() + 3600])
|
||||
->where(['follow_next', '>', time()])
|
||||
->where(['warn', '<', 1])
|
||||
->get();
|
||||
// $customer = Customer::where(['follow_next', '<=', time() + 3600])
|
||||
// ->where(['follow_next', '>', time()])
|
||||
// ->where(['warn', '<', 1])
|
||||
// ->get();
|
||||
// foreach ($customer as $item) {
|
||||
// $feishuUser = FeishuUser::where(['user_id' => $item->user_id])->first();
|
||||
// if ($feishuUser) {
|
||||
// // 获取凭证
|
||||
// $certificate = config($this->config);
|
||||
// // 使用parse_url解析URL
|
||||
// $parsedUrl = parse_url($certificate['rUrl']);
|
||||
// // 获取域名和端口
|
||||
// $host = $parsedUrl['host'];
|
||||
// $port = isset($parsedUrl['port']) ? ':' . $parsedUrl['port'] : '';
|
||||
// $url = $host .$port. '/pages/customer/detile?id='.$customer->id;
|
||||
// $item->warn = 1;
|
||||
// $item->update();
|
||||
// $user = User::first()->where('id', $item->user_id);
|
||||
// Log::info('send',['open_id'=>$item['open_id'],'url'=>$url]);
|
||||
// // FeishuController::send('xinyouhe','ou_e33bb3017ada6c4781398a68e55a4696', '跟进提醒', '您有新的跟进提醒', $url);
|
||||
// FeishuController::send($user->sign,$feishuUser->open_id, '跟进提醒', '您有新的跟进提醒', $url);
|
||||
// }
|
||||
// }
|
||||
|
||||
$where = [
|
||||
['follow_next', '<=', time() + 3600],
|
||||
['follow_next', '>', time()],
|
||||
['warn', '<', 1]
|
||||
];
|
||||
$customer = Customer::where($where)->get();
|
||||
foreach ($customer as $item) {
|
||||
$feishuUser = FeishuUser::where(['user_id' => $item->user_id])->first();
|
||||
if ($feishuUser) {
|
||||
// 获取凭证
|
||||
$certificate = config($this->config);
|
||||
$certificate = config('feishu.'.$feishuUser->sign);
|
||||
// 使用parse_url解析URL
|
||||
$parsedUrl = parse_url($certificate['rUrl']);
|
||||
// 获取域名和端口
|
||||
$host = $parsedUrl['host'];
|
||||
$port = isset($parsedUrl['port']) ? ':' . $parsedUrl['port'] : '';
|
||||
$url = $host .$port. '/pages/customer/detile?id='.$customer->id;
|
||||
$url = 'http://'. $host .$port. '/pages/customer/detile?id='.$item->id;
|
||||
$item->warn = 1;
|
||||
$item->update();
|
||||
$user = User::first()->where('id', $item->user_id);
|
||||
Log::info('send',['open_id'=>$item['open_id'],'url'=>$url]);
|
||||
// FeishuController::send('xinyouhe','ou_e33bb3017ada6c4781398a68e55a4696', '跟进提醒', '您有新的跟进提醒', $url);
|
||||
FeishuController::send($user->sign,$feishuUser->open_id, '跟进提醒', '您有新的跟进提醒', $url);
|
||||
FeishuController::send($feishuUser->sign, $feishuUser->open_id, '跟进提醒', '您有新的跟进提醒', $url);
|
||||
}
|
||||
}
|
||||
|
||||
Log::info('send follow start',[time()]);
|
||||
});
|
||||
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ return [
|
||||
'webman' => [
|
||||
'handler' => Http::class,
|
||||
'listen' => getenv('WEBMAN_LISTEN'),
|
||||
'count' => cpu_count() * 4,
|
||||
'count' => cpu_count() * 1,
|
||||
'user' => '',
|
||||
'group' => '',
|
||||
'reusePort' => false,
|
||||
|
||||
Reference in New Issue
Block a user