作者 李宇航

合并分支 'lyh-server' 到 'master'

Lyh server



查看合并请求 !1439
... ... @@ -16,7 +16,9 @@ use App\Models\CustomModule\CustomModuleContent;
use App\Models\Product\CategoryRelated;
use App\Models\Product\Keyword;
use App\Models\Product\Product;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Project;
use App\Models\RankData\RankDataLog;
use App\Models\RouteMap\RouteMap;
use App\Models\WebSetting\WebSetting;
use App\Services\ProjectServer;
... ... @@ -58,28 +60,29 @@ class UpdateRoute extends Command
* @time :2023/11/20 15:13
*/
public function handle(){
$projectModel = new Project();
$lists = $projectModel->list(['delete_status'=>0],'id',['id']);
foreach ($lists as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
$webSettingModel = new WebSetting();
$settingInfo = $webSettingModel->read(['project_id'=>$v['id']]);
if($settingInfo === false){
echo date('Y-m-d H:i:s') . '当前项目的设置数据不存在:'.$v['id'] . PHP_EOL;
//新增一条数据
$data = [
'anchor_setting'=>'["3","4","5"]',
'anchor_is_enable'=>1,
'anchor_page_num'=>1,
'anchor_num'=>2,
'anchor_keyword_is_enable'=>1,
'project_id'=>$v['id']
];
$webSettingModel->add($data);
}
DB::disconnect('custom_mysql');
}
$this->updateProjectOp();
// $projectModel = new Project();
// $lists = $projectModel->list(['delete_status'=>0],'id',['id']);
// foreach ($lists as $v){
// echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
// ProjectServer::useProject($v['id']);
// $webSettingModel = new WebSetting();
// $settingInfo = $webSettingModel->read(['project_id'=>$v['id']]);
// if($settingInfo === false){
// echo date('Y-m-d H:i:s') . '当前项目的设置数据不存在:'.$v['id'] . PHP_EOL;
// //新增一条数据
// $data = [
// 'anchor_setting'=>'["3","4","5"]',
// 'anchor_is_enable'=>1,
// 'anchor_page_num'=>1,
// 'anchor_num'=>2,
// 'anchor_keyword_is_enable'=>1,
// 'project_id'=>$v['id']
// ];
// $webSettingModel->add($data);
// }
// DB::disconnect('custom_mysql');
// }
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
}
... ... @@ -482,4 +485,27 @@ class UpdateRoute extends Command
}
return true;
}
/**
* @remark :更新优化设置表
* @name :updateProjectOp
* @author :lyh
* @method :post
* @time :2025/3/14 10:29
*/
public function updateProjectOp(){
//查询优化中台数据
$projectModel = new Project();
$list = $projectModel->list(['type'=>2],['id']);
$rankDataModel = new RankDataLog();
$opModel = new DeployOptimize();
foreach ($list as $v){
$rankInfo = $rankDataModel->where('project_id', $v['id'])->where('is_compliance',1)->where('lang','')->orderBy('created_at', 'asc')->select('id', 'date' ,'project_id','is_compliance' ,'created_at')->first();
if(!empty($rankInfo)){
echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] .'首次达标时间'. $rankInfo['date'] . PHP_EOL;
$opModel->edit(['first_compliance_time'=>$rankInfo['date']],['project_id'=>$v['id']]);
}
}
return true;
}
}
... ...
... ... @@ -490,18 +490,7 @@ class RankDataLogic extends BaseLogic
$without_extension_project_ids = [658]; //是否达标只统计主词的
$extension_project_ids = [354]; //扩展词也到达标的
$compliance_project_ids = [2163,257]; //直接达标处理的
$ceaseProjectId = [
47,
354,
378,
649,
1226,
1283,
1703,
1893,
2066,
];//暂停项目id
$ceaseProjectId = [47, 354, 378, 649, 1226, 1283, 1703, 1893, 2066,];//暂停项目id
//一个项目多个api_no
$multiple_api_no_project_ids = [
2104 => [
... ... @@ -515,15 +504,6 @@ class RankDataLogic extends BaseLogic
$g_top_first_page_extension_num = 0;
foreach ($data as &$ranks){
ksort($ranks);
// foreach ($ranks as &$rank){
// //处理排名
// if(!in_array($project_id, $without_project_ids)){
// if($rank['position'] >= 10){
// $rank['position'] -= 5;
// }
// //todo 需要特殊处理排名的项目
// }
// }
$last = Arr::last($ranks);
//第一名
if($last['position'] == 1){
... ... @@ -586,6 +566,9 @@ class RankDataLogic extends BaseLogic
if (($model->updated_date != date('Y-m-d') || empty($model_is_compliance)) && !$lang) {
$compliance_day = Project::where(['id' => $project_id])->value('finish_remain_day') ?: 0;
if(!in_array($project_id,$ceaseProjectId)){
if($compliance_day == 0){//达标天数为0并当天达标 记录当前达标时间
DeployOptimize::where(['project_id'=>$project_id])->update(['first_compliance_time'=>date('Y-m-d')]);
}
//多api_no项目 要api_no都分别达标才算
if(in_array($project_id, array_keys($multiple_api_no_project_ids))){
$api_nos = array_keys($multiple_api_no_project_ids[$project_id]);
... ...