onWorkerStart=function ($conn){ Timer::add(1,function (){ $orders= MobileOrder::waitPay() ->where('type',1) ->where('create_time','<',time()-300) ->field('id') ->whereNotExists('select * from mobile_order_mind where mobile_order.id=mobile_order_mind.mobile_order_id') ->select() ->toArray(); self::log(sprintf('%d条数据',count($orders))); foreach ($orders as $orderId){ try { $order=MobileOrder::find($orderId); if(!$order){ continue; } SmsSend::orderUnPay($order['phone'],$order['no']); $order->mind()->save([]); }catch (\Exception $e){ self::logError($e); } } }); }; } public static function logname(){ return class_basename(__CLASS__); } } MobileOrderUnPayNotify::run();