机器人婚检15分钟自动退单

main
yanzai 11 months ago
parent 1efbdde8d5
commit f3048eb78e

@ -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');//导出报表

@ -0,0 +1,67 @@
<?php
namespace Workerman\Lib;
use Workerman\Worker;
$bot_loop = new Worker();
$bot_loop->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();
});
};
Loading…
Cancel
Save