消息推送

This commit is contained in:
2025-07-25 13:55:30 +08:00
parent 626f3bdb9e
commit de93d8bd9e
9 changed files with 105 additions and 6 deletions
+5 -3
View File
@@ -92,9 +92,11 @@ class FollowController extends BaseController
if (Util::isEmpty($type)) {
return $this->error('type' . trans('not_null'));
}
$audio_text = Util::getParam($request, 'audio_text', '');
$picture = Util::getParam($request, 'picture');
if (Util::isEmpty($picture)) {
return $this->error(trans('picture_not_null'));
$remark = Util::getParam($request,'remark');
if(Util::isEmpty($picture) && Util::isEmpty($audio_text) && Util::isEmpty($remark)){
return $this->error(trans('follow_not_null'));
}
$corpInfo = Corp::where('abbr', $request->basic_data['corp_abbr'])->first();
@@ -107,7 +109,7 @@ class FollowController extends BaseController
'picture' => $picture,
'remark' => Util::getParam($request, 'remark', ''),
'audio' => Util::getParam($request, 'audio', ''),
'audio_text' => Util::getParam($request, 'audio_text', ''),
'audio_text' => $audio_text,
'lat' => Util::getParam($request, 'lat', 0),
'lng' => Util::getParam($request, 'lng', 0),
'address' => Util::getParam($request, 'address'),
+39
View File
@@ -0,0 +1,39 @@
<?php
namespace app\process;
use app\crm\model\Customer;
use support\Log;
use Workerman\Crontab\Crontab;
class Task
{
public function onWorkerStart()
{
// 每半小时执行一次
new Crontab('0 */30 * * * *', function(){
echo date('Y-m-d H:i:s') . "\n";
Log::info('send follow start',[time()]);
$where = [
['follow_next', '<=', time() + 3600],
['follow_next', '>', time()],
['warn', '<', 1]
];
$customer = Customer::where($where)->get();
foreach ($customer as $item) {
$res =[
'id'=>$item->id,
'category'=>'crm',
'scene'=>'crm-person-follow-up',
'receive type'=>'person'
];
\Webman\RedisQueue\Redis::send("feishu-message",$res);
}
Log::info('send follow start',[time()]);
});
}
}
+2 -1
View File
@@ -42,7 +42,8 @@
"shopwwi/filesystem-oss": "^1.0",
"webman/redis-queue": "^2.1",
"symfony/translation": "^7.3",
"symfony/filesystem": "^7.3"
"symfony/filesystem": "^7.3",
"workerman/crontab": "^1.0"
},
"suggest": {
"ext-event": "For better performance. "
Generated
+51 -1
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "6c03076d4c7c86514f6b2d0073545bea",
"content-hash": "8ef9d9a07b2be477345002a7623ea951",
"packages": [
{
"name": "aliyuncs/oss-sdk-php",
@@ -6292,6 +6292,56 @@
},
"time": "2025-02-17T03:34:21+00:00"
},
{
"name": "workerman/crontab",
"version": "v1.0.7",
"source": {
"type": "git",
"url": "https://github.com/walkor/crontab.git",
"reference": "74f51ca8204e8eb628e57bc0e640561d570da2cb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/walkor/crontab/zipball/74f51ca8204e8eb628e57bc0e640561d570da2cb",
"reference": "74f51ca8204e8eb628e57bc0e640561d570da2cb",
"shasum": ""
},
"require": {
"php": ">=7.0",
"workerman/workerman": ">=4.0.20"
},
"type": "library",
"autoload": {
"psr-4": {
"Workerman\\Crontab\\": "./src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "walkor",
"email": "walkor@workerman.net",
"homepage": "http://www.workerman.net",
"role": "Developer"
}
],
"description": "A crontab written in PHP based on workerman",
"homepage": "http://www.workerman.net",
"keywords": [
"crontab"
],
"support": {
"email": "walkor@workerman.net",
"forum": "http://wenda.workerman.net/",
"issues": "https://github.com/walkor/workerman/issues",
"source": "https://github.com/walkor/crontab",
"wiki": "http://doc.workerman.net/"
},
"time": "2025-01-15T07:20:50+00:00"
},
{
"name": "workerman/redis",
"version": "v2.0.4",
+4 -1
View File
@@ -59,5 +59,8 @@ return [
'enable_memory_monitor' => DIRECTORY_SEPARATOR === '/',
]
]
]
],
'task' => [
'handler' => app\process\Task::class
],
];
+1
View File
@@ -23,6 +23,7 @@ return [
'param_error' => ' خطأ في المعلمات',
'required_not_null' => ' الحقول المطلوبة لا يمكن أن تكون فارغة',
'picture_not_null' => ' لا يمكن أن تكون الصورة فارغة',
'follow_not_null' => ' الصورة و متابعة المحتوى لا يمكن أن تكون فارغة في نفس الوقت',
'contacts_not_null' => ' لا يمكن أن يكون جهة الاتصال أو البريد الإلكتروني أو الهاتف فارغين جميعًا في نفس الوقت',
'car_type_not_null' => ' لا يمكن أن تكون التفضيلات فارغة',
'channel_not_null' => ' لا يمكن أن تكون القناة فارغة',
+1
View File
@@ -23,6 +23,7 @@ return [
'param_error' => ' param error',
'required_not_null' => ' required not_ ull',
'picture_not_null' => ' picture not null',
'follow_not_null' => ' The image and follow-up content cannot be empty at the same time',
'contacts_not_null' => ' Contact person, email, and phone cannot be empty at the same time',
'car_type_not_null' => ' preference_not_null',
'channel_not_null' => ' channel not null',
+1
View File
@@ -23,6 +23,7 @@ return [
'param_error' => ' Ошибка параметра',
'required_not_null' => ' Обязательное заполнение не может быть пустым.',
'picture_not_null' => ' Фотографии не могут быть пустыми',
'follow_not_null' => ' Изображение и последующий контент не могут быть пустыми одновременно.X',
'contacts_not_null' => ' Контакты, почтовый ящик, телефон не может быть одновременно пустым',
'car_type_not_null' => ' Предпочтения не могут быть пустыми',
'channel_not_null' => ' Каналы не могут быть пустыми',
+1
View File
@@ -23,6 +23,7 @@ return [
'param_error' => ' 参数错误',
'required_not_null' => ' 必填项不能为空',
'picture_not_null' => ' 图片不能为空',
'follow_not_null' => ' 图片与跟进内容不能同时为空',
'contacts_not_null' => ' 联系人,邮箱,电话不能同时为空',
'car_type_not_null' => ' 偏好不能为空',
'channel_not_null' => ' 渠道不能为空',