作者 赵彬吉

update

@@ -175,17 +175,18 @@ class WebTrafficFix extends Command @@ -175,17 +175,18 @@ class WebTrafficFix extends Command
175 $project_list = $this->getProjectList($type); 175 $project_list = $this->getProjectList($type);
176 176
177 foreach ($project_list as $project) { 177 foreach ($project_list as $project) {
178 - echo $project['project_id'] . PHP_EOL;  
179 - $ip_num = Count::where('project_id', $project['project_id'])->where('date', $date)->value('ip_num') ?: 0; 178 + echo 'project_id:' . $project['project_id'] . PHP_EOL;
  179 + $ip_num = DB::connection('custom_mysql')->table('gl_customer_visit_item')->whereDate('updated_date', $date)->count();
180 if($ip_num >= 30){ 180 if($ip_num >= 30){
181 continue; 181 continue;
182 } 182 }
183 183
  184 + $randomTime = [];
184 for ($i=0;$i<$need_num-$ip_num;$i++){ 185 for ($i=0;$i<$need_num-$ip_num;$i++){
185 $randomTime[] = Carbon::make($date)->addSeconds(rand(0, 86400))->toDateTimeString(); 186 $randomTime[] = Carbon::make($date)->addSeconds(rand(0, 86400))->toDateTimeString();
186 } 187 }
187 sort($randomTime); 188 sort($randomTime);
188 - echo count($randomTime) . PHP_EOL; 189 + echo 'count:' . count($randomTime) . PHP_EOL;
189 $project_urls = $this->getProductUrls($project['project_id']); 190 $project_urls = $this->getProductUrls($project['project_id']);
190 $project_urls['home'] = $project['domain']; 191 $project_urls['home'] = $project['domain'];
191 192
@@ -224,7 +225,7 @@ class WebTrafficFix extends Command @@ -224,7 +225,7 @@ class WebTrafficFix extends Command
224 $task->data = json_encode($array); 225 $task->data = json_encode($array);
225 $task->type = SyncSubmitTask::TRAFFIC_DEFAULT; 226 $task->type = SyncSubmitTask::TRAFFIC_DEFAULT;
226 $task->created_at = $time; 227 $task->created_at = $time;
227 - $task->status = 3; 228 + $task->status = 1;
228 $task->traffic = 1; 229 $task->traffic = 1;
229 $task->save(); 230 $task->save();
230 } 231 }