"error", "msg"=>"日期格式不正确"], 256); } }else{ $sDate = date('Y-m-d'); $eDate = date('Y-m-d'); } // 重跑用,传数组 if(!empty($params['advertiser_ids'])){ $this->advertiserIds = $params['advertiser_ids']; } // 重跑用,传int if(!empty($params['api_id'])){ $this->apiId = $params['api_id']; } $this->siteMap = (new AgentSiteLogic())->getSiteAuth(); for ($date = $sDate; $date <= $eDate; $date = date('Y-m-d', strtotime($date . '+1 day'))){ $this->date = $date; try { $this->initStart(); }catch (\Exception $e){ return json_encode(["status"=>"error", "msg"=>$e->getMessage()], 256); } } $this->reRun(); return json_encode(["status"=>"success", "msg"=>""], 256); } // 重跑 protected function reRun(): void { if (date('H') == 8 && date('i') < 20) { $this->date = date('Y-m-d', strtotime("-1 days")); $this->initStart(); } } abstract protected function initStart(); }