作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

@@ -996,14 +996,16 @@ class RelayInquiry extends Command @@ -996,14 +996,16 @@ class RelayInquiry extends Command
996 //按概率 996 //按概率
997 $res = $this->get_rand([$task->second_push_rate, 100 - $task->second_push_rate]); 997 $res = $this->get_rand([$task->second_push_rate, 100 - $task->second_push_rate]);
998 if($res == 1){ 998 if($res == 1){
999 - $this->output('非广告投放日第一封询盘 概率' . (100 - $task->second_push_rate) . '%延迟推送');  
1000 //随机分配到未投放广告日期 999 //随机分配到未投放广告日期
1001 $now = Carbon::now(); 1000 $now = Carbon::now();
1002 // 随机开始时间(本周四或现在) 1001 // 随机开始时间(本周四或现在)
1003 $startTime = max($now->timestamp, $now->startOfWeek(4)->timestamp); 1002 $startTime = max($now->timestamp, $now->startOfWeek(4)->timestamp);
1004 1003
1005 $random = mt_rand($startTime, $now->endOfWeek()->timestamp); 1004 $random = mt_rand($startTime, $now->endOfWeek()->timestamp);
1006 - return $random - $now->timestamp; 1005 +
  1006 + $delay = $random - time();
  1007 + $this->output('非广告投放日第一封询盘 概率' . (100 - $task->second_push_rate) . '%延迟推送' . $delay);
  1008 + return $delay;
1007 } 1009 }
1008 } 1010 }
1009 } 1011 }
@@ -127,4 +127,21 @@ class GeoLinkController extends BaseController @@ -127,4 +127,21 @@ class GeoLinkController extends BaseController
127 } 127 }
128 $this->response('success',Code::SUCCESS,$data); 128 $this->response('success',Code::SUCCESS,$data);
129 } 129 }
  130 +
  131 + /**
  132 + * @remark :执行da值返回数据
  133 + * @name :daResultData
  134 + * @author :lyh
  135 + * @method :post
  136 + * @time :2025/10/9 09:39
  137 + */
  138 + public function daResultData(){
  139 + $this->request->validate([
  140 + 'id'=>'required',
  141 + ],[
  142 + 'id.required' => 'ID不能为空',
  143 + ]);
  144 + $data = $this->logic->daResultData();
  145 + $this->response('success',Code::SUCCESS,$data);
  146 + }
130 } 147 }
@@ -109,6 +109,7 @@ class ProjectController extends BaseController @@ -109,6 +109,7 @@ class ProjectController extends BaseController
109 'gl_project_deploy_build.dept_id AS dept_id', 109 'gl_project_deploy_build.dept_id AS dept_id',
110 'gl_project_deploy_build.keyword_num AS key', 110 'gl_project_deploy_build.keyword_num AS key',
111 'gl_project_deploy_build.service_duration AS day', 111 'gl_project_deploy_build.service_duration AS day',
  112 + 'gl_project_deploy_build.seo_service_duration AS seo_day',
112 'gl_project_deploy_build.is_comment AS is_comment', 113 'gl_project_deploy_build.is_comment AS is_comment',
113 'gl_project_deploy_build.leader_mid AS leader_mid', 114 'gl_project_deploy_build.leader_mid AS leader_mid',
114 'gl_project_deploy_build.manager_mid AS manager_mid', 115 'gl_project_deploy_build.manager_mid AS manager_mid',
@@ -845,6 +846,9 @@ class ProjectController extends BaseController @@ -845,6 +846,9 @@ class ProjectController extends BaseController
845 $domain_array = parse_url($domain_pro ? $domain_pro->domain : ''); 846 $domain_array = parse_url($domain_pro ? $domain_pro->domain : '');
846 $domain = $domain_array['host'] ?? $domain_array['path']; 847 $domain = $domain_array['host'] ?? $domain_array['path'];
847 } 848 }
  849 + $item['channel']['channel'] = Channel::where('id', $item['channel']['channel_id'])->value('title');
  850 + $item['channel']['zone'] = Zone::where('id', $item['channel']['zone_id'])->value('title');
  851 + $item['channel']['user'] = User::where('id', $item['channel']['user_id'])->value('name');
