From f3048eb78ed4309d542dc6d12932e62d295b2e26 Mon Sep 17 00:00:00 2001 From: yanzai Date: Fri, 3 Jan 2025 17:16:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=BA=E5=99=A8=E4=BA=BA=E5=A9=9A=E6=A3=8015?= =?UTF-8?q?=E5=88=86=E9=92=9F=E8=87=AA=E5=8A=A8=E9=80=80=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Laravel/routes/web.php | 1 + bot/bot/bot_hunJianOrderCheck.php | 67 +++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 bot/bot/bot_hunJianOrderCheck.php diff --git a/Laravel/routes/web.php b/Laravel/routes/web.php index 6cc406e..cd5ee8e 100644 --- a/Laravel/routes/web.php +++ b/Laravel/routes/web.php @@ -101,6 +101,7 @@ Route::any('/CancelUsePlan', 'App\Http\Controllers\API\Internal\PlanController@C Route::post('/RoundPayCheck', 'App\Http\Controllers\API\H5\OrderController@RoundPayCheck');//轮询支付检查 Route::post('/Day1WXSend', 'App\Http\Controllers\API\H5\OrderController@Day1WXSend');//提前1天微信通知 +Route::post('/AutoRefund', 'App\Http\Controllers\API\H5\PayController@AutoRefund')->middleware('log');//对外退款接口 Route::any('api/FenzhenInfoExport', 'App\Http\Controllers\H5\FenzhenController@export')->middleware('log');//导出报表 diff --git a/bot/bot/bot_hunJianOrderCheck.php b/bot/bot/bot_hunJianOrderCheck.php new file mode 100644 index 0000000..5ec495b --- /dev/null +++ b/bot/bot/bot_hunJianOrderCheck.php @@ -0,0 +1,67 @@ +count = 1; +$bot_loop->name = 'HunJianOrderCheck'; +function HunJianOrderReFund($order_id) +{ + Tool::log('开始执行HunJianOrderReFund任务', 2); + $url = Tool::ini('AUTO_REFUND'); + $res = Tool::post($url, [ + 'id' => $order_id, + 'key' => "dfsd2Ajd256SDI02", + ]); + Tool::log(json_encode($res, JSON_UNESCAPED_UNICODE), 2); +} + +function HunJianOrderCheck() +{ + $db = Db::get(); + $hunjian_check= $db->getRow("select * from orders where checkup_type_id = 4 + and status = 2 + and appointment_number is not null + and hunjian_status=0 + and created_at < NOW() - INTERVAL 15 MINUTE + ", []); + + if (!!$hunjian_check) { + $buy_info=json_decode($hunjian_check['buy_info'],true); + if(isset($buy_info['peiou_info']['sfz'])){ + $peiou_check= $db->getRow("select * from orders where id_number=? + and checkup_type_id = 4 + and status in(2,4) + and appointment_number is not null + ", [$buy_info['peiou_info']['sfz']]); + if(!!$peiou_check){ + Db2::u($db, 'orders', [ + 'hunjian_status' => 1, + ], 'where id = ?', [ + $hunjian_check['id'] + ]); + }else{ + if($hunjian_check['checkup_type_id'] == 4){ + HunJianOrderReFund($hunjian_check['id']); + } + } + }else{ + if($hunjian_check['checkup_type_id'] == 4){ + HunJianOrderReFund($hunjian_check['id']); + } + } + + + } else { + Tool::log('HunJianOrderCheck未检测到任务'); + } +} + +$bot_loop->onWorkerStart = function () { + HunJianOrderCheck(); + Timer::add(10, function () { + HunJianOrderCheck(); + }); +};