作者 lyh
... ... @@ -43,6 +43,7 @@ class RankData extends BaseCommands
*/
public function do()
{
Log::channel('rank_data')->info('开始-排名数据');
//同步api_no
$this->SyncApiNo();
... ...
... ... @@ -103,4 +103,21 @@ class IndexController extends BaseController
}
$this->response('success');
}
/**
* 生成嵌套AICC企微的token
* @author zbj
* @date 2024/2/29
*/
public function generateAiCCToken(){
$data = [
'id' => $this->manage['id'],
'name' => $this->manage['name'],
'timestamp' => time(), // 接收到字符串解密出来以后需要 验证时间不超过30秒 超过时间视为无效授权
];
$common = new \App\Helper\Common();
$str = $common->encrypt($data);
$this->response('success',Code::SUCCESS,['str'=>$str]);
}
}
... ...
... ... @@ -152,7 +152,7 @@ class DomainInfoLogic extends BaseLogic
* @author Akun
* @date 2023/10/17 11:52
*/
public function setDomainSsl($initDomain,$domain,$rewrite,$other_domain)
public function setDomainSsl($initDomain,$domain,$rewrite,$other_domain,$is_https)
{
if($this->param['type'] == 2){
if(empty($this->param['key'])){
... ... @@ -167,11 +167,17 @@ class DomainInfoLogic extends BaseLogic
'private_key' => $this->param['key'],
'cert' => $this->param['cert'],
'rewrite'=>$rewrite,
'other_domain'=>$other_domain
'other_domain'=>$other_domain,
'is_https' => $is_https
];
}else{
$api_url = 'http://'.$initDomain.'/api/applySsl';
$api_param = ['domain' => $domain,'rewrite'=>$rewrite,'other_domain'=>$other_domain];
$api_param = [
'domain' => $domain,
'rewrite'=>$rewrite,
'other_domain'=>$other_domain,
'is_https' => $is_https
];
}
try {
$rs = HttpUtils::get($api_url, $api_param);
... ... @@ -287,6 +293,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,
'amp_status' => $this->param['amp_status'] ?? 0,
'amp_type' => $this->param['amp_type'] ?? 0,
'amp_private_key' => $this->param['amp_key'] ?? '',
... ... @@ -294,7 +301,7 @@ class DomainInfoLogic extends BaseLogic
];
$this->model->edit($data,['id'=>$this->param['id']]);
//生成证书
$this->setDomainSsl($server_info['init_domain'],$info['domain'],$this->param['extend_config'] ?? [],$this->param['other_domain'] ?? []);
$this->setDomainSsl($server_info['init_domain'],$info['domain'],$this->param['extend_config'] ?? [],$this->param['other_domain'] ?? [],$this->param['is_https'] ?? 0);
//amp站点生成证书
if($data['amp_status']){
... ...
... ... @@ -427,9 +427,8 @@ class RankDataLogic extends BaseLogic
$first_num = $first_page_num = $first_three_pages_num = $first_five_pages_num = $first_ten_pages_num = 0;
if(!$lang){
foreach ($data as &$ranks){
ksort($ranks);
foreach ($data as &$ranks){
ksort($ranks);
// foreach ($ranks as &$rank){
// //处理排名
// if(!in_array($project_id, $without_project_ids)){
... ... @@ -439,30 +438,30 @@ class RankDataLogic extends BaseLogic
// //todo 需要特殊处理排名的项目
// }
// }
$last = Arr::last($ranks);
//第一名
if($last['position'] == 1){
$first_num ++;
}
//排名第一页
if($last['position'] > 0 && $last['position'] <= 10){
$first_page_num ++;
}
//排名前三页
if($last['position'] > 0 && $last['position'] <= 30){
$first_three_pages_num ++;
}
//排名前五页
if($last['position'] > 0 && $last['position'] <= 50){
$first_five_pages_num ++;
}
//排名前十页
if($last['position'] > 0 && $last['position'] <= 100){
$first_ten_pages_num ++;
}
$last = Arr::last($ranks);
//第一名
if($last['position'] == 1){
$first_num ++;
}
//排名第一页
if($last['position'] > 0 && $last['position'] <= 10){
$first_page_num ++;
}
//排名前三页
if($last['position'] > 0 && $last['position'] <= 30){
$first_three_pages_num ++;
}
//排名前五页
if($last['position'] > 0 && $last['position'] <= 50){
$first_five_pages_num ++;
}
//排名前十页
if($last['position'] > 0 && $last['position'] <= 100){
$first_ten_pages_num ++;
}
}
$where = [
'project_id' => $project_id,
'lang' => $lang
... ... @@ -473,12 +472,12 @@ class RankDataLogic extends BaseLogic
}
//关键词达标天数
$model->is_compliance = 0;
if($model->updated_date != date('Y-m-d')){
//保证关键词数
$keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num');
$type = Project::where('id', $project_id)->value('type');
if($keyword_num && $type == Project::TYPE_TWO && $first_page_num >= $keyword_num){
Log::channel('rank_data')->info('项目'.$project_id.':关键词达标-'.$first_page_num);
$model->compliance_day = $model->compliance_day + 1;
$model->is_compliance = 1;
//项目表更新
... ... @@ -486,6 +485,8 @@ class RankDataLogic extends BaseLogic
$compliance_day = Project::where(['id' => $project_id])->value('finish_remain_day') ?: 0;
Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $compliance_day+1]);
}
}else{
Log::channel('rank_data')->info('项目'.$project_id.':关键词未达标-'.$first_page_num);
}
}
$model->project_id = $project_id;
... ...
... ... @@ -372,6 +372,9 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/del', [Aside\Template\ATemplateTypeController::class, 'del'])->name('admin.ATemplateType_del');
});
});
Route::any('/generate_aicc_token', [Aside\Com\IndexController::class, 'generateAiCCToken'])->name('admin.generate_aicc_token');
});
//无需登录验证的路由组
... ...