count = 1; $bot_loop->name = 'PayCheck'; function PayCheck($order_number) { Tool::log('开始执行PayCheck任务', 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 and (source IS NULL or source not like ?) order by paycheck_time asc", [ 1,'%线下体检预约%' ]); if (!!$pay_check and strtotime($pay_check['paycheck_time']) date('Y-m-d H:i:s'), ], 'where id = ?', [ $pay_check['id'] ]); PayCheck($pay_check['order_number']); } else { Tool::log('PayCheck未检测到任务'); } } $bot_loop->onWorkerStart = function () { PayCheckFunc(); Timer::add(10, function () { PayCheckFunc(); }); };