|
@@ -204,7 +204,7 @@ class RelayInquiry extends Command |
|
@@ -204,7 +204,7 @@ class RelayInquiry extends Command |
|
204
|
}
|
204
|
}
|
|
205
|
// 未设置对法对象
|
205
|
// 未设置对法对象
|
|
206
|
$target_num_arr = array_map(function ($item) {
|
206
|
$target_num_arr = array_map(function ($item) {
|
|
207
|
- return count($item['target']);
|
207
|
+ return count($item['target']) + count($item['shop_site']) + count($item['fob_pro']);
|
|
208
|
}, $ad_task);
|
208
|
}, $ad_task);
|
|
209
|
if (!array_sum($target_num_arr)) {
|
209
|
if (!array_sum($target_num_arr)) {
|
|
210
|
$val->status = ReInquiryForm::STATUS_FORGO;
|
210
|
$val->status = ReInquiryForm::STATUS_FORGO;
|
|
@@ -225,6 +225,8 @@ class RelayInquiry extends Command |
|
@@ -225,6 +225,8 @@ class RelayInquiry extends Command |
|
225
|
$res = false;
|
225
|
$res = false;
|
|
226
|
foreach ($ad_task as $task){
|
226
|
foreach ($ad_task as $task){
|
|
227
|
$res += $this->relayDetail($task, $val);
|
227
|
$res += $this->relayDetail($task, $val);
|
|
|
|
228
|
+ $res += $this->relayShopDetail($task, $val);
|
|
|
|
229
|
+ $res += $this->relayFobDetail($task, $val);
|
|
228
|
}
|
230
|
}
|
|
229
|
$val->status = $res ? ReInquiryForm::STATUS_SUCCESS : ReInquiryForm::STATUS_FORGO;
|
231
|
$val->status = $res ? ReInquiryForm::STATUS_SUCCESS : ReInquiryForm::STATUS_FORGO;
|
|
230
|
$val->save();
|
232
|
$val->save();
|
|
@@ -288,7 +290,10 @@ class RelayInquiry extends Command |
|
@@ -288,7 +290,10 @@ class RelayInquiry extends Command |
|
288
|
public function relayDetail($task, $form)
|
290
|
public function relayDetail($task, $form)
|
|
289
|
{
|
291
|
{
|
|
290
|
$this->output('获取转发对象');
|
292
|
$this->output('获取转发对象');
|
|
291
|
-
|
293
|
+ if(empty($task['target'] )){
|
|
|
|
294
|
+ $this->output('没有独立站转发对象');
|
|
|
|
295
|
+ return 0;
|
|
|
|
296
|
+ }
|
|
292
|
//是否有必选的
|
297
|
//是否有必选的
|
|
293
|
$require_data = [];
|
298
|
$require_data = [];
|
|
294
|
foreach ($task['target'] as $item){
|
299
|
foreach ($task['target'] as $item){
|
|
@@ -327,65 +332,136 @@ class RelayInquiry extends Command |
|
@@ -327,65 +332,136 @@ class RelayInquiry extends Command |
|
327
|
$is_v6 = $item['is_v6'];
|
332
|
$is_v6 = $item['is_v6'];
|
|
328
|
$re_website = 'https://' . $domain . '/';
|
333
|
$re_website = 'https://' . $domain . '/';
|
|
329
|
|
334
|
|
|
330
|
- $this->output('转发对象:' . $domain);
|
|
|
|
331
|
- $this->output('获取转发链接');
|
|
|
|
332
|
- // v6:有邮箱推送主站,没有邮箱推送AMP站;v5:仅推送有邮箱到主站
|
|
|
|
333
|
- $lang = '';
|
|
|
|
334
|
- if ($is_v6) {
|
|
|
|
335
|
- // 获取语种, 6.0是可以确定语种的
|
|
|
|
336
|
- $project = Project::getProjectByDomain($domain);
|
|
|
|
337
|
- if (empty($project)) {
|
|
|
|
338
|
- $this->logChannel()->info('广告任务ID:' . $task['id'] . ', 转发对象:' . $re_website . '非v6链接,转发失败;', ['广告任务ID:' . $task['id'], '询盘ID:' . $form->id]);
|
335
|
+ //urls
|
|
|
|
336
|
+ list($urls, $lang) = $this->getUrls($is_v6, $domain, $re_website, $form, $task);
|
|
|
|
337
|
+ if(!$urls){
|
|
339
|
continue;
|
338
|
continue;
|
|
340
|
}
|
339
|
}
|
|
341
|
- $lang = WebLanguage::getLangById($project->main_lang_id ?? 1)['short'];
|
|
|
|
342
|
|
340
|
|
|
343
|
- // 获取访问明细和着陆页
|
|
|
|
344
|
- $product_url = $this->getLinksFromSitemap($re_website . 'product_sitemap.xml');
|
|
|
|
345
|
- $product_cate_url = $this->getLinksFromSitemap($re_website . 'product_category_sitemap.xml');
|
|
|
|
346
|
- $keywords_url = $this->getLinksFromSitemap($re_website . 'product_keywords_sitemap.xml');
|
|
|
|
347
|
- $page_url = $this->getLinksFromSitemap($re_website . 'page_sitemap.xml');
|
|
|
|
348
|
- } else {
|
|
|
|
349
|
- if($form->email){
|
|
|
|
350
|
- //通过sitemap拿访问页面
|
|
|
|
351
|
- $product_url = $this->getLinksFromSitemap($re_website . 'sitemap_post.xml');
|
|
|
|
352
|
- $product_cate_url = $this->getLinksFromSitemap($re_website . 'sitemap_category.xml');
|
|
|
|
353
|
- $keywords_url = $this->getLinksFromSitemap($re_website . 'sitemap_post_tag.xml');
|
|
|
|
354
|
- $page_url = $this->getLinksFromSitemap($re_website . 'sitemap_page.xml');
|
|
|
|
355
|
- }else{
|
|
|
|
356
|
- //m站先就往contact-us着陆
|
|
|
|
357
|
- $product_url = $product_cate_url = $keywords_url = [];
|
|
|
|
358
|
- $page_url = [$re_website . 'contact-us/'];
|
341
|
+ //ip
|
|
|
|
342
|
+ $ip_data = $this->getIpData($form->country_name);
|
|
|
|
343
|
+ $ip = $ip_data->ip;
|
|
|
|
344
|
+ $country_name = $ip_data->ip_area;
|
|
|
|
345
|
+
|
|
|
|
346
|
+ //message
|
|
|
|
347
|
+ list($message, $message_id, $msg_lang) = $this->getMessage($task, $form->message, $domain);
|
|
|
|
348
|
+ $lang = $lang ?: $msg_lang;
|
|
|
|
349
|
+
|
|
|
|
350
|
+ $this->output('获取转发设备信息');
|
|
|
|
351
|
+ // 客户端 头信息 来源
|
|
|
|
352
|
+ $device_port = $form->email ? '1' : '2'; //1 pc 2移动端
|
|
|
|
353
|
+ $user_agent = $form->email ? Arr::random($this->pc_ua) : Arr::random($this->mobile_ua);
|
|
|
|
354
|
+ $referrer = $this->getReferer($country_name, $lang);
|
|
|
|
355
|
+ $this->output('写入数据');
|
|
|
|
356
|
+
|
|
|
|
357
|
+ $pre = 0;
|
|
|
|
358
|
+ $start_time = time();
|
|
|
|
359
|
+ $seconds = rand(300, 3000); // 开始时间 从5-50分钟后开始
|
|
|
|
360
|
+ $exists = ReInquiryDetail::where('re_website', $domain)->where('email', $form->email)->first();
|
|
|
|
361
|
+ if($exists){
|
|
|
|
362
|
+ $this->output('转发站点邮件已存在');
|
|
|
|
363
|
+ continue;
|
|
|
|
364
|
+ }
|
|
|
|
365
|
+ // 写入推送详情
|
|
|
|
366
|
+ $re_detail = ReInquiryDetail::createInquiry($task['id'], $form->id, $domain, $country_name, $ip, $form->full_name, $form->email, $phone, $message, $message_id, $device_port,
|
|
|
|
367
|
+ $user_agent, $referrer, $urls, $is_v6, date('Y-m-d H:i:s', $start_time + $seconds));
|
|
|
|
368
|
+ foreach ($urls as $k=>$v){
|
|
|
|
369
|
+ $pre++;
|
|
|
|
370
|
+ $seconds += rand(3,10);
|
|
|
|
371
|
+ ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_VISIT, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds));
|
|
|
|
372
|
+ // 最后一次访问询盘 加上询盘
|
|
|
|
373
|
+ if($k+1 >= count($urls)){
|
|
|
|
374
|
+ $seconds += rand(10,30);
|
|
|
|
375
|
+ $pre++;
|
|
|
|
376
|
+ ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_INQUIRY, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds));
|
|
359
|
}
|
377
|
}
|
|
360
|
}
|
378
|
}
|
|
|
|
379
|
+ }
|
|
|
|
380
|
+ return true;
|
|
|
|
381
|
+ }
|
|
361
|
|
382
|
|
|
362
|
- // 所有可用url
|
|
|
|
363
|
- $urls = $inquiry_urls = [];
|
|
|
|
364
|
- //入口url 首页30%,单页10%,聚合页60%
|
|
|
|
365
|
- $type = getRandByRatio([30,10,60]);
|
|
|
|
366
|
- $inlet = $re_website;
|
|
|
|
367
|
- $type == 1 && $inlet = $page_url ? Arr::random($page_url) : $re_website;
|
|
|
|
368
|
- $type == 2 && $inlet = $keywords_url ? Arr::random($keywords_url) : $re_website;
|
|
|
|
369
|
- $urls[] = $inquiry_urls[] = $inlet;
|
|
|
|
370
|
- $all_urls = array_merge($urls, $product_url, $product_cate_url, $keywords_url, $page_url);
|
|
|
|
371
|
- $inquiry_urls = array_merge($urls, $product_cate_url, $keywords_url, $page_url);
|
383
|
+ public function relayShopDetail($task, $form)
|
|
|
|
384
|
+ {
|
|
|
|
385
|
+ $this->output('获取商城转发对象');
|
|
372
|
|
386
|
|
|
373
|
- // 随机访问1-6个页面
|
|
|
|
374
|
- $deep = rand(1,6);
|
|
|
|
375
|
- if($deep > 2) {
|
|
|
|
376
|
- $visit_urls = Arr::random($all_urls, rand(1, count($all_urls) > 4 ? 4 : count($all_urls)));
|
|
|
|
377
|
- $urls = array_merge($urls, $visit_urls);
|
387
|
+ if(empty($task['shop_site'])){
|
|
|
|
388
|
+ $this->output('没有商城转发对象');
|
|
|
|
389
|
+ return 0;
|
|
378
|
}
|
390
|
}
|
|
379
|
- if($deep > 1) {
|
|
|
|
380
|
- // 推送着落页只能是 首页、产品分类、单页面、聚合页
|
|
|
|
381
|
- if (!in_array(end($urls), $inquiry_urls)) {
|
|
|
|
382
|
- $urls[] = Arr::random($inquiry_urls);
|
391
|
+
|
|
|
|
392
|
+ foreach ($task['shop_site'] as $item) {
|
|
|
|
393
|
+ //手机号过滤
|
|
|
|
394
|
+ $phone = $form->phone;
|
|
|
|
395
|
+ // 推送站点
|
|
|
|
396
|
+ $domain = $item;
|
|
|
|
397
|
+ $re_website = 'https://' . $domain . '/';
|
|
|
|
398
|
+ $paths = ['', 'contact-us'];
|
|
|
|
399
|
+ $url = $re_website . $paths[array_rand($paths)];
|
|
|
|
400
|
+ //ip
|
|
|
|
401
|
+ $ip_data = $this->getIpData($form->country_name);
|
|
|
|
402
|
+ $ip = $ip_data->ip;
|
|
|
|
403
|
+ $country_name = $ip_data->ip_area;
|
|
|
|
404
|
+ //message
|
|
|
|
405
|
+ list($message, $message_id, $lang) = $this->getMessage($task, $form->message, $domain);
|
|
|
|
406
|
+
|
|
|
|
407
|
+ $device_port = $form->email ? '1' : '2'; //1 pc 2移动端
|
|
|
|
408
|
+ $user_agent = $form->email ? Arr::random($this->pc_ua) : Arr::random($this->mobile_ua);
|
|
|
|
409
|
+ $referrer = $this->getReferer($country_name, $lang);
|
|
|
|
410
|
+
|
|
|
|
411
|
+ $start_time = time();
|
|
|
|
412
|
+ $seconds = rand(300, 3000); // 开始时间 从5-50分钟后开始
|
|
|
|
413
|
+ $exists = ReInquiryDetail::where('re_website', $domain)->where('email', $form->email)->first();
|
|
|
|
414
|
+ if($exists){
|
|
|
|
415
|
+ $this->output('转发站点邮件已存在');
|
|
|
|
416
|
+ continue;
|
|
|
|
417
|
+ }
|
|
|
|
418
|
+ $re_detail = ReInquiryDetail::createInquiry($task['id'], $form->id, $domain, $country_name, $ip, $form->full_name, $form->email, $phone, $message, $message_id,
|
|
|
|
419
|
+ $device_port, $user_agent, $referrer, [$url], 0, date('Y-m-d H:i:s', $start_time + $seconds), ReInquiryDetail::STATUS_INIT, 2);
|
|
|
|
420
|
+
|
|
|
|
421
|
+ ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_INQUIRY, 1, $url, date('Y-m-d H:i:s', $start_time + $seconds));
|
|
383
|
}
|
422
|
}
|
|
|
|
423
|
+ return true;
|
|
384
|
}
|
424
|
}
|
|
385
|
|
425
|
|
|
|
|
426
|
+
|
|
|
|
427
|
+ public function relayFobDetail($task, $form)
|
|
|
|
428
|
+ {
|
|
|
|
429
|
+ $this->output('获取FOB转发对象');
|
|
|
|
430
|
+
|
|
|
|
431
|
+ if(empty($task['fob_pro'])){
|
|
|
|
432
|
+ $this->output('没有FOB转发对象');
|
|
|
|
433
|
+ return 0;
|
|
|
|
434
|
+ }
|
|
|
|
435
|
+
|
|
|
|
436
|
+ foreach ($task['fob_pro'] as $item) {
|
|
|
|
437
|
+ //手机号过滤
|
|
|
|
438
|
+ $phone = $form->phone;
|
|
|
|
439
|
+ // 推送站点
|
|
|
|
440
|
+ $postid = $item;
|
|
|
|
441
|
+ //message
|
|
|
|
442
|
+ list($message, $message_id, $lang) = $this->getMessage($task, $form->message, $postid);
|
|
|
|
443
|
+
|
|
|
|
444
|
+ $device_port = $form->email ? '1' : '2'; //1 pc 2移动端
|
|
|
|
445
|
+ $user_agent = $form->email ? Arr::random($this->pc_ua) : Arr::random($this->mobile_ua);
|
|
|
|
446
|
+
|
|
|
|
447
|
+ $start_time = time();
|
|
|
|
448
|
+ $seconds = rand(300, 3000); // 开始时间 从5-50分钟后开始
|
|
|
|
449
|
+ $exists = ReInquiryDetail::where('re_website', $postid)->where('email', $form->email)->first();
|
|
|
|
450
|
+ if($exists){
|
|
|
|
451
|
+ $this->output('转发站点邮件已存在');
|
|
|
|
452
|
+ continue;
|
|
|
|
453
|
+ }
|
|
|
|
454
|
+ $re_detail = ReInquiryDetail::createInquiry($task['id'], $form->id, $postid, $country_name??'', $ip??'', $form->full_name, $form->email, $phone,
|
|
|
|
455
|
+ $message, $message_id, $device_port, $user_agent, $referrer??'', [$postid], 0, date('Y-m-d H:i:s', $start_time + $seconds), ReInquiryDetail::STATUS_INIT, 3);
|
|
|
|
456
|
+
|
|
|
|
457
|
+ ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_INQUIRY, 1, $postid, date('Y-m-d H:i:s', $start_time + $seconds));
|
|
|
|
458
|
+ }
|
|
|
|
459
|
+ return true;
|
|
|
|
460
|
+ }
|
|
|
|
461
|
+
|
|
|
|
462
|
+ public function getIpData($country_name){
|
|
386
|
$this->output('获取转发ip');
|
463
|
$this->output('获取转发ip');
|
|
387
|
- // TODO 获取IP:如果是简码,查询数据库获取对应的国家, 如果是国家使用翻译, 再转化成IP
|
|
|
|
388
|
- $country = $form->country_name;
|
464
|
+ $country = $country_name;
|
|
389
|
// 有国家 通过国家查询, 如果没有获取到就随机获取
|
465
|
// 有国家 通过国家查询, 如果没有获取到就随机获取
|
|
390
|
$where = [];
|
466
|
$where = [];
|
|
391
|
$country && $where['ip_area'] = $country;
|
467
|
$country && $where['ip_area'] = $country;
|
|
@@ -393,11 +469,12 @@ class RelayInquiry extends Command |
|
@@ -393,11 +469,12 @@ class RelayInquiry extends Command |
|
393
|
if (empty($ip_data)) {
|
469
|
if (empty($ip_data)) {
|
|
394
|
$ip_data = DB::table('gl_xunpan_ipdata')->inRandomOrder()->first();
|
470
|
$ip_data = DB::table('gl_xunpan_ipdata')->inRandomOrder()->first();
|
|
395
|
}
|
471
|
}
|
|
396
|
- $ip = $ip_data->ip;
|
|
|
|
397
|
- $country_name = $ip_data->ip_area;
|
472
|
+ return $ip_data;
|
|
|
|
473
|
+ }
|
|
398
|
|
474
|
|
|
|
|
475
|
+ public function getMessage($task, $message, $domain){
|
|
399
|
$this->output('转发内容');
|
476
|
$this->output('转发内容');
|
|
400
|
- $message = $form->message;
|
477
|
+ $form_message = $message;
|
|
401
|
$message_id = 0;
|
478
|
$message_id = 0;
|
|
402
|
//开启文案替换
|
479
|
//开启文案替换
|
|
403
|
if ($task['is_replace_text'] == 2) {
|
480
|
if ($task['is_replace_text'] == 2) {
|
|
@@ -419,7 +496,6 @@ class RelayInquiry extends Command |
|
@@ -419,7 +496,6 @@ class RelayInquiry extends Command |
|
419
|
}
|
496
|
}
|
|
420
|
if ($task['is_replace_text'] == 1 || strlen($message) <= 4) {
|
497
|
if ($task['is_replace_text'] == 1 || strlen($message) <= 4) {
|
|
421
|
//配置文案库替换或者字符少于4个,直接替换文案
|
498
|
//配置文案库替换或者字符少于4个,直接替换文案
|
|
422
|
-
|
|
|
|
423
|
$use_ids = ReInquiryDetail::where(['re_website' => $domain])->where('status', '<>', ReInquiryDetail::STATUS_FAIL)->pluck('text_id')->toArray();
|
499
|
$use_ids = ReInquiryDetail::where(['re_website' => $domain])->where('status', '<>', ReInquiryDetail::STATUS_FAIL)->pluck('text_id')->toArray();
|
|
424
|
$text = ReInquiryText::whereNotIn('id', $use_ids)->where('status', ReInquiryText::STATUS_USABLE)->inRandomOrder()->first();
|
500
|
$text = ReInquiryText::whereNotIn('id', $use_ids)->where('status', ReInquiryText::STATUS_USABLE)->inRandomOrder()->first();
|
|
425
|
$message = $text->content;
|
501
|
$message = $text->content;
|
|
@@ -429,10 +505,10 @@ class RelayInquiry extends Command |
|
@@ -429,10 +505,10 @@ class RelayInquiry extends Command |
|
429
|
$text->save();
|
505
|
$text->save();
|
|
430
|
|
506
|
|
|
431
|
//原内容非英语,转为对应语种
|
507
|
//原内容非英语,转为对应语种
|
|
432
|
- if (is_numeric($form->message)) { //数字会被识别为中文
|
508
|
+ if (is_numeric($form_message)) { //数字会被识别为中文
|
|
433
|
$lang = 'en';
|
509
|
$lang = 'en';
|
|
434
|
} else {
|
510
|
} else {
|
|
435
|
- $translateSl = Translate::translateSl($form->message);
|
511
|
+ $translateSl = Translate::translateSl($form_message);
|
|
436
|
$lang = $translateSl['texts']['sl'] ?? 'en';
|
512
|
$lang = $translateSl['texts']['sl'] ?? 'en';
|
|
437
|
}
|
513
|
}
|
|
438
|
|
514
|
|
|
@@ -440,40 +516,67 @@ class RelayInquiry extends Command |
|
@@ -440,40 +516,67 @@ class RelayInquiry extends Command |
|
440
|
$message = Translate::tran($message, $lang);
|
516
|
$message = Translate::tran($message, $lang);
|
|
441
|
}
|
517
|
}
|
|
442
|
}
|
518
|
}
|
|
|
|
519
|
+ return [$message, $message_id, $lang??''];
|
|
|
|
520
|
+ }
|
|
443
|
|
521
|
|
|
444
|
- $this->output('获取转发设备信息');
|
|
|
|
445
|
- // 客户端 头信息 来源
|
|
|
|
446
|
- $device_port = $form->email ? '1' : '2'; //1 pc 2移动端
|
|
|
|
447
|
- $user_agent = $form->email ? Arr::random($this->pc_ua) : Arr::random($this->mobile_ua);
|
|
|
|
448
|
- $referrer = $this->getReferer($country_name, $lang);
|
|
|
|
449
|
- $this->output('写入数据');
|
522
|
+ public function getUrls($is_v6, $domain, $re_website, $form, $task){
|
|
|
|
523
|
+ $this->output('转发对象:' . $domain);
|
|
|
|
524
|
+ $this->output('获取转发链接');
|
|
|
|
525
|
+ // v6:有邮箱推送主站,没有邮箱推送AMP站;v5:仅推送有邮箱到主站
|
|
|
|
526
|
+ $lang = '';
|
|
|
|
527
|
+ if ($is_v6) {
|
|
|
|
528
|
+ // 获取语种, 6.0是可以确定语种的
|
|
|
|
529
|
+ $project = Project::getProjectByDomain($domain);
|
|
|
|
530
|
+ if (empty($project)) {
|
|
|
|
531
|
+ $this->logChannel()->info('广告任务ID:' . $task['id'] . ', 转发对象:' . $re_website . '非v6链接,转发失败;', ['广告任务ID:' . $task['id'], '询盘ID:' . $form->id]);
|
|
|
|
532
|
+ return [[], $lang];
|
|
|
|
533
|
+ }
|
|
|
|
534
|
+ $lang = WebLanguage::getLangById($project->main_lang_id ?? 1)['short'];
|
|
450
|
|
535
|
|
|
451
|
- $pre = 0;
|
|
|
|
452
|
- $start_time = time();
|
|
|
|
453
|
- $seconds = rand(300, 3000); // 开始时间 从5-50分钟后开始
|
|
|
|
454
|
- $exists = ReInquiryDetail::where('re_website', $domain)->where('email', $form->email)->first();
|
|
|
|
455
|
- if($exists){
|
|
|
|
456
|
- $this->output('转发站点邮件已存在');
|
|
|
|
457
|
- continue;
|
536
|
+ // 获取访问明细和着陆页
|
|
|
|
537
|
+ $product_url = $this->getLinksFromSitemap($re_website . 'product_sitemap.xml');
|
|
|
|
538
|
+ $product_cate_url = $this->getLinksFromSitemap($re_website . 'product_category_sitemap.xml');
|
|
|
|
539
|
+ $keywords_url = $this->getLinksFromSitemap($re_website . 'product_keywords_sitemap.xml');
|
|
|
|
540
|
+ $page_url = $this->getLinksFromSitemap($re_website . 'page_sitemap.xml');
|
|
|
|
541
|
+ } else {
|
|
|
|
542
|
+ if($form->email){
|
|
|
|
543
|
+ //通过sitemap拿访问页面
|
|
|
|
544
|
+ $product_url = $this->getLinksFromSitemap($re_website . 'sitemap_post.xml');
|
|
|
|
545
|
+ $product_cate_url = $this->getLinksFromSitemap($re_website . 'sitemap_category.xml');
|
|
|
|
546
|
+ $keywords_url = $this->getLinksFromSitemap($re_website . 'sitemap_post_tag.xml');
|
|
|
|
547
|
+ $page_url = $this->getLinksFromSitemap($re_website . 'sitemap_page.xml');
|
|
|
|
548
|
+ }else{
|
|
|
|
549
|
+ //m站先就往contact-us着陆
|
|
|
|
550
|
+ $product_url = $product_cate_url = $keywords_url = [];
|
|
|
|
551
|
+ $page_url = [$re_website . 'contact-us/'];
|
|
458
|
}
|
552
|
}
|
|
459
|
- // 写入推送详情
|
|
|
|
460
|
- $re_detail = ReInquiryDetail::createInquiry($task['id'], $form->id, $domain, $country_name, $ip, $form->full_name, $form->email, $phone, $message, $message_id, $device_port,
|
|
|
|
461
|
- $user_agent, $referrer, $urls, $is_v6, date('Y-m-d H:i:s', $start_time + $seconds));
|
|
|
|
462
|
- foreach ($urls as $k=>$v){
|
|
|
|
463
|
- $pre++;
|
|
|
|
464
|
- $seconds += rand(3,10);
|
|
|
|
465
|
- ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_VISIT, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds));
|
|
|
|
466
|
- // 最后一次访问询盘 加上询盘
|
|
|
|
467
|
- if($k+1 >= count($urls)){
|
|
|
|
468
|
- $seconds += rand(10,30);
|
|
|
|
469
|
- $pre++;
|
|
|
|
470
|
- ReInquiryDetailLog::createInquiryLog($re_detail->id, ReInquiryDetailLog::TYPE_INQUIRY, $pre, $v, date('Y-m-d H:i:s', $start_time + $seconds));
|
|
|
|
471
|
}
|
553
|
}
|
|
|
|
554
|
+
|
|
|
|
555
|
+ // 所有可用url
|
|
|
|
556
|
+ $urls = $inquiry_urls = [];
|
|
|
|
557
|
+ //入口url 首页30%,单页10%,聚合页60%
|
|
|
|
558
|
+ $type = getRandByRatio([30,10,60]);
|
|
|
|
559
|
+ $inlet = $re_website;
|
|
|
|
560
|
+ $type == 1 && $inlet = $page_url ? Arr::random($page_url) : $re_website;
|
|
|
|
561
|
+ $type == 2 && $inlet = $keywords_url ? Arr::random($keywords_url) : $re_website;
|
|
|
|
562
|
+ $urls[] = $inquiry_urls[] = $inlet;
|
|
|
|
563
|
+ $all_urls = array_merge($urls, $product_url, $product_cate_url, $keywords_url, $page_url);
|
|
|
|
564
|
+ $inquiry_urls = array_merge($urls, $product_cate_url, $keywords_url, $page_url);
|
|
|
|
565
|
+
|
|
|
|
566
|
+ // 随机访问1-6个页面
|
|
|
|
567
|
+ $deep = rand(1,6);
|
|
|
|
568
|
+ if($deep > 2) {
|
|
|
|
569
|
+ $visit_urls = Arr::random($all_urls, rand(1, count($all_urls) > 4 ? 4 : count($all_urls)));
|
|
|
|
570
|
+ $urls = array_merge($urls, $visit_urls);
|
|
|
|
571
|
+ }
|
|
|
|
572
|
+ if($deep > 1) {
|
|
|
|
573
|
+ // 推送着落页只能是 首页、产品分类、单页面、聚合页
|
|
|
|
574
|
+ if (!in_array(end($urls), $inquiry_urls)) {
|
|
|
|
575
|
+ $urls[] = Arr::random($inquiry_urls);
|
|
472
|
}
|
576
|
}
|
|
473
|
}
|
577
|
}
|
|
474
|
- return true;
|
578
|
+ return [$urls, $lang];
|
|
475
|
}
|
579
|
}
|
|
476
|
-
|
|
|
|
477
|
/**
|
580
|
/**
|
|
478
|
* 获取待处理询盘表单
|
581
|
* 获取待处理询盘表单
|
|
479
|
* @param int $num
|
582
|
* @param int $num
|
|
@@ -494,7 +597,7 @@ class RelayInquiry extends Command |
|
@@ -494,7 +597,7 @@ class RelayInquiry extends Command |
|
494
|
{
|
597
|
{
|
|
495
|
$cache_key = 'inquiry_ads_tasks';
|
598
|
$cache_key = 'inquiry_ads_tasks';
|
|
496
|
$ads = Cache::get($cache_key, function () use ($cache_key) {
|
599
|
$ads = Cache::get($cache_key, function () use ($cache_key) {
|
|
497
|
- $ads = ReInquiryTask::where(['status' => ReInquiryTask::STATUS_OPEN])->get(['id', 'ad_id', 'num', 'target', 'is_replace_text', 'ai_param']);
|
600
|
+ $ads = ReInquiryTask::where(['status' => ReInquiryTask::STATUS_OPEN])->get(['id', 'ad_id', 'num', 'target', 'is_replace_text', 'ai_param', 'shop_site', 'fob_pro']);
|
|
498
|
$array = [];
|
601
|
$array = [];
|
|
499
|
foreach ($ads as $key=>$val) {
|
602
|
foreach ($ads as $key=>$val) {
|
|
500
|
$ad_ids = explode(',', $val['ad_id']);
|
603
|
$ad_ids = explode(',', $val['ad_id']);
|