消息推送
This commit is contained in:
@@ -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()]);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user