作者 赵彬吉

fb询盘多ip访问

@@ -171,6 +171,12 @@ class RelayInquiry extends Command @@ -171,6 +171,12 @@ class RelayInquiry extends Command
171 protected $filter_phone = [30,12,58]; 171 protected $filter_phone = [30,12,58];
172 172
173 /** 173 /**
  174 + * 需要多个ip访问的国家
  175 + * @var
  176 + */
  177 + protected $multiple_ip_visit_country = [];
  178 +
  179 + /**
174 * @return bool 180 * @return bool
175 */ 181 */
176 public function handle() 182 public function handle()
@@ -224,7 +230,16 @@ class RelayInquiry extends Command @@ -224,7 +230,16 @@ class RelayInquiry extends Command
224 try { 230 try {
225 $res = false; 231 $res = false;
226 foreach ($ad_task as $task){ 232 foreach ($ad_task as $task){
227 - $res += $this->relayDetail($task, $val); 233 + //需要多个ip访问的国家 随机2-5次访问,只有一次询盘
  234 + if (in_array($val->country_name, $this->multiple_ip_visit_country)) {
  235 + $times = mt_rand([2, 5]); //随机次数
  236 + $inquiry_time = mt_rand([1, $times]); //第几次询盘
  237 + for ($i = 1; $i <= $times; $i++) {
  238 + $res += $this->relayDetail($task, $val, $inquiry_time == $i);
  239 + }
  240 + }else{
  241 + $res += $this->relayDetail($task, $val);
  242 + }
228 $res += $this->relayShopDetail($task, $val); 243 $res += $this->relayShopDetail($task, $val);
229 $res += $this->relayFobDetail($task, $val); 244 $res += $this->relayFobDetail($task, $val);
230 } 245 }
@@ -287,7 +302,7 @@ class RelayInquiry extends Command @@ -287,7 +302,7 @@ class RelayInquiry extends Command
287 * @param $form 302 * @param $form
288 * @return bool 303 * @return bool
289 */ 304 */
290 - public function relayDetail($task, $form) 305 + public function relayDetail($task, $form, $is_inquiry = true)
291 { 306 {
292 $this->output('获取转发对象'); 307 $this->output('获取转发对象');
293 if(empty($task['target'] )){ 308 if(empty($task['target'] )){
@@ -361,7 +376,7 @@ class RelayInquiry extends Command @@ -361,7 +376,7 @@ class RelayInquiry extends Command
361 376
362 $pre = 0; 377 $pre = 0;
363 $start_time = time(); 378 $start_time = time();
364 - $seconds = rand(300, 3000); // 开始时间 从5-50分钟后开始 379 + $seconds = rand(300, 7200); // 开始时间 从5-2小时后开始
365 $exists = ReInquiryDetail::where('re_website', $domain)->where('email', $form->email)->first(); 380 $exists = ReInquiryDetail::where('re_website', $domain)->where('email', $form->email)->first();
366 if($exists){ 381 if($exists){
367 $this->output('转发站点邮件已存在'); 382 $this->output('转发站点邮件已存在');
@@ -375,7 +390,7 @@ class RelayInquiry extends Command @@ -375,7 +390,7 @@ class RelayInquiry extends Command
375 $seconds += rand(5,60); 390 $seconds += rand(5,60);
376 ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_VISIT, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds)); 391 ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_VISIT, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds));
377 // 最后一次访问询盘 加上询盘 392 // 最后一次访问询盘 加上询盘
378 - if($k+1 >= count($urls)){ 393 + if($is_inquiry && $k+1 >= count($urls)){
379 $seconds += rand(30,120); 394 $seconds += rand(30,120);
380 $pre++; 395 $pre++;
381 ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_INQUIRY, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds)); 396 ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_INQUIRY, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds));