From baefa37cc6dd0f58b3899b4b44dd5ac9f8168d8e Mon Sep 17 00:00:00 2001 From: sa0ChunLuyu Date: Fri, 20 Dec 2024 14:04:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E6=9C=BA=E5=99=A8=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot/bot/bot_wxSend.php | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 bot/bot/bot_wxSend.php diff --git a/bot/bot/bot_wxSend.php b/bot/bot/bot_wxSend.php new file mode 100644 index 0000000..4054a72 --- /dev/null +++ b/bot/bot/bot_wxSend.php @@ -0,0 +1,47 @@ +count = 1; +$bot_loop->name = 'WxSend'; +function WxSend($order_id) +{ + Tool::log('开始执行WxSend任务', 2); + $url = Tool::ini('WX_SEND'); + $res = Tool::post($url, [ + 'id' => $order_id + ]); + Tool::log(json_encode($res, JSON_UNESCAPED_UNICODE), 2); +} + +function WxSendFunc() +{ + $db = Db::get(); + $pay_check = $db->getRow("select * from orders where status = ? + and appointment_number is not null + and wx_day1_sendmsg_status = 0 + and wx_day1_sendmsg_time <= ? + order by wx_day1_sendmsg_time asc", [ + 2, date('Y-m-d H:i:s') + ]); + if (!!$pay_check) { + Db2::u($db, 'orders', [ + 'wx_day1_sendmsg_time' => date('Y-m-d H:i:s'), + ], 'where id = ?', [ + $pay_check['id'] + ]); + WxSend($pay_check['id']); + } else { + Tool::log('WxSend未检测到任务'); + } +} + +$bot_loop->onWorkerStart = function () { + WxSendFunc(); + Timer::add(10, function () { + WxSendFunc(); + }); +};