From edafd5af85fde06f96cb1cce28dd500f80b98054 Mon Sep 17 00:00:00 2001 From: yanzai Date: Sun, 17 Aug 2025 12:07:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8F=96=E6=B6=88=E5=92=8C?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E6=9F=A5=E8=AF=A2=20=E6=8E=92=E9=99=A4?= =?UTF-8?q?=E7=BA=BF=E4=B8=8B=E4=BD=93=E6=A3=80=E9=A2=84=E7=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Laravel/app/Http/Controllers/API/H5/OrderController.php | 6 ++++-- Laravel/routes/web.php | 4 ++-- bot/bot/bot_orderCancel.php | 6 +++--- bot/bot/bot_payCheck.php | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Laravel/app/Http/Controllers/API/H5/OrderController.php b/Laravel/app/Http/Controllers/API/H5/OrderController.php index 2c0d71e..682fda2 100644 --- a/Laravel/app/Http/Controllers/API/H5/OrderController.php +++ b/Laravel/app/Http/Controllers/API/H5/OrderController.php @@ -1411,8 +1411,9 @@ class OrderController extends Controller $WaitingPaymentTime = config('app.globals.WaitingPaymentTime');//支付等待時間 $orderInfos = DB::table('orders') ->where(['status' => 1]) - ->where('source', 'not like', '%线下体检预约%') + ->whereRaw("COALESCE(source, '') NOT LIKE '%线下体检预约%'") ->get(); + $ids=[]; foreach ($orderInfos as $k => $orderInfo) { $person = DB::table('web_user_person')->where(['id' => $orderInfo->person_id])->first(); $datetime = new DateTime($orderInfo->created_at); @@ -1421,9 +1422,10 @@ class OrderController extends Controller if (time() > $orderInfo->end_time) { $do = new OrderService(); $do->Cancel($orderInfo); + $ids[]=$orderInfo->id; } } - return \Yz::Return(true, "批量处理完成", []); + return \Yz::Return(true, "批量取消订单处理完成", ['orderids'=>$ids]); } public function create_appointment($hospital, $data) diff --git a/Laravel/routes/web.php b/Laravel/routes/web.php index d64fafc..9f25243 100644 --- a/Laravel/routes/web.php +++ b/Laravel/routes/web.php @@ -118,7 +118,7 @@ Route::group(['middleware' => ['log'],'prefix' => 'api/Web'], function () { Route::any('/TJPushInfo', 'App\Http\Controllers\API\Internal\SiXinPushController@PushInfo');//接收思信推送 Route::any('/TJCheck', 'App\Http\Controllers\API\Internal\OrderController@TJCheck')->middleware('log');//到检通知 Route::any('/OfflineOrderPush', 'App\Http\Controllers\API\Internal\OrderController@OfflineOrderPush')->middleware('log');//线下预约完后,推送过来订单 -Route::any('/OrderBatchCancel', 'App\Http\Controllers\API\H5\OrderController@BatchCancel');//批量取消 +Route::any('/OrderBatchCancel', 'App\Http\Controllers\API\H5\OrderController@BatchCancel')->middleware('log');//批量取消 Route::any('/CancelZhuanZeng', 'App\Http\Controllers\API\H5\OrderNewController@CancelZhuanZeng')->middleware('log');//取消转赠 Route::any('/GetH5Order', 'App\Http\Controllers\API\Internal\OrderController@GetH5Order')->middleware('log');//获取已经预约未到检订单 @@ -129,7 +129,7 @@ Route::any('/GetFenZhenInfo', 'App\Http\Controllers\API\Internal\FenZhenControll Route::any('/GetHzidAndGhzid', 'App\Http\Controllers\API\Internal\PersonController@GetHzidAndGhzid');//获取用户hzid和GHzid Route::any('GetZhuanZhenInfo', 'App\Http\Controllers\API\Web\OrderController@export')->middleware('log');//导出医生预约订单 -Route::post('/RoundPayCheck', 'App\Http\Controllers\API\H5\OrderController@RoundPayCheck');//轮询支付检查 +Route::post('/RoundPayCheck', 'App\Http\Controllers\API\H5\OrderController@RoundPayCheck')->middleware('log');//轮询支付检查 Route::post('/Day1WXSend', 'App\Http\Controllers\API\H5\OrderController@Day1WXSend')->middleware('log');//提前1天微信通知 Route::post('/AutoRefund', 'App\Http\Controllers\API\H5\PayController@AutoRefund')->middleware('log');//对外退款接口 Route::post('/OfflineOrderCheck', 'App\Http\Controllers\API\H5\OrderNewController@OfflineOrderCheck')->middleware('log');//检测线下预约推送订单,该通知通知,该取消取消 diff --git a/bot/bot/bot_orderCancel.php b/bot/bot/bot_orderCancel.php index 8a8871a..5ed6cd6 100644 --- a/bot/bot/bot_orderCancel.php +++ b/bot/bot/bot_orderCancel.php @@ -9,7 +9,7 @@ $bot_loop->count = 1; $bot_loop->name = 'OrderCancel'; function OrderCancel() { - Tool::log('开始执行任务', 2); + Tool::log('开始ordercancel执行任务', 2); $url = Tool::ini('ORDER_CANCEL'); $res = Tool::post($url); Tool::log(json_encode($res, JSON_UNESCAPED_UNICODE), 2); @@ -18,14 +18,14 @@ function OrderCancel() function OrderCancelFunc() { $db = Db::get(); - $order_cancel_count = $db->getRow("select count(1) as c from orders where status = ? and created_at < ? and source not like ?", [ + $order_cancel_count = $db->getRow("select count(1) as c from orders where status = ? and created_at < ? and (source IS NULL or source not like ?)", [ 1, date('Y-m-d H:i:s', time() - 60 * 20),'%线下体检预约%' ]); if ($order_cancel_count['c'] > 0) { OrderCancel(); } else { - Tool::log('未检测到任务'); + Tool::log('ordercancel未检测到任务'); } } diff --git a/bot/bot/bot_payCheck.php b/bot/bot/bot_payCheck.php index 0b5b6ad..6343ff0 100644 --- a/bot/bot/bot_payCheck.php +++ b/bot/bot/bot_payCheck.php @@ -20,8 +20,8 @@ function PayCheck($order_number) function PayCheckFunc() { $db = Db::get(); - $pay_check = $db->getRow("select * from orders where status = ? and order_number is not null order by paycheck_time asc", [ - 1, + $pay_check = $db->getRow("select * from orders where status = ? and order_number is not null and (source IS NULL or source not like ?) order by paycheck_time asc", [ + 1,'%线下体检预约%' ]); if (!!$pay_check and strtotime($pay_check['paycheck_time'])