|
@@ -332,17 +332,7 @@ class RelayInquiry extends Command |
|
@@ -332,17 +332,7 @@ class RelayInquiry extends Command |
|
332
|
try {
|
332
|
try {
|
|
333
|
$res = false;
|
333
|
$res = false;
|
|
334
|
foreach ($ad_task as $task){
|
334
|
foreach ($ad_task as $task){
|
|
335
|
- //需要多个ip访问的国家 随机2-5次访问,只有一次询盘
|
|
|
|
336
|
- if (in_array($val->country_name, $this->multiple_ip_visit_country)) {
|
|
|
|
337
|
- $times = mt_rand(2, 5); //随机次数
|
|
|
|
338
|
- $inquiry_time = mt_rand(1, $times); //第几次询盘
|
|
|
|
339
|
- $this->output('多次访问模拟:' . $times);
|
|
|
|
340
|
- for ($i = 1; $i <= $times; $i++) {
|
|
|
|
341
|
- $res += $this->relayDetail($task, $val, $inquiry_time == $i);
|
|
|
|
342
|
- }
|
|
|
|
343
|
- }else{
|
|
|
|
344
|
- $res += $this->relayDetail($task, $val);
|
|
|
|
345
|
- }
|
335
|
+ $res += $this->relayDetail($task, $val);
|
|
346
|
$res += $this->relayShopDetail($task, $val);
|
336
|
$res += $this->relayShopDetail($task, $val);
|
|
347
|
$res += $this->relayFobDetail($task, $val);
|
337
|
$res += $this->relayFobDetail($task, $val);
|
|
348
|
}
|
338
|
}
|
|
@@ -405,7 +395,7 @@ class RelayInquiry extends Command |
|
@@ -405,7 +395,7 @@ class RelayInquiry extends Command |
|
405
|
* @param $form
|
395
|
* @param $form
|
|
406
|
* @return bool
|
396
|
* @return bool
|
|
407
|
*/
|
397
|
*/
|
|
408
|
- public function relayDetail($task, $form, $is_inquiry = true)
|
398
|
+ public function relayDetail($task, $form)
|
|
409
|
{
|
399
|
{
|
|
410
|
$this->output('获取转发对象');
|
400
|
$this->output('获取转发对象');
|
|
411
|
if(empty($task['target'] )){
|
401
|
if(empty($task['target'] )){
|
|
@@ -441,62 +431,76 @@ class RelayInquiry extends Command |
|
@@ -441,62 +431,76 @@ class RelayInquiry extends Command |
|
441
|
}
|
431
|
}
|
|
442
|
$this->logChannel()->info('随机域名', array_column($random_data, 'url'));
|
432
|
$this->logChannel()->info('随机域名', array_column($random_data, 'url'));
|
|
443
|
foreach ($random_data as $item) {
|
433
|
foreach ($random_data as $item) {
|
|
444
|
- //手机号过滤
|
|
|
|
445
|
- $phone = $form->phone;
|
|
|
|
446
|
- $filter_phone = $this->get_rand($this->filter_phone);
|
|
|
|
447
|
- if($filter_phone == 0){
|
|
|
|
448
|
- $phone = trim(str_replace("+", '', $phone));
|
|
|
|
449
|
- }elseif($filter_phone == 1){
|
|
|
|
450
|
- $phone = '';
|
434
|
+ $times = 1;
|
|
|
|
435
|
+ $inquiry_time = 1;
|
|
|
|
436
|
+
|
|
|
|
437
|
+ //需要多个ip访问的国家 随机2-5次访问,只有一次询盘
|
|
|
|
438
|
+ if (in_array($form->country_name, $this->multiple_ip_visit_country)) {
|
|
|
|
439
|
+ $times = mt_rand(2, 5); //随机次数
|
|
|
|
440
|
+ $inquiry_time = mt_rand(1, $times); //第几次询盘
|
|
|
|
441
|
+ $this->output('多次访问模拟:' . $times);
|
|
451
|
}
|
442
|
}
|
|
|
|
443
|
+ for ($i = 1; $i <= $times; $i++) {
|
|
|
|
444
|
+ $is_inquiry = $inquiry_time == $i;
|
|
|
|
445
|
+ //手机号过滤
|
|
|
|
446
|
+ $phone = $form->phone;
|
|
|
|
447
|
+ $filter_phone = $this->get_rand($this->filter_phone);
|
|
|
|
448
|
+ if($filter_phone == 0){
|
|
|
|
449
|
+ $phone = trim(str_replace("+", '', $phone));
|
|
|
|
450
|
+ }elseif($filter_phone == 1){
|
|
|
|
451
|
+ $phone = '';
|
|
|
|
452
|
+ }
|
|
452
|
|
453
|
|
|
453
|
- // 推送站点
|
|
|
|
454
|
- $domain = $item['url'];
|
|
|
|
455
|
- $is_v6 = $item['is_v6'];
|
|
|
|
456
|
- $re_website = 'https://' . $domain . '/';
|
|
|
|
457
|
-
|
|
|
|
458
|
- //urls
|
|
|
|
459
|
- list($urls, $lang, $inquiry_product_url) = $this->getUrls($is_v6, $domain, $re_website, $form, $task);
|
|
|
|
460
|
- if(!$urls){
|
|
|
|
461
|
- continue;
|
|
|
|
462
|
- }
|
|
|
|
463
|
-
|
|
|
|
464
|
- //ip
|
|
|
|
465
|
- $ip_data = $this->getIpData($form->country_name);
|
|
|
|
466
|
- $ip = $ip_data->ip;
|
|
|
|
467
|
- $country_name = $ip_data->ip_area;
|
|
|
|
468
|
-
|
|
|
|
469
|
- //message
|
|
|
|
470
|
- list($message, $message_id, $msg_lang) = $this->getMessage($task, $form->message, $domain, $inquiry_product_url);
|
|
|
|
471
|
- $lang = $lang ?: $msg_lang;
|
454
|
+ // 推送站点
|
|
|
|
455
|
+ $domain = $item['url'];
|
|
|
|
456
|
+ $is_v6 = $item['is_v6'];
|
|
|
|
457
|
+ $re_website = 'https://' . $domain . '/';
|
|
472
|
|
458
|
|
|
473
|
- $this->output('获取转发设备信息');
|
|
|
|
474
|
- // 客户端 头信息 来源
|
|
|
|
475
|
- $device_port = $form->email ? '1' : '2'; //1 pc 2移动端
|
|
|
|
476
|
- $user_agent = $form->email ? Arr::random($this->pc_ua) : Arr::random($this->mobile_ua);
|
|
|
|
477
|
- $referrer = $this->getReferer($country_name, $lang);
|
|
|
|
478
|
- $this->output('写入数据');
|
459
|
+ //urls
|
|
|
|
460
|
+ list($urls, $lang, $inquiry_product_url) = $this->getUrls($is_v6, $domain, $re_website, $form, $task);
|
|
|
|
461
|
+ if(!$urls){
|
|
|
|
462
|
+ continue;
|
|
|
|
463
|
+ }
|
|
479
|
|
464
|
|
|
480
|
- $pre = 0;
|
|
|
|
481
|
- $start_time = time();
|
|
|
|
482
|
- $seconds = rand(300, 7200); // 开始时间 从5-2小时后开始
|
|
|
|
483
|
- $exists = ReInquiryDetail::where('re_website', $domain)->where('email', $form->email)->first();
|
|
|
|
484
|
- if($exists){
|
|
|
|
485
|
- $this->output('转发站点邮件已存在');
|
|
|
|
486
|
- continue;
|
|
|
|
487
|
- }
|
|
|
|
488
|
- // 写入推送详情
|
|
|
|
489
|
- $re_detail = ReInquiryDetail::createInquiry($task['id'], $form->id, $domain, $country_name, $ip, $form->full_name, $form->email, $phone, $message, $message_id, $device_port,
|
|
|
|
490
|
- $user_agent, $referrer, $urls, $is_v6, date('Y-m-d H:i:s', $start_time + $seconds));
|
|
|
|
491
|
- foreach ($urls as $k=>$v){
|
|
|
|
492
|
- $pre++;
|
|
|
|
493
|
- $seconds += rand(5,60);
|
|
|
|
494
|
- ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_VISIT, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds));
|
|
|
|
495
|
- // 最后一次访问询盘 加上询盘
|
|
|
|
496
|
- if($is_inquiry && $k+1 >= count($urls)){
|
|
|
|
497
|
- $seconds += rand(30,120);
|
465
|
+ //ip
|
|
|
|
466
|
+ $ip_data = $this->getIpData($form->country_name);
|
|
|
|
467
|
+ $ip = $ip_data->ip;
|
|
|
|
468
|
+ $country_name = $ip_data->ip_area;
|
|
|
|
469
|
+
|
|
|
|
470
|
+ //message
|
|
|
|
471
|
+ list($message, $message_id, $msg_lang) = $this->getMessage($task, $form->message, $domain, $inquiry_product_url);
|
|
|
|
472
|
+ $lang = $lang ?: $msg_lang;
|
|
|
|
473
|
+
|
|
|
|
474
|
+ $this->output('获取转发设备信息');
|
|
|
|
475
|
+ // 客户端 头信息 来源
|
|
|
|
476
|
+ $device_port = $form->email ? '1' : '2'; //1 pc 2移动端
|
|
|
|
477
|
+ $user_agent = $form->email ? Arr::random($this->pc_ua) : Arr::random($this->mobile_ua);
|
|
|
|
478
|
+ $referrer = $this->getReferer($country_name, $lang);
|
|
|
|
479
|
+ $this->output('写入数据');
|
|
|
|
480
|
+
|
|
|
|
481
|
+ $pre = 0;
|
|
|
|
482
|
+ $start_time = time();
|
|
|
|
483
|
+ $seconds = rand(300, 7200); // 开始时间 从5-2小时后开始
|
|
|
|
484
|
+ if($is_inquiry) {
|
|
|
|
485
|
+ $exists = ReInquiryDetail::where('re_website', $domain)->where('email', $form->email)->first();
|
|
|
|
486
|
+ if ($exists) {
|
|
|
|
487
|
+ $this->output('转发站点邮件已存在');
|
|
|
|
488
|
+ continue;
|
|
|
|
489
|
+ }
|
|
|
|
490
|
+ }
|
|
|
|
491
|
+ // 写入推送详情
|
|
|
|
492
|
+ $re_detail = ReInquiryDetail::createInquiry($task['id'], $form->id, $domain, $country_name, $ip, $form->full_name, $form->email, $phone, $message, $message_id, $device_port,
|
|
|
|
493
|
+ $user_agent, $referrer, $urls, $is_v6, date('Y-m-d H:i:s', $start_time + $seconds));
|
|
|
|
494
|
+ foreach ($urls as $k=>$v){
|
|
498
|
$pre++;
|
495
|
$pre++;
|
|
499
|
- ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_INQUIRY, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds));
|
496
|
+ $seconds += rand(5,60);
|
|
|
|
497
|
+ ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_VISIT, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds));
|
|
|
|
498
|
+ // 最后一次访问询盘 加上询盘
|
|
|
|
499
|
+ if($is_inquiry && $k+1 >= count($urls)){
|
|
|
|
500
|
+ $seconds += rand(30,120);
|
|
|
|
501
|
+ $pre++;
|
|
|
|
502
|
+ ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_INQUIRY, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds));
|
|
|
|
503
|
+ }
|
|
500
|
}
|
504
|
}
|
|
501
|
}
|
505
|
}
|
|
502
|
}
|
506
|
}
|
|
@@ -601,16 +605,20 @@ class RelayInquiry extends Command |
|
@@ -601,16 +605,20 @@ class RelayInquiry extends Command |
|
601
|
$form_message = $message;
|
605
|
$form_message = $message;
|
|
602
|
$message_id = 0;
|
606
|
$message_id = 0;
|
|
603
|
|
607
|
|
|
604
|
- // TODO 当原始询盘内容长度大于15个字符, 直接发送原始内容。
|
608
|
+ // TODO 当原始询盘内容长度大于15个字符, 60%几率直接发送原始内容。
|
|
605
|
if (strlen($message) >= 15) {
|
609
|
if (strlen($message) >= 15) {
|
|
606
|
- //原内容非英语,转为对应语种
|
|
|
|
607
|
- if (is_numeric($form_message)) { //数字会被识别为中文
|
|
|
|
608
|
- $lang = 'en';
|
|
|
|
609
|
- } else {
|
|
|
|
610
|
- $translateSl = Translate::translateSl($form_message);
|
|
|
|
611
|
- $lang = $translateSl['texts']['sl'] ?? 'en';
|
610
|
+ $not_use_probability = AiCommand::where('key', 'fb_inquiry_text')->value('not_use_probability');
|
|
|
|
611
|
+ $randomNumber = rand(0, 100);
|
|
|
|
612
|
+ if($randomNumber < $not_use_probability){
|
|
|
|
613
|
+ //原内容非英语,转为对应语种
|
|
|
|
614
|
+ if (is_numeric($form_message)) { //数字会被识别为中文
|
|
|
|
615
|
+ $lang = 'en';
|
|
|
|
616
|
+ } else {
|
|
|
|
617
|
+ $translateSl = Translate::translateSl($form_message);
|
|
|
|
618
|
+ $lang = $translateSl['texts']['sl'] ?? 'en';
|
|
|
|
619
|
+ }
|
|
|
|
620
|
+ return [$message, $message_id, $lang??''];
|
|
612
|
}
|
621
|
}
|
|
613
|
- return [$message, $message_id, $lang??''];
|
|
|
|
614
|
}
|
622
|
}
|
|
615
|
|
623
|
|
|
616
|
//开启文案替换
|
624
|
//开启文案替换
|