option('start'); $end = $this->option('end'); $day = $this->option('day'); if($start && $end){ $this->start_scope($start,$end); }elseif($day){ $this->start_day($day); }else{ $this->start(); } } private function start(){ $yesterday = date('Y-m-d', strtotime(date("Y-m-d") . " -1 day")); //echo '$yesterday'.$yesterday.PHP_EOL; $data = OrderService::getRechargeAmountGroupByOfficial($yesterday); DB::table('official_account_bills')->insert($data); } private function start_scope($start,$end){ if(strtotime($start) >= strtotime($end)){ return false; } $temp_start = $start; while (true){ $this->start_day($temp_start); if($temp_start == $end){ break; } $temp_start = date('Y-m-d',strtotime($temp_start)+86400); } return 1; } private function start_day($day){ //echo $day.PHP_EOL; $data = OrderService::getRechargeAmountGroupByOfficial($day); DB::table('official_account_bills')->insert($data); } }