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