onWorkerStart=function (WO $worker){ Timer::add(3,function ()use ($worker){ Db::name('mobile')->where('type', Mobile::BEAUTI)->field(['id','sort'])->chunk(1000,function ($ids){ foreach ($ids?:[] as $mobile){ try { EsMobileService::updateById($mobile['id'],['sort'=>$mobile['sort']]); }catch (\Exception $e){ //self::logError($e); } sleep(1); } }); }); }; } } MobileUpdateSort::run();