正在显示
1 个修改的文件
包含
14 行增加
和
14 行删除
| @@ -82,10 +82,10 @@ class RemainDay extends Command | @@ -82,10 +82,10 @@ class RemainDay extends Command | ||
| 82 | $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']); | 82 | $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']); |
| 83 | foreach ($list as $item){ | 83 | foreach ($list as $item){ |
| 84 | $deploy_build = $deployBuildModel->read(['project_id'=>$item['id']],['service_duration','seo_service_duration','plan','seo_plan']); | 84 | $deploy_build = $deployBuildModel->read(['project_id'=>$item['id']],['service_duration','seo_service_duration','plan','seo_plan']); |
| 85 | - $this->output('start->项目id:' . $item['id']); | 85 | + $this->output('start->项目id:' . $item['id'],$item['id']); |
| 86 | //todo::暂停的项目停止计时 | 86 | //todo::暂停的项目停止计时 |
| 87 | if(in_array($item['id'],$this->ceaseProjectId)){//暂停的项目 | 87 | if(in_array($item['id'],$this->ceaseProjectId)){//暂停的项目 |
| 88 | - $this->output('暂停的项目id:' . $item['id']); | 88 | + $this->output('暂停的项目id:' . $item['id'],$item['id']); |
| 89 | if(($item['type'] == Project::TYPE_TWO) && ($item['is_remain_today'] == 1)){ | 89 | if(($item['type'] == Project::TYPE_TWO) && ($item['is_remain_today'] == 1)){ |
| 90 | $pause_days = $item['pause_days'] + 1; | 90 | $pause_days = $item['pause_days'] + 1; |
| 91 | } | 91 | } |
| @@ -97,8 +97,8 @@ class RemainDay extends Command | @@ -97,8 +97,8 @@ class RemainDay extends Command | ||
| 97 | } | 97 | } |
| 98 | //todo::优化项目中途达标计时切换为按天计时 | 98 | //todo::优化项目中途达标计时切换为按天计时 |
| 99 | if(in_array($item['id'],$this->projectSwitchId)){ | 99 | if(in_array($item['id'],$this->projectSwitchId)){ |
| 100 | - $this->output('中途切换计时的项目id:' . $item['id'].',旧达标天数:'.$item['finish_remain_day'].',新达标天数:'.($item['finish_remain_day'] + 1)); | ||
| 101 | - $this->output('中途切换计时的项目id:' . $item['id'].',当前剩余服务时常:'.$item['remain_day'].',剩余时常:'.($item['remain_day'] - 1)); | 100 | + $this->output('中途切换计时的项目id:' . $item['id'].',旧达标天数:'.$item['finish_remain_day'].',新达标天数:'.($item['finish_remain_day'] + 1),$item['id']); |
| 101 | + $this->output('中途切换计时的项目id:' . $item['id'].',当前剩余服务时常:'.$item['remain_day'].',剩余时常:'.($item['remain_day'] - 1),$item['id']); | ||
| 102 | $this->project->edit(['remain_day'=>($item['remain_day'] - 1),'finish_remain_day'=>($item['finish_remain_day'] + 1)],['id'=>$item['id']]); | 102 | $this->project->edit(['remain_day'=>($item['remain_day'] - 1),'finish_remain_day'=>($item['finish_remain_day'] + 1)],['id'=>$item['id']]); |
| 103 | continue; | 103 | continue; |
| 104 | } | 104 | } |
| @@ -124,17 +124,17 @@ class RemainDay extends Command | @@ -124,17 +124,17 @@ class RemainDay extends Command | ||
| 124 | //白帽版本的系统 | 124 | //白帽版本的系统 |
| 125 | if($deploy_build['seo_plan'] != 0){ | 125 | if($deploy_build['seo_plan'] != 0){ |
| 126 | if($deploy_build['seo_service_duration'] != 0){ | 126 | if($deploy_build['seo_service_duration'] != 0){ |
| 127 | - $this->output('白帽计算剩余服务时常:'.$item['id']); | 127 | + $this->output('白帽计算剩余服务时常:'.$item['id'],$item['id']); |
| 128 | if(in_array($item['id'],$this->bm_projectId) || (in_array( 19,$item['level']))){ | 128 | if(in_array($item['id'],$this->bm_projectId) || (in_array( 19,$item['level']))){ |
| 129 | $compliance_day = (int)$item['bm_finish_remain_day']; | 129 | $compliance_day = (int)$item['bm_finish_remain_day']; |
| 130 | $seo_remain_day = $deploy_build['seo_service_duration'] - (int)$item['bm_finish_remain_day']; | 130 | $seo_remain_day = $deploy_build['seo_service_duration'] - (int)$item['bm_finish_remain_day']; |
| 131 | - $this->output('按白帽达标天数统计:'.$item['id'].',bm达标天数:'.$item['bm_finish_remain_day'].',bm剩余白帽天数:'.$seo_remain_day); | 131 | + $this->output('按白帽达标天数统计:'.$item['id'].',bm达标天数:'.$item['bm_finish_remain_day'].',bm剩余白帽天数:'.$seo_remain_day,$item['id']); |
| 132 | }else{ | 132 | }else{ |
| 133 | //按自然日统计 | 133 | //按自然日统计 |
| 134 | $diff = time() - strtotime($item['uptime']); | 134 | $diff = time() - strtotime($item['uptime']); |
| 135 | $compliance_day = floor($diff / (60 * 60 * 24)); | 135 | $compliance_day = floor($diff / (60 * 60 * 24)); |
| 136 | $seo_remain_day = $deploy_build['seo_service_duration'] - $compliance_day; | 136 | $seo_remain_day = $deploy_build['seo_service_duration'] - $compliance_day; |
| 137 | - $this->output('按白帽自然日天数统计:'.$item['id'].',bm达标天数:'.$compliance_day.',bm剩余白帽天数:'.$seo_remain_day); | 137 | + $this->output('按白帽自然日天数统计:'.$item['id'].',bm达标天数:'.$compliance_day.',bm剩余白帽天数:'.$seo_remain_day,$item['id']); |
| 138 | } | 138 | } |
| 139 | $this->project->edit(['seo_remain_day'=>$seo_remain_day,'bm_finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]); | 139 | $this->project->edit(['seo_remain_day'=>$seo_remain_day,'bm_finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]); |
| 140 | } | 140 | } |
| @@ -150,10 +150,10 @@ class RemainDay extends Command | @@ -150,10 +150,10 @@ class RemainDay extends Command | ||
| 150 | * @time :2025/4/25 14:31 | 150 | * @time :2025/4/25 14:31 |
| 151 | */ | 151 | */ |
| 152 | public function remainDay($item,$deploy_build){ | 152 | public function remainDay($item,$deploy_build){ |
| 153 | - $this->output('普通项目计算剩余服务时常:'.$item['id']); | 153 | + $this->output('普通项目计算剩余服务时常:'.$item['id'],$item['id']); |
| 154 | //默认版本统计 | 154 | //默认版本统计 |
| 155 | if($deploy_build['service_duration'] == 0 || $deploy_build['plan'] == 0){ | 155 | if($deploy_build['service_duration'] == 0 || $deploy_build['plan'] == 0){ |
| 156 | - $this->output('当前项目跳过:'.$item['id']); | 156 | + $this->output('当前项目跳过:'.$item['id'],$item['id']); |
| 157 | return false; | 157 | return false; |
| 158 | } | 158 | } |
| 159 | //默认版本计算剩余服务时常 | 159 | //默认版本计算剩余服务时常 |
| @@ -167,7 +167,7 @@ class RemainDay extends Command | @@ -167,7 +167,7 @@ class RemainDay extends Command | ||
| 167 | $diff = time() - strtotime($opInfo['start_date'] ?? $item['uptime']); | 167 | $diff = time() - strtotime($opInfo['start_date'] ?? $item['uptime']); |
| 168 | $compliance_day = floor($diff / (60 * 60 * 24)); | 168 | $compliance_day = floor($diff / (60 * 60 * 24)); |
| 169 | $remain_day = $deploy_build['service_duration'] - $compliance_day; | 169 | $remain_day = $deploy_build['service_duration'] - $compliance_day; |
| 170 | - $this->output('已开始优化的时间结算:'.$item['id'].',剩余服务时常:'.$remain_day); | 170 | + $this->output('已开始优化的时间结算:'.$item['id'].',剩余服务时常:'.$remain_day,$item['id']); |
| 171 | }else{ | 171 | }else{ |
| 172 | $compliance_day = ($item['finish_remain_day'] ?? 0); | 172 | $compliance_day = ($item['finish_remain_day'] ?? 0); |
| 173 | //todo::7.5版本单独计算 | 173 | //todo::7.5版本单独计算 |
| @@ -177,10 +177,10 @@ class RemainDay extends Command | @@ -177,10 +177,10 @@ class RemainDay extends Command | ||
| 177 | if($item['is_remain_today'] > 0 && $is_qualify > 0){ | 177 | if($item['is_remain_today'] > 0 && $is_qualify > 0){ |
| 178 | $remain_day = $item['remain_day'] - 1; | 178 | $remain_day = $item['remain_day'] - 1; |
| 179 | } | 179 | } |
| 180 | - $this->output('7.5版本单独计算:'.$item['id'].',剩余服务时常:'.$remain_day); | 180 | + $this->output('7.5版本单独计算:'.$item['id'].',剩余服务时常:'.$remain_day,$item['id']); |
| 181 | }else{ | 181 | }else{ |
| 182 | $remain_day = $deploy_build['service_duration'] - $compliance_day; | 182 | $remain_day = $deploy_build['service_duration'] - $compliance_day; |
| 183 | - $this->output('优化项目:'.$item['id'].',剩余服务时常:'.$remain_day.',已达标天数:'.$compliance_day); | 183 | + $this->output('优化项目:'.$item['id'].',剩余服务时常:'.$remain_day.',已达标天数:'.$compliance_day,$item['id']); |
| 184 | } | 184 | } |
| 185 | } | 185 | } |
| 186 | }else{ | 186 | }else{ |
| @@ -203,11 +203,11 @@ class RemainDay extends Command | @@ -203,11 +203,11 @@ class RemainDay extends Command | ||
| 203 | * @param $message | 203 | * @param $message |
| 204 | * @return bool | 204 | * @return bool |
| 205 | */ | 205 | */ |
| 206 | - public function output($message) | 206 | + public function output($message,$project_id = 1) |
| 207 | { | 207 | { |
| 208 | $message = date('Y-m-d H:i:s') . ' ' . $message . PHP_EOL; | 208 | $message = date('Y-m-d H:i:s') . ' ' . $message . PHP_EOL; |
| 209 | echo $message; | 209 | echo $message; |
| 210 | - file_put_contents(storage_path('logs/remain_day/') . date('Ymd') . '.log', $message, FILE_APPEND); | 210 | + file_put_contents(storage_path('logs/remain_day/') . $project_id . '.log', $message, FILE_APPEND); |
| 211 | return true; | 211 | return true; |
| 212 | } | 212 | } |
| 213 | } | 213 | } |
-
请 注册 或 登录 后发表评论