消息推送

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
+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()]);
});
}
}