作者 lyh

Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into master-server

@@ -54,13 +54,16 @@ class QuanqiusouApi @@ -54,13 +54,16 @@ class QuanqiusouApi
54 * @author zbj 54 * @author zbj
55 * @date 2023/5/11 55 * @date 2023/5/11
56 */ 56 */
57 - public function getSiteResPer($api_no){ 57 + public function getSiteResPer($api_no, $is_ext = 0, $copy_domain = ''){
58 // $key = 'quanqiusou_api_site_res_per_' . $api_no . '_' . date('Y-m-d'); 58 // $key = 'quanqiusou_api_site_res_per_' . $api_no . '_' . date('Y-m-d');
59 // $res = Cache::get($key); 59 // $res = Cache::get($key);
60 // if (!$res) { 60 // if (!$res) {
61 $api_url = $this->url . '/google-rank/echo_site_res_per.php'; 61 $api_url = $this->url . '/google-rank/echo_site_res_per.php';
62 try { 62 try {
63 - $res = HttpUtils::get($api_url, ['apino' => $api_no]); 63 + $param = ['apino' => $api_no];
  64 + $is_ext && $param['is_ext'] = $is_ext;
  65 + $copy_domain && $param['domain'] = $copy_domain;
  66 + $res = HttpUtils::get($api_url, $param);
64 if($res){ 67 if($res){
65 $res = Arr::s2a($res); 68 $res = Arr::s2a($res);
66 // Cache::put($key, $res, 2 * 3600); 69 // Cache::put($key, $res, 2 * 3600);
@@ -73,6 +76,26 @@ class QuanqiusouApi @@ -73,6 +76,26 @@ class QuanqiusouApi
73 return $res; 76 return $res;
74 } 77 }
75 78
  79 + /**
  80 + * 复制站点
  81 + * @return array|false|mixed
  82 + * @author zbj
  83 + * @date 2023/5/11
  84 + */
  85 + public function getSiteNumList(){
  86 + $api_url = $this->url . '/google-rank/ext_sitenum_list.php';
  87 + try {
  88 + $res = HttpUtils::get($api_url, []);
  89 + if($res){
  90 + $res = Arr::s2a($res);
  91 + }
  92 + } catch (\Exception | GuzzleException $e) {
  93 + errorLog('获取复制站点收录页面数', [], $e);
  94 + return [];
  95 + }
  96 + return array_column($res, 'url');
  97 + }
  98 +
76 99
77 /** 100 /**
78 * 获取谷歌排名数据 101 * 获取谷歌排名数据
@@ -42,7 +42,7 @@ class PrivateController extends BaseController @@ -42,7 +42,7 @@ class PrivateController extends BaseController
42 public function optimizeProjectList(Request $request) 42 public function optimizeProjectList(Request $request)
43 { 43 {
44 $page_size = $request->input('page_size', 20); 44 $page_size = $request->input('page_size', 20);
45 - $field = ['gl_project.id', 'gl_project.company', 'gl_project.is_upgrade', 'b.start_date', 'd.domain']; 45 + $field = ['gl_project.id', 'gl_project.company', 'gl_project.is_upgrade', 'b.start_date', 'd.domain', 'b.special'];
46 $result = Project::select($field)->leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id') 46 $result = Project::select($field)->leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id')
47 ->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id') 47 ->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id')
48 ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id') 48 ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id')
@@ -9,6 +9,7 @@ use App\Models\Domain\DomainCreateTask; @@ -9,6 +9,7 @@ use App\Models\Domain\DomainCreateTask;
9 use App\Models\Domain\DomainInfo; 9 use App\Models\Domain\DomainInfo;
10 use App\Models\Domain\DomainRedirectTask; 10 use App\Models\Domain\DomainRedirectTask;
11 use App\Models\Project\CountryCustom; 11 use App\Models\Project\CountryCustom;
  12 +use App\Models\Project\DeployBuild;
12 use App\Models\Project\Project; 13 use App\Models\Project\Project;
13 14
14 class DomainInfoLogic extends BaseLogic 15 class DomainInfoLogic extends BaseLogic
@@ -169,7 +170,7 @@ class DomainInfoLogic extends BaseLogic @@ -169,7 +170,7 @@ class DomainInfoLogic extends BaseLogic
169 } 170 }
170 if($serversIpInfo['servers_id'] == ServerConfig::SELF_SITE_ID){ 171 if($serversIpInfo['servers_id'] == ServerConfig::SELF_SITE_ID){
171 $this->model->edit(['amp_status' => $this->param['amp_status'] ?? 0],['id'=>$this->param['id']]); 172 $this->model->edit(['amp_status' => $this->param['amp_status'] ?? 0],['id'=>$this->param['id']]);
172 - $this->fail('自建站服务器无生成站点'); 173 + $this->fail('自建站服务器无生成站点');
173 } 174 }
174 //域名是否都已经解析 175 //域名是否都已经解析
175 if(!check_domain_record($info['domain'], $serversIpInfo)){ 176 if(!check_domain_record($info['domain'], $serversIpInfo)){
@@ -242,6 +243,14 @@ class DomainInfoLogic extends BaseLogic @@ -242,6 +243,14 @@ class DomainInfoLogic extends BaseLogic
242 } 243 }
243 } 244 }
244 245
  246 + //小语种为二级目录的站点,强制跳转https
  247 + $is_https = 0;
  248 + $buildModel = new DeployBuild();
  249 + $build_info = $buildModel->read(['project_id' => $info['project_id']], ['linking_format']);
  250 + if ($build_info && $build_info['linking_format'] == 1) {
  251 + $is_https = 1;
  252 + }
  253 +
245 //保存301跳转数据+其他域名 254 //保存301跳转数据+其他域名
246 $data = [ 255 $data = [
247 'other_domain'=>json_encode(array_filter($this->param['other_domain'] ?? [])), 256 'other_domain'=>json_encode(array_filter($this->param['other_domain'] ?? [])),
@@ -249,7 +258,7 @@ class DomainInfoLogic extends BaseLogic @@ -249,7 +258,7 @@ class DomainInfoLogic extends BaseLogic
249 'type'=>$this->param['type'], 258 'type'=>$this->param['type'],
250 'private_key' => $this->param['key'] ?? '', 259 'private_key' => $this->param['key'] ?? '',
251 'private_cert' => $this->param['cert'] ?? '', 260 'private_cert' => $this->param['cert'] ?? '',
252 - 'is_https' => $this->param['is_https'] ?? 0, 261 + 'is_https' => $is_https,
253 'amp_status' => $this->param['amp_status'] ?? 0, 262 'amp_status' => $this->param['amp_status'] ?? 0,
254 'amp_type' => $this->param['amp_type'] ?? 0, 263 'amp_type' => $this->param['amp_type'] ?? 0,
255 'amp_extend_config'=>json_encode($amp_extend_config), 264 'amp_extend_config'=>json_encode($amp_extend_config),
@@ -28,6 +28,7 @@ use App\Models\RankData\Speed; @@ -28,6 +28,7 @@ use App\Models\RankData\Speed;
28 use App\Models\RankData\Speed as GoogleSpeedModel; 28 use App\Models\RankData\Speed as GoogleSpeedModel;
29 use App\Utils\HttpUtils; 29 use App\Utils\HttpUtils;
30 use GuzzleHttp\Exception\GuzzleException; 30 use GuzzleHttp\Exception\GuzzleException;
  31 +use Illuminate\Database\Eloquent\Model;
31 use Illuminate\Support\Collection; 32 use Illuminate\Support\Collection;
32 use Illuminate\Support\Facades\Cache; 33 use Illuminate\Support\Facades\Cache;
33 use Illuminate\Support\Facades\Log; 34 use Illuminate\Support\Facades\Log;
@@ -819,8 +820,19 @@ class RankDataLogic extends BaseLogic @@ -819,8 +820,19 @@ class RankDataLogic extends BaseLogic
819 if(!$model){ 820 if(!$model){
820 $model = new IndexedPagesModel(); 821 $model = new IndexedPagesModel();
821 } 822 }
  823 + $is_ext = 0;
  824 + $copy_domain = '';
822 $api = new QuanqiusouApi(); 825 $api = new QuanqiusouApi();
823 - $res = $api->getSiteResPer($api_no); 826 + //复制站 域名在这个http://api.quanqiusou.cn/google-rank/ext_sitenum_list.php里面 就用这个接口的数据
  827 + $domain = (new DomainInfo())->getDomain($domain);
  828 + $host = parse_url($domain, PHP_URL_HOST);
  829 + $host=str_replace('www.', '', $host);
  830 + $copy_site_list = $api->getSiteNumList();
  831 + if(in_array($host, $copy_site_list)){
  832 + $copy_domain = $host;
  833 + $is_ext = 1;
  834 + }
  835 + $res = $api->getSiteResPer($api_no, $is_ext, $copy_domain);
824 if(!$res){ 836 if(!$res){
825 Log::channel('rank_data')->error('syncIndexedPages:收录数数据为空', ['project_id' => $project_id, 'api_no' => $api_no]); 837 Log::channel('rank_data')->error('syncIndexedPages:收录数数据为空', ['project_id' => $project_id, 'api_no' => $api_no]);
826 continue; 838 continue;
@@ -120,7 +120,8 @@ class Project extends Base @@ -120,7 +120,8 @@ class Project extends Base
120 13 => 'AI站群', 120 13 => 'AI站群',
121 14 => '未达标', 121 14 => '未达标',
122 15 => 'AI案例', 122 15 => 'AI案例',
123 - 16 => '6.0广告' 123 + 16 => '6.0广告',
  124 + 17 => '超哥监控项目',
124 ]; 125 ];
125 } 126 }
126 127