|
...
|
...
|
@@ -82,10 +82,10 @@ class RemainDay extends Command |
|
|
|
$list = $projectModel->list(['extend_type'=>Project::TYPE_ZERO,'type'=>['in',[Project::TYPE_TWO,Project::TYPE_THREE,Project::TYPE_FOUR,Project::TYPE_SIX]]],'id',['id','type','level','uptime','remain_day','version','is_remain_today','pause_days','finish_remain_day','bm_finish_remain_day','geo_qualify_num']);
|
|
|
|
foreach ($list as $item){
|
|
|
|
$deploy_build = $deployBuildModel->read(['project_id'=>$item['id']],['service_duration','seo_service_duration','plan','seo_plan']);
|
|
|
|
$this->output('start->项目id:' . $item['id']);
|
|
|
|
$this->output('start->项目id:' . $item['id'],$item['id']);
|
|
|
|
//todo::暂停的项目停止计时
|
|
|
|
if(in_array($item['id'],$this->ceaseProjectId)){//暂停的项目
|
|
|
|
$this->output('暂停的项目id:' . $item['id']);
|
|
|
|
$this->output('暂停的项目id:' . $item['id'],$item['id']);
|
|
|
|
if(($item['type'] == Project::TYPE_TWO) && ($item['is_remain_today'] == 1)){
|
|
|
|
$pause_days = $item['pause_days'] + 1;
|
|
|
|
}
|
|
...
|
...
|
@@ -97,8 +97,8 @@ class RemainDay extends Command |
|
|
|
}
|
|
|
|
//todo::优化项目中途达标计时切换为按天计时
|
|
|
|
if(in_array($item['id'],$this->projectSwitchId)){
|
|
|
|
$this->output('中途切换计时的项目id:' . $item['id'].',旧达标天数:'.$item['finish_remain_day'].',新达标天数:'.($item['finish_remain_day'] + 1));
|
|
|
|
$this->output('中途切换计时的项目id:' . $item['id'].',当前剩余服务时常:'.$item['remain_day'].',剩余时常:'.($item['remain_day'] - 1));
|
|
|
|
$this->output('中途切换计时的项目id:' . $item['id'].',旧达标天数:'.$item['finish_remain_day'].',新达标天数:'.($item['finish_remain_day'] + 1),$item['id']);
|
|
|
|
$this->output('中途切换计时的项目id:' . $item['id'].',当前剩余服务时常:'.$item['remain_day'].',剩余时常:'.($item['remain_day'] - 1),$item['id']);
|
|
|
|
$this->project->edit(['remain_day'=>($item['remain_day'] - 1),'finish_remain_day'=>($item['finish_remain_day'] + 1)],['id'=>$item['id']]);
|
|
|
|
continue;
|
|
|
|
}
|
|
...
|
...
|
@@ -124,17 +124,17 @@ class RemainDay extends Command |
|
|
|
//白帽版本的系统
|
|
|
|
if($deploy_build['seo_plan'] != 0){
|
|
|
|
if($deploy_build['seo_service_duration'] != 0){
|
|
|
|
$this->output('白帽计算剩余服务时常:'.$item['id']);
|
|
|
|
$this->output('白帽计算剩余服务时常:'.$item['id'],$item['id']);
|
|
|
|
if(in_array($item['id'],$this->bm_projectId) || (in_array( 19,$item['level']))){
|
|
|
|
$compliance_day = (int)$item['bm_finish_remain_day'];
|
|
|
|
$seo_remain_day = $deploy_build['seo_service_duration'] - (int)$item['bm_finish_remain_day'];
|
|
|
|
$this->output('按白帽达标天数统计:'.$item['id'].',bm达标天数:'.$item['bm_finish_remain_day'].',bm剩余白帽天数:'.$seo_remain_day);
|
|
|
|
$this->output('按白帽达标天数统计:'.$item['id'].',bm达标天数:'.$item['bm_finish_remain_day'].',bm剩余白帽天数:'.$seo_remain_day,$item['id']);
|
|
|
|
}else{
|
|
|
|
//按自然日统计
|
|
|
|
$diff = time() - strtotime($item['uptime']);
|
|
|
|
$compliance_day = floor($diff / (60 * 60 * 24));
|
|
|
|
$seo_remain_day = $deploy_build['seo_service_duration'] - $compliance_day;
|
|
|
|
$this->output('按白帽自然日天数统计:'.$item['id'].',bm达标天数:'.$compliance_day.',bm剩余白帽天数:'.$seo_remain_day);
|
|
|
|
$this->output('按白帽自然日天数统计:'.$item['id'].',bm达标天数:'.$compliance_day.',bm剩余白帽天数:'.$seo_remain_day,$item['id']);
|
|
|
|
}
|
|
|
|
$this->project->edit(['seo_remain_day'=>$seo_remain_day,'bm_finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
|
|
|
|
}
|
|
...
|
...
|
@@ -150,10 +150,10 @@ class RemainDay extends Command |
|
|
|
* @time :2025/4/25 14:31
|
|
|
|
*/
|
|
|
|
public function remainDay($item,$deploy_build){
|
|
|
|
$this->output('普通项目计算剩余服务时常:'.$item['id']);
|
|
|
|
$this->output('普通项目计算剩余服务时常:'.$item['id'],$item['id']);
|
|
|
|
//默认版本统计
|
|
|
|
if($deploy_build['service_duration'] == 0 || $deploy_build['plan'] == 0){
|
|
|
|
$this->output('当前项目跳过:'.$item['id']);
|
|
|
|
$this->output('当前项目跳过:'.$item['id'],$item['id']);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
//默认版本计算剩余服务时常
|
|
...
|
...
|
@@ -167,7 +167,7 @@ class RemainDay extends Command |
|
|
|
$diff = time() - strtotime($opInfo['start_date'] ?? $item['uptime']);
|
|
|
|
$compliance_day = floor($diff / (60 * 60 * 24));
|
|
|
|
$remain_day = $deploy_build['service_duration'] - $compliance_day;
|
|
|
|
$this->output('已开始优化的时间结算:'.$item['id'].',剩余服务时常:'.$remain_day);
|
|
|
|
$this->output('已开始优化的时间结算:'.$item['id'].',剩余服务时常:'.$remain_day,$item['id']);
|
|
|
|
}else{
|
|
|
|
$compliance_day = ($item['finish_remain_day'] ?? 0);
|
|
|
|
//todo::7.5版本单独计算
|
|
...
|
...
|
@@ -177,10 +177,10 @@ class RemainDay extends Command |
|
|
|
if($item['is_remain_today'] > 0 && $is_qualify > 0){
|
|
|
|
$remain_day = $item['remain_day'] - 1;
|
|
|
|
}
|
|
|
|
$this->output('7.5版本单独计算:'.$item['id'].',剩余服务时常:'.$remain_day);
|
|
|
|
$this->output('7.5版本单独计算:'.$item['id'].',剩余服务时常:'.$remain_day,$item['id']);
|
|
|
|
}else{
|
|
|
|
$remain_day = $deploy_build['service_duration'] - $compliance_day;
|
|
|
|
$this->output('优化项目:'.$item['id'].',剩余服务时常:'.$remain_day.',已达标天数:'.$compliance_day);
|
|
|
|
$this->output('优化项目:'.$item['id'].',剩余服务时常:'.$remain_day.',已达标天数:'.$compliance_day,$item['id']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
|
...
|
...
|
@@ -203,11 +203,11 @@ class RemainDay extends Command |
|
|
|
* @param $message
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function output($message)
|
|
|
|
public function output($message,$project_id = 1)
|
|
|
|
{
|
|
|
|
$message = date('Y-m-d H:i:s') . ' ' . $message . PHP_EOL;
|
|
|
|
echo $message;
|
|
|
|
file_put_contents(storage_path('logs/remain_day/') . date('Ymd') . '.log', $message, FILE_APPEND);
|
|
|
|
file_put_contents(storage_path('logs/remain_day/') . $project_id . '.log', $message, FILE_APPEND);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|