diff --git a/bot/bot/bot_orderCancel.php b/bot/bot/bot_orderCancel.php new file mode 100644 index 0000000..51d71b6 --- /dev/null +++ b/bot/bot/bot_orderCancel.php @@ -0,0 +1,37 @@ +count = 1; +$bot_loop->name = 'OrderCancel'; +function OrderCancel() +{ + Tool::log('开始执行任务', 2); + $url = Tool::ini('ORDER_CANCEL'); + $res = Tool::post($url); + Tool::log(json_encode($res, JSON_UNESCAPED_UNICODE), 2); +} + +function OrderCancelFunc() +{ + $db = Db::get(); + $order_cancel_count = $db->getRow("select count(1) as c from orders where status = ? and created_at < ?", [ + 1, + date('Y-m-d H:i:s', time() - 60 * 20) + ]); + if ($order_cancel_count['c'] > 0) { + OrderCancel(); + } else { + Tool::log('未检测到任务'); + } +} + +$bot_loop->onWorkerStart = function () { + OrderCancelFunc(); + Timer::add(10, function () { + OrderCancelFunc(); + }); +}; diff --git a/bot/bot/bot_comboChange.php b/bot/bot/sot_comboChange.php similarity index 100% rename from bot/bot/bot_comboChange.php rename to bot/bot/sot_comboChange.php diff --git a/bot/bot/bot_deleteChangeFile.php b/bot/bot/sot_deleteChangeFile.php similarity index 100% rename from bot/bot/bot_deleteChangeFile.php rename to bot/bot/sot_deleteChangeFile.php