848 $manageHr = new ManageHr(); 852 $manageHr = new ManageHr();
849 $param = [ 853 $param = [
850 "id" => $item['id'], 854 "id" => $item['id'],
@@ -79,4 +79,21 @@ class LinkDataController extends BaseController @@ -79,4 +79,21 @@ class LinkDataController extends BaseController
79 $result = $linkData->del(['id'=>['in',$this->param['id']]]); 79 $result = $linkData->del(['id'=>['in',$this->param['id']]]);
80 $this->response('success',Code::SUCCESS,$result); 80 $this->response('success',Code::SUCCESS,$result);
81 } 81 }
  82 +
  83 + /**
  84 + * @remark :执行da值返回数据
  85 + * @name :daResultData
  86 + * @author :lyh
  87 + * @method :post
  88 + * @time :2025/10/9 09:39
  89 + */
  90 + public function daResultData(LinkDataLogic $logic){
  91 + $this->request->validate([
  92 + 'id'=>'required',
  93 + ],[
  94 + 'id.required' => 'ID不能为空',
  95 + ]);
  96 + $data = $logic->daResultData();
  97 + $this->response('success',Code::SUCCESS,$data);
  98 + }
82 } 99 }
@@ -11,6 +11,7 @@ namespace App\Http\Logic\Aside\Geo; @@ -11,6 +11,7 @@ namespace App\Http\Logic\Aside\Geo;
11 11
12 use App\Http\Logic\Aside\BaseLogic; 12 use App\Http\Logic\Aside\BaseLogic;
13 use App\Models\Geo\GeoLink; 13 use App\Models\Geo\GeoLink;
  14 +use App\Services\Geo\GeoService;
14 15
15 /** 16 /**
16 * @remark :geo权威新闻(链接数据) 17 * @remark :geo权威新闻(链接数据)
@@ -101,4 +102,64 @@ class GeoLinkLogic extends BaseLogic @@ -101,4 +102,64 @@ class GeoLinkLogic extends BaseLogic
101 } 102 }
102 return $this->success(); 103 return $this->success();
103 } 104 }
  105 +
  106 + /**
  107 + * @remark :返回数据data
  108 + * @name :daResultData
  109 + * @author :lyh
  110 + * @method :post
  111 + * @time :2025/10/9 09:43
  112 + */
  113 + public function daResultData()
  114 + {
  115 + $info = $this->model->read(['id'=>$this->param['id']]);
  116 + if($info === false){
  117 + $this->fail('当前数据不存在或者已被删除');
  118 + }
  119 + $geoService = new GeoService();
  120 + if(!empty($info['time'])){
  121 + $date1 = new DateTime($info['time']);
  122 + $date2 = new DateTime(date('Y-m-d'));
  123 + $diff = $date1->diff($date2);
  124 + if($diff >= 60){
  125 + $host = $this->getDomainWithWWW($info['url']);
  126 + $result = $geoService->daResult($host);
  127 + }else{
  128 + return $this->success($info);
  129 + }
  130 + }else{
  131 + $host = $this->getDomainWithWWW($info['url']);
  132 + $result = $geoService->daResult($host);
  133 + }
  134 + if(!isset($result['data']) || empty($result['data'])){
  135 + $this->model->edit(['time'=>date('Y-m-d')], ['id'=>$info['id']]);
  136 + return $this->success($info);
  137 + }
  138 + $info['da'] = (int)$result['data']['mozDA'];//获取数据中的da值
  139 + $this->model->edit(['time'=>date('Y-m-d'),'da'=>$info['da']], ['id'=>$info['id']]);
  140 + return $this->success($result);
  141 + }
  142 +
  143 + /**
  144 + * @remark :获取域名
  145 + * @name :getDomainWithWWW
  146 + * @author :lyh
  147 + * @method :post
  148 + * @time :2025/10/9 10:28
  149 + */
  150 + public function getDomainWithWWW($url) {
  151 + // 获取 host
  152 + $host = parse_url($url, PHP_URL_HOST);
  153 + // 去掉端口号等情况
  154 + $host = preg_replace('/:\d+$/', '', $host);
  155 + // 分割域名
  156 + $parts = explode('.', $host);
  157 + // 判断是几段
  158 + $count = count($parts);
  159 + // 如果只有两段,比如 fox8.com、theamericawatch.com,就拼接 www.
  160 + if ($count === 2) {
  161 + return 'www.' . $host;
  162 + }
  163 + return $host;
  164 + }
