机器人婚检15分钟自动退单
parent
1efbdde8d5
commit
f3048eb78e
@ -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…
Reference in New Issue