飞书消息

This commit is contained in:
2025-03-22 20:08:01 +08:00
parent 97250ca23e
commit b6409a69ed
2 changed files with 27 additions and 11 deletions
+9 -2
View File
@@ -6,6 +6,7 @@ use app\controller\FeishuController;
use app\model\Customer;
use app\model\FeishuUser;
use app\model\User;
use support\Log;
use Webman\App;
use Workerman\Crontab\Crontab;
@@ -15,8 +16,10 @@ class Task
public function onWorkerStart()
{
// 每半小时执行一次
new Crontab('1/* * * * * *', function () {
new Crontab('*/1 * * * * *', function(){
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])
@@ -34,9 +37,13 @@ class Task
$url = $host .$port. '/pages/customer/detile?id='.$customer->id;
$item->warn = 1;
$item->update();
FeishuController::class->send($feishuUser->open_id, '跟进提醒', '您有新的跟进提醒', $url);
$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);
}
}
Log::info('send follow start',[time()]);
});
}