104 } 165 }
@@ -11,6 +11,7 @@ namespace App\Http\Logic\Bside\SeoSetting; @@ -11,6 +11,7 @@ namespace App\Http\Logic\Bside\SeoSetting;
11 11
12 use App\Http\Logic\Bside\BaseLogic; 12 use App\Http\Logic\Bside\BaseLogic;
13 use App\Models\SeoSetting\LinkData; 13 use App\Models\SeoSetting\LinkData;
  14 +use App\Services\Geo\GeoService;
14 15
15 /** 16 /**
16 * @remark :获取外链数据 17 * @remark :获取外链数据
@@ -50,4 +51,64 @@ class LinkDataLogic extends BaseLogic @@ -50,4 +51,64 @@ class LinkDataLogic extends BaseLogic
50 } 51 }
51 return $this->success(); 52 return $this->success();
52 } 53 }
  54 +
  55 + /**
  56 + * @remark :返回数据data
  57 + * @name :daResultData
  58 + * @author :lyh
  59 + * @method :post
  60 + * @time :2025/10/9 09:43
  61 + */
  62 + public function daResultData()
  63 + {
  64 + $info = $this->model->read(['id'=>$this->param['id']]);
  65 + if($info === false){
  66 + $this->fail('当前数据不存在或者已被删除');
  67 + }
  68 + $geoService = new GeoService();
  69 + if(!empty($info['time'])){
  70 + $date1 = new DateTime($info['time']);
  71 + $date2 = new DateTime(date('Y-m-d'));
  72 + $diff = $date1->diff($date2);
  73 + if($diff >= 60){
  74 + $host = $this->getDomainWithWWW($info['da_values']);
  75 + $result = $geoService->daResult($host);
  76 + }else{
  77 + return $this->success($info);
  78 + }
  79 + }else{
  80 + $host = $this->getDomainWithWWW($info['da_values']);
  81 + $result = $geoService->daResult($host);
  82 + }
  83 + if(!isset($result['data']) || empty($result['data'])){
  84 + $this->model->edit(['time'=>date('Y-m-d')], ['id'=>$info['id']]);
  85 + return $this->success($info);
  86 + }
  87 + $info['da_values'] = (int)$result['data']['mozDA'];//获取数据中的da值
  88 + $this->model->edit(['time'=>date('Y-m-d'),'da_values'=>$info['da_values']], ['id'=>$info['id']]);
  89 + return $this->success($result);
  90 + }
  91 +
  92 + /**
  93 + * @remark :获取域名
  94 + * @name :getDomainWithWWW
  95 + * @author :lyh
  96 + * @method :post
  97 + * @time :2025/10/9 10:28
  98 + */
  99 + public function getDomainWithWWW($url) {
  100 + // 获取 host
  101 + $host = parse_url($url, PHP_URL_HOST);
  102 + // 去掉端口号等情况
  103 + $host = preg_replace('/:\d+$/', '', $host);
  104 + // 分割域名
  105 + $parts = explode('.', $host);
  106 + // 判断是几段
  107 + $count = count($parts);
  108 + // 如果只有两段,比如 fox8.com、theamericawatch.com,就拼接 www.
  109 + if ($count === 2) {
  110 + return 'www.' . $host;
  111 + }
  112 + return $host;
  113 + }
53 } 114 }
@@ -137,4 +137,18 @@ class GeoService @@ -137,4 +137,18 @@ class GeoService
137 $result = Http::post($url, $param); 137 $result = Http::post($url, $param);
138 return $result->json(); 138 return $result->json();
139 } 139 }
  140 +
  141 + /**
  142 + * @remark :根据域名获取da值
  143 + * @name :daResult
  144 + * @author :lyh
  145 + * @method :post
  146 + * @time :2025/10/9 09:33
  147 + */
  148 + public function daResult($domain)
  149 + {
  150 + $url = 'https://www.cmer.site/api/get_domain_da?domain='.$domain;
  151 + $result = http_get($url);
  152 + return $result;
  153 + }
