作者 lyh

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

... ... @@ -54,13 +54,16 @@ class QuanqiusouApi
* @author zbj
* @date 2023/5/11
*/
public function getSiteResPer($api_no){
public function getSiteResPer($api_no, $is_ext = 0, $copy_domain = ''){
// $key = 'quanqiusou_api_site_res_per_' . $api_no . '_' . date('Y-m-d');
// $res = Cache::get($key);
// if (!$res) {
$api_url = $this->url . '/google-rank/echo_site_res_per.php';
try {
$res = HttpUtils::get($api_url, ['apino' => $api_no]);
$param = ['apino' => $api_no];
$is_ext && $param['is_ext'] = $is_ext;
$copy_domain && $param['domain'] = $copy_domain;
$res = HttpUtils::get($api_url, $param);
if($res){
$res = Arr::s2a($res);
// Cache::put($key, $res, 2 * 3600);
... ... @@ -73,6 +76,26 @@ class QuanqiusouApi
return $res;
}
/**
* 复制站点
* @return array|false|mixed
* @author zbj
* @date 2023/5/11
*/
public function getSiteNumList(){
$api_url = $this->url . '/google-rank/ext_sitenum_list.php';
try {
$res = HttpUtils::get($api_url, []);
if($res){
$res = Arr::s2a($res);
}
} catch (\Exception | GuzzleException $e) {
errorLog('获取复制站点收录页面数', [], $e);
return [];
}
return array_column($res, 'url');
}
/**
* 获取谷歌排名数据
... ...
... ... @@ -42,7 +42,7 @@ class PrivateController extends BaseController
public function optimizeProjectList(Request $request)
{
$page_size = $request->input('page_size', 20);
$field = ['gl_project.id', 'gl_project.company', 'gl_project.is_upgrade', 'b.start_date', 'd.domain'];
$field = ['gl_project.id', 'gl_project.company', 'gl_project.is_upgrade', 'b.start_date', 'd.domain', 'b.special'];
$result = Project::select($field)->leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id')
->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id')
->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id')
... ...
... ... @@ -9,6 +9,7 @@ use App\Models\Domain\DomainCreateTask;
use App\Models\Domain\DomainInfo;
use App\Models\Domain\DomainRedirectTask;
use App\Models\Project\CountryCustom;
use App\Models\Project\DeployBuild;
use App\Models\Project\Project;
class DomainInfoLogic extends BaseLogic
... ... @@ -169,7 +170,7 @@ class DomainInfoLogic extends BaseLogic
}
if($serversIpInfo['servers_id'] == ServerConfig::SELF_SITE_ID){
$this->model->edit(['amp_status' => $this->param['amp_status'] ?? 0],['id'=>$this->param['id']]);
$this->fail('自建站服务器无生成站点');
$this->fail('自建站服务器无生成站点');
}
//域名是否都已经解析
if(!check_domain_record($info['domain'], $serversIpInfo)){
... ... @@ -242,6 +243,14 @@ class DomainInfoLogic extends BaseLogic
}
}
//小语种为二级目录的站点,强制跳转https
$is_https = 0;
$buildModel = new DeployBuild();
$build_info = $buildModel->read(['project_id' => $info['project_id']], ['linking_format']);
if ($build_info && $build_info['linking_format'] == 1) {
$is_https = 1;
}
//保存301跳转数据+其他域名
$data = [
'other_domain'=>json_encode(array_filter($this->param['other_domain'] ?? [])),
... ... @@ -249,7 +258,7 @@ class DomainInfoLogic extends BaseLogic
'type'=>$this->param['type'],
'private_key' => $this->param['key'] ?? '',
'private_cert' => $this->param['cert'] ?? '',
'is_https' => $this->param['is_https'] ?? 0,
'is_https' => $is_https,
'amp_status' => $this->param['amp_status'] ?? 0,
'amp_type' => $this->param['amp_type'] ?? 0,
'amp_extend_config'=>json_encode($amp_extend_config),
... ...
... ... @@ -28,6 +28,7 @@ use App\Models\RankData\Speed;
use App\Models\RankData\Speed as GoogleSpeedModel;
use App\Utils\HttpUtils;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log;
... ... @@ -819,8 +820,19 @@ class RankDataLogic extends BaseLogic
if(!$model){
$model = new IndexedPagesModel();
}
$is_ext = 0;
$copy_domain = '';
$api = new QuanqiusouApi();
$res = $api->getSiteResPer($api_no);
//复制站 域名在这个http://api.quanqiusou.cn/google-rank/ext_sitenum_list.php里面 就用这个接口的数据
$domain = (new DomainInfo())->getDomain($domain);
$host = parse_url($domain, PHP_URL_HOST);
$host=str_replace('www.', '', $host);
$copy_site_list = $api->getSiteNumList();
if(in_array($host, $copy_site_list)){
$copy_domain = $host;
$is_ext = 1;
}
$res = $api->getSiteResPer($api_no, $is_ext, $copy_domain);
if(!$res){
Log::channel('rank_data')->error('syncIndexedPages:收录数数据为空', ['project_id' => $project_id, 'api_no' => $api_no]);
continue;
... ...
... ... @@ -120,7 +120,8 @@ class Project extends Base
13 => 'AI站群',
14 => '未达标',
15 => 'AI案例',
16 => '6.0广告'
16 => '6.0广告',
17 => '超哥监控项目',
];
}
... ...