作者 李宇航

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

Lyh server



查看合并请求 !3152
@@ -82,9 +82,10 @@ class RemainDay extends Command @@ -82,9 +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 - echo 'start->项目id:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL; 85 + $this->output('start->项目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 if(($item['type'] == Project::TYPE_TWO) && ($item['is_remain_today'] == 1)){ 89 if(($item['type'] == Project::TYPE_TWO) && ($item['is_remain_today'] == 1)){
89 $pause_days = $item['pause_days'] + 1; 90 $pause_days = $item['pause_days'] + 1;
90 } 91 }
@@ -96,6 +97,8 @@ class RemainDay extends Command @@ -96,6 +97,8 @@ class RemainDay extends Command
96 } 97 }
97 //todo::优化项目中途达标计时切换为按天计时 98 //todo::优化项目中途达标计时切换为按天计时
98 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));
99 $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']]);
100 continue; 103 continue;
101 } 104 }
@@ -103,7 +106,7 @@ class RemainDay extends Command @@ -103,7 +106,7 @@ class RemainDay extends Command
103 $this->seoRemainDay($deploy_build,$item); 106 $this->seoRemainDay($deploy_build,$item);
104 //默认版本统计 107 //默认版本统计
105 $this->remainDay($item,$deploy_build); 108 $this->remainDay($item,$deploy_build);
106 - echo 'end->项目id:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL; 109 + $this->output('end->项目id:' . $item['id']);
107 } 110 }
108 return true; 111 return true;
109 } 112 }
@@ -121,14 +124,17 @@ class RemainDay extends Command @@ -121,14 +124,17 @@ class RemainDay extends Command
121 //白帽版本的系统 124 //白帽版本的系统
122 if($deploy_build['seo_plan'] != 0){ 125 if($deploy_build['seo_plan'] != 0){
123 if($deploy_build['seo_service_duration'] != 0){ 126 if($deploy_build['seo_service_duration'] != 0){
  127 + $this->output('白帽计算剩余服务时常:'.$item['id']);
124 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']))){
125 $compliance_day = (int)$item['bm_finish_remain_day']; 129 $compliance_day = (int)$item['bm_finish_remain_day'];
126 $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);
127 }else{ 132 }else{
128 //按自然日统计 133 //按自然日统计
129 $diff = time() - strtotime($item['uptime']); 134 $diff = time() - strtotime($item['uptime']);
130 $compliance_day = floor($diff / (60 * 60 * 24)); 135 $compliance_day = floor($diff / (60 * 60 * 24));
131 $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);
132 } 138 }
133 $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']]);
134 } 140 }
@@ -144,8 +150,10 @@ class RemainDay extends Command @@ -144,8 +150,10 @@ class RemainDay extends Command
144 * @time :2025/4/25 14:31 150 * @time :2025/4/25 14:31
145 */ 151 */
146 public function remainDay($item,$deploy_build){ 152 public function remainDay($item,$deploy_build){
  153 + $this->output('普通项目计算剩余服务时常:'.$item['id']);
147 //默认版本统计 154 //默认版本统计
148 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']);
149 return false; 157 return false;
150 } 158 }
151 //默认版本计算剩余服务时常 159 //默认版本计算剩余服务时常
@@ -159,6 +167,7 @@ class RemainDay extends Command @@ -159,6 +167,7 @@ class RemainDay extends Command
159 $diff = time() - strtotime($opInfo['start_date'] ?? $item['uptime']); 167 $diff = time() - strtotime($opInfo['start_date'] ?? $item['uptime']);
160 $compliance_day = floor($diff / (60 * 60 * 24)); 168 $compliance_day = floor($diff / (60 * 60 * 24));
161 $remain_day = $deploy_build['service_duration'] - $compliance_day; 169 $remain_day = $deploy_build['service_duration'] - $compliance_day;
  170 + $this->output('已开始优化的时间结算:'.$item['id'].',剩余服务时常:'.$remain_day);
162 }else{ 171 }else{
163 $compliance_day = ($item['finish_remain_day'] ?? 0); 172 $compliance_day = ($item['finish_remain_day'] ?? 0);
164 //todo::7.5版本单独计算 173 //todo::7.5版本单独计算
@@ -168,8 +177,10 @@ class RemainDay extends Command @@ -168,8 +177,10 @@ class RemainDay extends Command
168 if($item['is_remain_today'] > 0 && $is_qualify > 0){ 177 if($item['is_remain_today'] > 0 && $is_qualify > 0){
169 $remain_day = $item['remain_day'] - 1; 178 $remain_day = $item['remain_day'] - 1;
170 } 179 }
  180 + $this->output('7.5版本单独计算:'.$item['id'].',剩余服务时常:'.$remain_day);
171 }else{ 181 }else{
172 $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);
173 } 184 }
174 } 185 }
175 }else{ 186 }else{
@@ -183,11 +194,20 @@ class RemainDay extends Command @@ -183,11 +194,20 @@ class RemainDay extends Command
183 } 194 }
184 } 195 }
185 $extend_type = 0; 196 $extend_type = 0;
186 -// if($remain_day < 0 && $deploy_build['service_duration'] != 0){  
187 -// $remain_day = 0;  
188 -// $extend_type = Project::TYPE_FIVE;  
189 -// }  
190 $this->project->edit(['remain_day'=>$remain_day,'extend_type'=>$extend_type,'finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]); 197 $this->project->edit(['remain_day'=>$remain_day,'extend_type'=>$extend_type,'finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
191 return true; 198 return true;
192 } 199 }
  200 +
  201 + /**
  202 + * 输入日志
  203 + * @param $message
  204 + * @return bool
  205 + */
  206 + public function output($message)
  207 + {
  208 + $message = date('Y-m-d H:i:s') . ' ' . $message . PHP_EOL;
  209 + echo $message;
  210 + file_put_contents(storage_path('logs/remain_day/') . date('Ymd') . '.log', $message, FILE_APPEND);
  211 + return true;
  212 + }
193 } 213 }
@@ -36,7 +36,9 @@ class GeoConf extends Base @@ -36,7 +36,9 @@ class GeoConf extends Base
36 if (empty($optimize)) { 36 if (empty($optimize)) {
37 $optimize = ManageHr::where(['status' => ManageHr::STATUS_ONE, 'entry_position' => 46])->pluck('name', 'id')->toArray(); 37 $optimize = ManageHr::where(['status' => ManageHr::STATUS_ONE, 'entry_position' => 46])->pluck('name', 'id')->toArray();
38 $optimize[11] = '陶婵'; 38 $optimize[11] = '陶婵';
  39 + $optimize[207] = '吴雨静';
39 $optimize[875] = '艾媛媛'; 40 $optimize[875] = '艾媛媛';
  41 + $optimize[893] = '杨汀';
40 ksort($optimize); 42 ksort($optimize);
41 Cache::put($key, $optimize, 3600); 43 Cache::put($key, $optimize, 3600);
42 } 44 }