140 } 154 }
@@ -450,6 +450,21 @@ class SyncSubmitTaskService @@ -450,6 +450,21 @@ class SyncSubmitTaskService
450 if(empty($data['referer']) || empty($data['user_agent']) || empty($data['data'])){ 450 if(empty($data['referer']) || empty($data['user_agent']) || empty($data['data'])){
451 throw new InquiryFilterException( '数据异常:' . $data['country']); 451 throw new InquiryFilterException( '数据异常:' . $data['country']);
452 } 452 }
  453 +
  454 + //关杰 全局过滤 满足 name、message 8-16 纯字母不含空格 ip 荷兰 mobile 10位纯数字 过滤
  455 + if(
  456 + strlen($data['data']['name']) <= 16 && strlen($data['data']['name']) >= 8 &&
  457 + strlen($data['data']['message']) <= 16 && strlen($data['data']['message']) >= 8 &&
  458 + preg_match('/^[a-zA-Z]+$/', $data['data']['name']) &&
  459 + preg_match('/^[a-zA-Z]+$/', $data['data']['message']) &&
  460 + preg_match('/^\d+$/', $data['data']['phone']) &&
  461 + strlen($data['data']['phone']) == 10 &&
  462 + in_array($data['country'], ['荷兰', '俄罗斯'])
  463 + ){
  464 + throw new InquiryFilterException( '全局过滤');
  465 + }
  466 +
  467 +
453 $config = InquiryFilterConfig::getCacheInfoByProjectId($project_id); 468 $config = InquiryFilterConfig::getCacheInfoByProjectId($project_id);
454 //没配置 则默认开启且使用全局 469 //没配置 则默认开启且使用全局
455 if(!$config){ 470 if(!$config){
@@ -583,6 +583,7 @@ Route::middleware(['aloginauth'])->group(function () { @@ -583,6 +583,7 @@ Route::middleware(['aloginauth'])->group(function () {
583 Route::any('/info', [Aside\Geo\GeoLinkController::class, 'info'])->name('admin.geo_link_info'); 583 Route::any('/info', [Aside\Geo\GeoLinkController::class, 'info'])->name('admin.geo_link_info');
584 Route::any('/del', [Aside\Geo\GeoLinkController::class, 'del'])->name('admin.geo_link_del'); 584 Route::any('/del', [Aside\Geo\GeoLinkController::class, 'del'])->name('admin.geo_link_del');
585 Route::any('/downloadGeoLink', [Aside\Geo\GeoLinkController::class, 'downloadGeoLink'])->name('admin.geo_link_downloadGeoLink'); 585 Route::any('/downloadGeoLink', [Aside\Geo\GeoLinkController::class, 'downloadGeoLink'])->name('admin.geo_link_downloadGeoLink');
  586 + Route::any('/daResultData', [Aside\Geo\GeoLinkController::class, 'daResultData'])->name('admin.geo_link_daResultData');
586 }); 587 });
587 }); 588 });
588 // 任务相关 589 // 任务相关
@@ -715,6 +715,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -715,6 +715,7 @@ Route::middleware(['bloginauth'])->group(function () {
715 Route::any('/batchSave', [\App\Http\Controllers\Bside\SeoSetting\LinkDataController::class, 'batchSave'])->name('link_data_batchSave'); 715 Route::any('/batchSave', [\App\Http\Controllers\Bside\SeoSetting\LinkDataController::class, 'batchSave'])->name('link_data_batchSave');
716 Route::any('/info', [\App\Http\Controllers\Bside\SeoSetting\LinkDataController::class, 'info'])->name('link_data_info'); 716 Route::any('/info', [\App\Http\Controllers\Bside\SeoSetting\LinkDataController::class, 'info'])->name('link_data_info');
717 Route::any('/del', [\App\Http\Controllers\Bside\SeoSetting\LinkDataController::class, 'del'])->name('link_data_del'); 717 Route::any('/del', [\App\Http\Controllers\Bside\SeoSetting\LinkDataController::class, 'del'])->name('link_data_del');
  718 + Route::any('/daResultData', [\App\Http\Controllers\Bside\SeoSetting\LinkDataController::class, 'daResultData'])->name('link_data_daResultData');
718 }); 719 });
719 720
720 //seo白帽 域名设置 721 //seo白帽 域名设置