|
@@ -2,6 +2,7 @@ |
|
@@ -2,6 +2,7 @@ |
|
2
|
|
2
|
|
|
3
|
namespace App\Console\Commands\Domain;
|
3
|
namespace App\Console\Commands\Domain;
|
|
4
|
|
4
|
|
|
|
|
5
|
+use App\Models\Geo\GeoCount;
|
|
5
|
use App\Models\Project\DeployBuild;
|
6
|
use App\Models\Project\DeployBuild;
|
|
6
|
use App\Models\Project\DeployOptimize;
|
7
|
use App\Models\Project\DeployOptimize;
|
|
7
|
use App\Models\Project\Project;
|
8
|
use App\Models\Project\Project;
|
|
@@ -58,41 +59,31 @@ class RemainDay extends Command |
|
@@ -58,41 +59,31 @@ class RemainDay extends Command |
|
58
|
*/
|
59
|
*/
|
|
59
|
protected $description = '网站服务剩余时长';
|
60
|
protected $description = '网站服务剩余时长';
|
|
60
|
|
61
|
|
|
61
|
- /**
|
|
|
|
62
|
- * Create a new command instance.
|
|
|
|
63
|
- *
|
|
|
|
64
|
- * @return void
|
|
|
|
65
|
- */
|
|
|
|
66
|
- public function __construct()
|
|
|
|
67
|
- {
|
|
|
|
68
|
- $this->project = new Project();
|
|
|
|
69
|
- $this->deployBuild = new DeployBuild();
|
|
|
|
70
|
- parent::__construct();
|
|
|
|
71
|
- }
|
|
|
|
72
|
|
62
|
|
|
73
|
/**
|
63
|
/**
|
|
74
|
* @return bool
|
64
|
* @return bool
|
|
75
|
*/
|
65
|
*/
|
|
76
|
public function handle()
|
66
|
public function handle()
|
|
77
|
{
|
67
|
{
|
|
78
|
- $this->saveRemainDay();
|
68
|
+ $this->_action();
|
|
79
|
return true;
|
69
|
return true;
|
|
80
|
}
|
70
|
}
|
|
81
|
|
71
|
|
|
82
|
-
|
|
|
|
83
|
-
|
|
|
|
84
|
/**
|
72
|
/**
|
|
85
|
- * @remark :普通项目剩余服务时常
|
|
|
|
86
|
- * @name :saveRemainDay
|
73
|
+ * @remark :计算剩余服务时常
|
|
|
|
74
|
+ * @name :_action
|
|
87
|
* @author :lyh
|
75
|
* @author :lyh
|
|
88
|
* @method :post
|
76
|
* @method :post
|
|
89
|
- * @time :2025/4/2 10:48
|
77
|
+ * @time :2025/11/4 10:59
|
|
90
|
*/
|
78
|
*/
|
|
91
|
- public function saveRemainDay(){
|
|
|
|
92
|
- $list = $this->project->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','is_remain_today','pause_days','finish_remain_day','bm_finish_remain_day']);
|
79
|
+ public function _action(){
|
|
|
|
80
|
+ $projectModel = new Project();
|
|
|
|
81
|
+ $deployBuildModel = new DeployBuild();
|
|
|
|
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']);
|
|
93
|
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']);
|
|
94
|
echo 'start->项目id:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL;
|
85
|
echo 'start->项目id:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL;
|
|
95
|
- $deploy_build = $this->deployBuild->read(['project_id'=>$item['id']],['service_duration','seo_service_duration','plan','seo_plan']);
|
86
|
+ //todo::暂停的项目停止计时
|
|
96
|
if(in_array($item['id'],$this->ceaseProjectId)){//暂停的项目
|
87
|
if(in_array($item['id'],$this->ceaseProjectId)){//暂停的项目
|
|
97
|
if(($item['type'] == Project::TYPE_TWO) && ($item['is_remain_today'] == 1)){
|
88
|
if(($item['type'] == Project::TYPE_TWO) && ($item['is_remain_today'] == 1)){
|
|
98
|
$pause_days = $item['pause_days'] + 1;
|
89
|
$pause_days = $item['pause_days'] + 1;
|
|
@@ -111,15 +102,14 @@ class RemainDay extends Command |
|
@@ -111,15 +102,14 @@ class RemainDay extends Command |
|
111
|
//白帽版本单独计算
|
102
|
//白帽版本单独计算
|
|
112
|
$this->seoRemainDay($deploy_build,$item);
|
103
|
$this->seoRemainDay($deploy_build,$item);
|
|
113
|
//默认版本统计
|
104
|
//默认版本统计
|
|
114
|
- if($deploy_build['service_duration'] == 0){
|
|
|
|
115
|
- continue;
|
|
|
|
116
|
- }
|
|
|
|
117
|
$this->remainDay($item,$deploy_build);
|
105
|
$this->remainDay($item,$deploy_build);
|
|
118
|
echo 'end->项目id:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL;
|
106
|
echo 'end->项目id:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL;
|
|
119
|
}
|
107
|
}
|
|
120
|
return true;
|
108
|
return true;
|
|
121
|
}
|
109
|
}
|
|
122
|
|
110
|
|
|
|
|
111
|
+
|
|
|
|
112
|
+
|
|
123
|
/**
|
113
|
/**
|
|
124
|
* @remark :白帽版本单独计算
|
114
|
* @remark :白帽版本单独计算
|
|
125
|
* @name :seoRemainDay
|
115
|
* @name :seoRemainDay
|
|
@@ -140,13 +130,7 @@ class RemainDay extends Command |
|
@@ -140,13 +130,7 @@ class RemainDay extends Command |
|
140
|
$compliance_day = floor($diff / (60 * 60 * 24));
|
130
|
$compliance_day = floor($diff / (60 * 60 * 24));
|
|
141
|
$seo_remain_day = $deploy_build['seo_service_duration'] - $compliance_day;
|
131
|
$seo_remain_day = $deploy_build['seo_service_duration'] - $compliance_day;
|
|
142
|
}
|
132
|
}
|
|
143
|
- if($deploy_build['plan'] == 0 && $seo_remain_day < 0 && $deploy_build['seo_service_duration'] != 0){//只有白帽版本的项目且剩余服务时常为0,放入未续费中
|
|
|
|
144
|
-// $this->project->edit(['seo_remain_day'=>$seo_remain_day,'finish_remain_day'=>$compliance_day ?? 0,'extend_type'=>Project::TYPE_FIVE],['id'=>$item['id']]);
|
|
|
|
145
|
- $this->project->edit(['seo_remain_day'=>$seo_remain_day,'bm_finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
|
|
|
|
146
|
- }else{
|
|
|
|
147
|
- //同时包括白帽版本+默认版本的项目
|
|
|
|
148
|
- $this->project->edit(['seo_remain_day'=>$seo_remain_day,'bm_finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
|
|
|
|
149
|
- }
|
133
|
+ $this->project->edit(['seo_remain_day'=>$seo_remain_day,'bm_finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
|
|
150
|
}
|
134
|
}
|
|
151
|
}
|
135
|
}
|
|
152
|
return true;
|
136
|
return true;
|
|
@@ -160,6 +144,10 @@ class RemainDay extends Command |
|
@@ -160,6 +144,10 @@ class RemainDay extends Command |
|
160
|
* @time :2025/4/25 14:31
|
144
|
* @time :2025/4/25 14:31
|
|
161
|
*/
|
145
|
*/
|
|
162
|
public function remainDay($item,$deploy_build){
|
146
|
public function remainDay($item,$deploy_build){
|
|
|
|
147
|
+ //默认版本统计
|
|
|
|
148
|
+ if($deploy_build['service_duration'] == 0){
|
|
|
|
149
|
+ return false;
|
|
|
|
150
|
+ }
|
|
163
|
//默认版本计算剩余服务时常
|
151
|
//默认版本计算剩余服务时常
|
|
164
|
if($item['type'] == Project::TYPE_TWO || $item['type'] == Project::TYPE_FOUR){
|
152
|
if($item['type'] == Project::TYPE_TWO || $item['type'] == Project::TYPE_FOUR){
|
|
165
|
if(in_array($item['id'],$this->projectId)){//已开始优化的时间结算
|
153
|
if(in_array($item['id'],$this->projectId)){//已开始优化的时间结算
|
|
@@ -173,6 +161,14 @@ class RemainDay extends Command |
|
@@ -173,6 +161,14 @@ class RemainDay extends Command |
|
173
|
$remain_day = $deploy_build['service_duration'] - $compliance_day;
|
161
|
$remain_day = $deploy_build['service_duration'] - $compliance_day;
|
|
174
|
}else{
|
162
|
}else{
|
|
175
|
$compliance_day = ($item['finish_remain_day'] ?? 0);
|
163
|
$compliance_day = ($item['finish_remain_day'] ?? 0);
|
|
|
|
164
|
+ //todo::7.5版本单独计算
|
|
|
|
165
|
+ if($item['version'] == 7.5 && $deploy_build['seo_plan'] != 0 && $deploy_build['plan'] != 0){
|
|
|
|
166
|
+ $geoCountModel = new GeoCount();
|
|
|
|
167
|
+ $is_qualify = $geoCountModel->where('project_id', $item['id'])->orderBy('id', 'desc')->value('is_qualify');
|
|
|
|
168
|
+ if($compliance_day > 0 && $is_qualify > 0){
|
|
|
|
169
|
+ $compliance_day = 1;
|
|
|
|
170
|
+ }
|
|
|
|
171
|
+ }
|
|
176
|
$remain_day = $deploy_build['service_duration'] - $compliance_day;
|
172
|
$remain_day = $deploy_build['service_duration'] - $compliance_day;
|
|
177
|
}
|
173
|
}
|
|
178
|
}else{
|
174
|
}else{
|