|
...
|
...
|
@@ -332,17 +332,7 @@ class RelayInquiry extends Command |
|
|
|
try {
|
|
|
|
$res = false;
|
|
|
|
foreach ($ad_task as $task){
|
|
|
|
//需要多个ip访问的国家 随机2-5次访问,只有一次询盘
|
|
|
|
if (in_array($val->country_name, $this->multiple_ip_visit_country)) {
|
|
|
|
$times = mt_rand(2, 5); //随机次数
|
|
|
|
$inquiry_time = mt_rand(1, $times); //第几次询盘
|
|
|
|
$this->output('多次访问模拟:' . $times);
|
|
|
|
for ($i = 1; $i <= $times; $i++) {
|
|
|
|
$res += $this->relayDetail($task, $val, $inquiry_time == $i);
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$res += $this->relayDetail($task, $val);
|
|
|
|
}
|
|
|
|
$res += $this->relayDetail($task, $val);
|
|
|
|
$res += $this->relayShopDetail($task, $val);
|
|
|
|
$res += $this->relayFobDetail($task, $val);
|
|
|
|
}
|
|
...
|
...
|
@@ -405,7 +395,7 @@ class RelayInquiry extends Command |
|
|
|
* @param $form
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function relayDetail($task, $form, $is_inquiry = true)
|
|
|
|
public function relayDetail($task, $form)
|
|
|
|
{
|
|
|
|
$this->output('获取转发对象');
|
|
|
|
if(empty($task['target'] )){
|
|
...
|
...
|
@@ -441,62 +431,73 @@ class RelayInquiry extends Command |
|
|
|
}
|
|
|
|
$this->logChannel()->info('随机域名', array_column($random_data, 'url'));
|
|
|
|
foreach ($random_data as $item) {
|
|
|
|
//手机号过滤
|
|
|
|
$phone = $form->phone;
|
|
|
|
$filter_phone = $this->get_rand($this->filter_phone);
|
|
|
|
if($filter_phone == 0){
|
|
|
|
$phone = trim(str_replace("+", '', $phone));
|
|
|
|
}elseif($filter_phone == 1){
|
|
|
|
$phone = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
// 推送站点
|
|
|
|
$domain = $item['url'];
|
|
|
|
$is_v6 = $item['is_v6'];
|
|
|
|
$re_website = 'https://' . $domain . '/';
|
|
|
|
|
|
|
|
//urls
|
|
|
|
list($urls, $lang, $inquiry_product_url) = $this->getUrls($is_v6, $domain, $re_website, $form, $task);
|
|
|
|
if(!$urls){
|
|
|
|
continue;
|
|
|
|
//需要多个ip访问的国家 随机2-5次访问,只有一次询盘
|
|
|
|
$times = 1;
|
|
|
|
$inquiry_time = 1;
|
|
|
|
if (in_array($form->country_name, $this->multiple_ip_visit_country)) {
|
|
|
|
$times = mt_rand(2, 5); //随机次数
|
|
|
|
$inquiry_time = mt_rand(1, $times); //第几次询盘
|
|
|
|
$this->output('多次访问模拟:' . $times);
|
|
|
|
}
|
|
|
|
for ($i = 1; $i <= $times; $i++) {
|
|
|
|
$is_inquiry = $inquiry_time == $i;
|
|
|
|
//手机号过滤
|
|
|
|
$phone = $form->phone;
|
|
|
|
$filter_phone = $this->get_rand($this->filter_phone);
|
|
|
|
if($filter_phone == 0){
|
|
|
|
$phone = trim(str_replace("+", '', $phone));
|
|
|
|
}elseif($filter_phone == 1){
|
|
|
|
$phone = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
//ip
|
|
|
|
$ip_data = $this->getIpData($form->country_name);
|
|
|
|
$ip = $ip_data->ip;
|
|
|
|
$country_name = $ip_data->ip_area;
|
|
|
|
|
|
|
|
//message
|
|
|
|
list($message, $message_id, $msg_lang) = $this->getMessage($task, $form->message, $domain, $inquiry_product_url);
|
|
|
|
$lang = $lang ?: $msg_lang;
|
|
|
|
// 推送站点
|
|
|
|
$domain = $item['url'];
|
|
|
|
$is_v6 = $item['is_v6'];
|
|
|
|
$re_website = 'https://' . $domain . '/';
|
|
|
|
|
|
|
|
$this->output('获取转发设备信息');
|
|
|
|
// 客户端 头信息 来源
|
|
|
|
$device_port = $form->email ? '1' : '2'; //1 pc 2移动端
|
|
|
|
$user_agent = $form->email ? Arr::random($this->pc_ua) : Arr::random($this->mobile_ua);
|
|
|
|
$referrer = $this->getReferer($country_name, $lang);
|
|
|
|
$this->output('写入数据');
|
|
|
|
//urls
|
|
|
|
list($urls, $lang, $inquiry_product_url) = $this->getUrls($is_v6, $domain, $re_website, $form, $task);
|
|
|
|
if(!$urls){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
$pre = 0;
|
|
|
|
$start_time = time();
|
|
|
|
$seconds = rand(300, 7200); // 开始时间 从5-2小时后开始
|
|
|
|
$exists = ReInquiryDetail::where('re_website', $domain)->where('email', $form->email)->first();
|
|
|
|
if($exists){
|
|
|
|
$this->output('转发站点邮件已存在');
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
// 写入推送详情
|
|
|
|
$re_detail = ReInquiryDetail::createInquiry($task['id'], $form->id, $domain, $country_name, $ip, $form->full_name, $form->email, $phone, $message, $message_id, $device_port,
|
|
|
|
$user_agent, $referrer, $urls, $is_v6, date('Y-m-d H:i:s', $start_time + $seconds));
|
|
|
|
foreach ($urls as $k=>$v){
|
|
|
|
$pre++;
|
|
|
|
$seconds += rand(5,60);
|
|
|
|
ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_VISIT, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds));
|
|
|
|
// 最后一次访问询盘 加上询盘
|
|
|
|
if($is_inquiry && $k+1 >= count($urls)){
|
|
|
|
$seconds += rand(30,120);
|
|
|
|
//ip
|
|
|
|
$ip_data = $this->getIpData($form->country_name);
|
|
|
|
$ip = $ip_data->ip;
|
|
|
|
$country_name = $ip_data->ip_area;
|
|
|
|
|
|
|
|
//message
|
|
|
|
list($message, $message_id, $msg_lang) = $this->getMessage($task, $form->message, $domain, $inquiry_product_url);
|
|
|
|
$lang = $lang ?: $msg_lang;
|
|
|
|
|
|
|
|
$this->output('获取转发设备信息');
|
|
|
|
// 客户端 头信息 来源
|
|
|
|
$device_port = $form->email ? '1' : '2'; //1 pc 2移动端
|
|
|
|
$user_agent = $form->email ? Arr::random($this->pc_ua) : Arr::random($this->mobile_ua);
|
|
|
|
$referrer = $this->getReferer($country_name, $lang);
|
|
|
|
$this->output('写入数据');
|
|
|
|
|
|
|
|
$pre = 0;
|
|
|
|
$start_time = time();
|
|
|
|
$seconds = rand(300, 7200); // 开始时间 从5-2小时后开始
|
|
|
|
$exists = ReInquiryDetail::where('re_website', $domain)->where('email', $form->email)->first();
|
|
|
|
if($exists){
|
|
|
|
$this->output('转发站点邮件已存在');
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
// 写入推送详情
|
|
|
|
$re_detail = ReInquiryDetail::createInquiry($task['id'], $form->id, $domain, $country_name, $ip, $form->full_name, $form->email, $phone, $message, $message_id, $device_port,
|
|
|
|
$user_agent, $referrer, $urls, $is_v6, date('Y-m-d H:i:s', $start_time + $seconds));
|
|
|
|
foreach ($urls as $k=>$v){
|
|
|
|
$pre++;
|
|
|
|
ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_INQUIRY, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds));
|
|
|
|
$seconds += rand(5,60);
|
|
|
|
ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_VISIT, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds));
|
|
|
|
// 最后一次访问询盘 加上询盘
|
|
|
|
if($is_inquiry && $k+1 >= count($urls)){
|
|
|
|
$seconds += rand(30,120);
|
|
|
|
$pre++;
|
|
|
|
ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_INQUIRY, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
...
|
...
|
|