|
@@ -4,6 +4,7 @@ |
|
@@ -4,6 +4,7 @@ |
|
4
|
namespace App\Services;
|
4
|
namespace App\Services;
|
|
5
|
|
5
|
|
|
6
|
use App\Exceptions\InquiryFilterException;
|
6
|
use App\Exceptions\InquiryFilterException;
|
|
|
|
7
|
+use App\Models\Com\WordCountry;
|
|
7
|
use App\Models\Domain\CountryCode;
|
8
|
use App\Models\Domain\CountryCode;
|
|
8
|
use App\Models\Domain\DomainInfo;
|
9
|
use App\Models\Domain\DomainInfo;
|
|
9
|
use App\Models\Inquiry\InquiryForm;
|
10
|
use App\Models\Inquiry\InquiryForm;
|
|
@@ -15,6 +16,7 @@ use App\Models\Project\Project; |
|
@@ -15,6 +16,7 @@ use App\Models\Project\Project; |
|
15
|
use App\Models\Subscribe\Email;
|
16
|
use App\Models\Subscribe\Email;
|
|
16
|
use App\Models\SyncSubmitTask\SyncSubmitTask;
|
17
|
use App\Models\SyncSubmitTask\SyncSubmitTask;
|
|
17
|
use App\Models\Visit\Visit;
|
18
|
use App\Models\Visit\Visit;
|
|
|
|
19
|
+use App\Models\WebSetting\WebLanguage;
|
|
18
|
use App\Models\Workchat\MessagePush;
|
20
|
use App\Models\Workchat\MessagePush;
|
|
19
|
use App\Utils\LogUtils;
|
21
|
use App\Utils\LogUtils;
|
|
20
|
use Illuminate\Support\Facades\Cache;
|
22
|
use Illuminate\Support\Facades\Cache;
|
|
@@ -74,7 +76,24 @@ class SyncSubmitTaskService |
|
@@ -74,7 +76,24 @@ class SyncSubmitTaskService |
|
74
|
}
|
76
|
}
|
|
75
|
}
|
77
|
}
|
|
76
|
}
|
78
|
}
|
|
77
|
-
|
79
|
+ //$data['data']['referrer_url']为空 && 访问小语种 && 访问国家和IP所在国家不匹配 不记录数据
|
|
|
|
80
|
+ //$data['data']['referrer_url']为空 && 任何小语种 美国都不记
|
|
|
|
81
|
+ if (empty($data['data']['referrer_url']) && $task['type'] == 'visit') {
|
|
|
|
82
|
+ $tran_visit = '';
|
|
|
|
83
|
+ //是否是小语种 二级域名或二级目录
|
|
|
|
84
|
+ $langs = WebLanguage::getShorts();
|
|
|
|
85
|
+ foreach ($langs as $lang){
|
|
|
|
86
|
+ if(Str::contains($data['data']['url'], [$lang . '.' .$data['domain'], $data['domain'] . '/' . $lang. '/'])){
|
|
|
|
87
|
+ $tran_visit = $lang;
|
|
|
|
88
|
+ break;
|
|
|
|
89
|
+ }
|
|
|
|
90
|
+ }
|
|
|
|
91
|
+ //直接根据 语种缩写 去匹配 国家简码 不搞麻烦了,将就用
|
|
|
|
92
|
+ $tran_country = WordCountry::getCountryByIso2($tran_visit)['chinese_name'] ?? '';
|
|
|
|
93
|
+ if ($tran_visit !='en' && ($checkIpCountry['country'] == '美国' || $tran_country != $checkIpCountry['country'])) {
|
|
|
|
94
|
+ throw new InquiryFilterException( '判定为蜘蛛爬取小语种');
|
|
|
|
95
|
+ }
|
|
|
|
96
|
+ }
|
|
78
|
//域名 过滤国家或ip
|
97
|
//域名 过滤国家或ip
|
|
79
|
$domain_info = DomainInfo::getCacheInfoByProjectId($project['id']);
|
98
|
$domain_info = DomainInfo::getCacheInfoByProjectId($project['id']);
|
|
80
|
if(!empty($domain_info['not_allow_country'])){
|
99
|
if(!empty($domain_info['not_allow_country'])){
|