Merge branch 'main' of https://git.cjy.net.cn/zhangyan/hainan_2024
commit
70216a2e3b
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Workerman\Lib;
|
||||||
|
|
||||||
|
use Workerman\Worker;
|
||||||
|
|
||||||
|
$bot_loop = new Worker();
|
||||||
|
$bot_loop->count = 1;
|
||||||
|
$bot_loop->name = 'PayCheck';
|
||||||
|
function PayCheck($order_number)
|
||||||
|
{
|
||||||
|
Tool::log('开始执行任务', 2);
|
||||||
|
$url = Tool::ini('PAY_CHECK');
|
||||||
|
$res = Tool::post($url, [
|
||||||
|
'order_number' => $order_number
|
||||||
|
]);
|
||||||
|
Tool::log(json_encode($res, JSON_UNESCAPED_UNICODE), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
]);
|
||||||
|
if (!!$pay_check ) {
|
||||||
|
Db2::u($db, 'orders', [
|
||||||
|
'paycheck_time' => date('Y-m-d H:i:s'),
|
||||||
|
], 'where id = ?', [
|
||||||
|
$pay_check['id']
|
||||||
|
]);
|
||||||
|
PayCheck($pay_check['order_number']);
|
||||||
|
} else {
|
||||||
|
Tool::log('未检测到任务');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$bot_loop->onWorkerStart = function () {
|
||||||
|
PayCheckFunc();
|
||||||
|
Timer::add(10, function () {
|
||||||
|
PayCheckFunc();
|
||||||
|
});
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue