|
@@ -38,71 +38,10 @@ class ProjectLogic extends BaseLogic |
|
@@ -38,71 +38,10 @@ class ProjectLogic extends BaseLogic |
|
38
|
public function __construct()
|
38
|
public function __construct()
|
|
39
|
{
|
39
|
{
|
|
40
|
parent::__construct();
|
40
|
parent::__construct();
|
|
|
|
41
|
+ $this->param = $this->requestAll;
|
|
41
|
$this->model = new Project();
|
42
|
$this->model = new Project();
|
|
42
|
}
|
43
|
}
|
|
43
|
|
44
|
|
|
44
|
- public function getList(array $map = [], array $sort = ['id' => 'desc'], array $columns = ['*'], int $limit = 20)
|
|
|
|
45
|
- {
|
|
|
|
46
|
-
|
|
|
|
47
|
- parent::setWith(['payment', 'deploy_build', 'deploy_optimize','online_check']);
|
|
|
|
48
|
- $list = parent::getList($map, $sort, ['id', 'title', 'mysql_id' ,'channel','cooperate_date' ,'type', 'created_at'], $limit);
|
|
|
|
49
|
- $managerLogic = new ManageLogic();
|
|
|
|
50
|
- foreach ($list['list'] as &$item){
|
|
|
|
51
|
- if($item['mysql_id'] != 0){
|
|
|
|
52
|
- $data = APublicModel::getNumByProjectId($item['id']);
|
|
|
|
53
|
- }
|
|
|
|
54
|
- $item = [
|
|
|
|
55
|
- 'id' => $item['id'],
|
|
|
|
56
|
- 'title' => $item['title'],
|
|
|
|
57
|
- 'channel' => Channel::getChannelText($item['channel']['user_id'] ?? 0),
|
|
|
|
58
|
- 'key' => $item['deploy_build']['keyword_num'] ?? 0,
|
|
|
|
59
|
- 'day' => $item['deploy_build']['service_duration'] ?? 0,
|
|
|
|
60
|
- 'amount' => $item['payment']['amount'] ?? 0,
|
|
|
|
61
|
- 'build_leader' => $managerLogic->getCacheName($item['deploy_build']['leader_mid'] ?? 0), //组长
|
|
|
|
62
|
- 'build_manager' => $managerLogic->getCacheName($item['deploy_build']['manager_mid'] ?? 0), //项目经理
|
|
|
|
63
|
- 'build_designer' => $managerLogic->getCacheName($item['deploy_build']['designer_mid'] ?? 0), //设计师
|
|
|
|
64
|
- 'build_tech' => $managerLogic->getCacheName($item['deploy_build']['tech_mid'] ?? 0), //技术助理
|
|
|
|
65
|
- 'optimize_manager' => $managerLogic->getCacheName($item['deploy_optimize']['manager_mid'] ?? 0), //优化服务经理
|
|
|
|
66
|
- 'optimize_optimist' => $managerLogic->getCacheName($item['deploy_optimize']['optimist_mid'] ?? 0), //优化师
|
|
|
|
67
|
- 'optimize_assist' => $managerLogic->getCacheName($item['deploy_optimize']['assist_mid'] ?? 0), //优化助理
|
|
|
|
68
|
- 'optimize_tech' => $managerLogic->getCacheName($item['deploy_optimize']['tech_mid'] ?? 0), //售后技术
|
|
|
|
69
|
- 'type' => $item['type'],
|
|
|
|
70
|
- 'test_domain' => $item['deploy_build']['test_domain'] ?? 0,
|
|
|
|
71
|
- 'plan' =>Project::planMap()[$item['deploy_build']['plan']],
|
|
|
|
72
|
- 'domain' => $item['deploy_optimize']['domain'] ?? 0,
|
|
|
|
73
|
- 'created_at' => date('Y年m月d日', strtotime($item['created_at'])),
|
|
|
|
74
|
- 'product_num' => $data['product'] ?? 0,
|
|
|
|
75
|
- 'keyword_num' => $item['deploy_build']['keyword_num'] ?? 0,
|
|
|
|
76
|
- 'article_num' => ($data['blog'] ?? 0) + ($data['news'] ?? 0),
|
|
|
|
77
|
- 'task_finish_num' => Task::getNumByProjectId($item['id'], Task::STATUS_DOWN),
|
|
|
|
78
|
- 'task_pending_num' => Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]),
|
|
|
|
79
|
- 'optimist_status'=>$item['online_check']['optimist_status'] ?? 0,
|
|
|
|
80
|
- 'qa_status'=>$item['online_check']['qa_status'] ?? 0,
|
|
|
|
81
|
- 'service_day'=>$item['deploy_build']['service_duration'] - $this->compliance_day($item['id']),
|
|
|
|
82
|
- ];
|
|
|
|
83
|
- }
|
|
|
|
84
|
- return $list;
|
|
|
|
85
|
- }
|
|
|
|
86
|
-
|
|
|
|
87
|
-
|
|
|
|
88
|
- /**
|
|
|
|
89
|
- * @param $yesterday
|
|
|
|
90
|
- * @name :(服务达标天数)compliance_day
|
|
|
|
91
|
- * @author :lyh
|
|
|
|
92
|
- * @method :post
|
|
|
|
93
|
- * @time :2023/6/14 15:48
|
|
|
|
94
|
- */
|
|
|
|
95
|
- public function compliance_day($project_id){
|
|
|
|
96
|
- //服务达标天数
|
|
|
|
97
|
- $rank_info = DB::table('gl_rank_data')->where(['project_id'=>$project_id,'lang'=>''])->select(['compliance_day'])->first();
|
|
|
|
98
|
- if(empty($rank_info)){
|
|
|
|
99
|
- $compliance_day = 0;
|
|
|
|
100
|
- }else{
|
|
|
|
101
|
- $compliance_day = $rank_info->compliance_day;
|
|
|
|
102
|
- }
|
|
|
|
103
|
- return $compliance_day;
|
|
|
|
104
|
- }
|
|
|
|
105
|
-
|
|
|
|
106
|
/**
|
45
|
/**
|
|
107
|
* @remark :获取当前数据详情
|
46
|
* @remark :获取当前数据详情
|
|
108
|
* @name :getProjectInfo
|
47
|
* @name :getProjectInfo
|
|
@@ -130,6 +69,160 @@ class ProjectLogic extends BaseLogic |
|
@@ -130,6 +69,160 @@ class ProjectLogic extends BaseLogic |
|
130
|
}
|
69
|
}
|
|
131
|
|
70
|
|
|
132
|
/**
|
71
|
/**
|
|
|
|
72
|
+ * @remark :保存项目数据
|
|
|
|
73
|
+ * @name :projectSave
|
|
|
|
74
|
+ * @author :lyh
|
|
|
|
75
|
+ * @method :post
|
|
|
|
76
|
+ * @time :2023/8/30 11:57
|
|
|
|
77
|
+ */
|
|
|
|
78
|
+ public function projectSave(){
|
|
|
|
79
|
+// DB::beginTransaction();
|
|
|
|
80
|
+// try {
|
|
|
|
81
|
+ $this->createProjectData($this->param);
|
|
|
|
82
|
+ //保存项目信息
|
|
|
|
83
|
+ $this->saveProject($this->param);
|
|
|
|
84
|
+ //保存建站部署信息
|
|
|
|
85
|
+ $this->saveProjectDeployBuild($this->param['deploy_build']);
|
|
|
|
86
|
+ //保存付费信息
|
|
|
|
87
|
+ $this->saveProjectPayment($this->param['payment']);
|
|
|
|
88
|
+ //保存优化信息
|
|
|
|
89
|
+ $this->saveProjectDeployOptimize($this->param['deploy_optimize']);
|
|
|
|
90
|
+ //保存售后信息
|
|
|
|
91
|
+ $this->saveProjectAfter($this->param['deploy_build']);
|
|
|
|
92
|
+// }catch (\Exception $e){
|
|
|
|
93
|
+// DB::rollBack();
|
|
|
|
94
|
+// $this->fail('error');
|
|
|
|
95
|
+// }
|
|
|
|
96
|
+ return $this->success();
|
|
|
|
97
|
+ }
|
|
|
|
98
|
+
|
|
|
|
99
|
+ /**
|
|
|
|
100
|
+ * @remark :未续费项目单独保存
|
|
|
|
101
|
+ * @name :setExtendType
|
|
|
|
102
|
+ * @author :lyh
|
|
|
|
103
|
+ * @method :post
|
|
|
|
104
|
+ * @time :2023/8/30 12:14
|
|
|
|
105
|
+ */
|
|
|
|
106
|
+ public function saveProject($param){
|
|
|
|
107
|
+ //未续费项目
|
|
|
|
108
|
+ if($param['type'] == Project::TYPE_FIVE){
|
|
|
|
109
|
+ $param['extend_type'] == Project::TYPE_FIVE;
|
|
|
|
110
|
+ unset($param['type']);
|
|
|
|
111
|
+ }
|
|
|
|
112
|
+ if(isset($param['level']) && !empty($param['level'])){
|
|
|
|
113
|
+ $param['level'] = Arr::arrToSet($param['level']);
|
|
|
|
114
|
+ }
|
|
|
|
115
|
+ if(isset($param['channel']) && !empty($param['channel'])){
|
|
|
|
116
|
+ $param['channel'] = Arr::a2s($param['channel']);
|
|
|
|
117
|
+ }
|
|
|
|
118
|
+ if(isset($param['notice_file']) && !empty($param['notice_file'])){
|
|
|
|
119
|
+ foreach ($param['notice_file'] as &$v1) {
|
|
|
|
120
|
+ $v1['url'] = basename($v1['url']);
|
|
|
|
121
|
+ }
|
|
|
|
122
|
+ $param['notice_file'] = Arr::a2s($param['notice_file']);
|
|
|
|
123
|
+ }
|
|
|
|
124
|
+ if(isset($param['confirm_file']) && !empty($param['confirm_file'])){
|
|
|
|
125
|
+ foreach ($param['confirm_file'] as &$v2) {
|
|
|
|
126
|
+ $v2['url'] = basename($v2['url']);
|
|
|
|
127
|
+ }
|
|
|
|
128
|
+ $param['confirm_file'] = Arr::a2s($param['confirm_file']);
|
|
|
|
129
|
+ }
|
|
|
|
130
|
+ $this->model->edit($param,['id'=>$param['id']]);
|
|
|
|
131
|
+ Common::del_user_cache($this->model->getTable(),$param['id']);
|
|
|
|
132
|
+ return $this->success();
|
|
|
|
133
|
+ }
|
|
|
|
134
|
+
|
|
|
|
135
|
+ /**
|
|
|
|
136
|
+ * @remark :保存付款续费
|
|
|
|
137
|
+ * @name :savePayment
|
|
|
|
138
|
+ * @author :lyh
|
|
|
|
139
|
+ * @method :post
|
|
|
|
140
|
+ * @time :2023/8/29 16:19
|
|
|
|
141
|
+ */
|
|
|
|
142
|
+ protected function saveProjectPayment($payment){
|
|
|
|
143
|
+ $paymentModel = new Payment();
|
|
|
|
144
|
+// $payment['contract'] = Arr::a2s($payment['contract']);
|
|
|
|
145
|
+ if(isset($payment['renewal_record']) && !empty($payment['renewal_record'])){
|
|
|
|
146
|
+ $payment['renewal_record'] = Arr::a2s($payment['renewal_record']);
|
|
|
|
147
|
+ }
|
|
|
|
148
|
+ $paymentModel->edit($payment,['id'=>$payment['id']]);
|
|
|
|
149
|
+ return $this->success();
|
|
|
|
150
|
+ }
|
|
|
|
151
|
+
|
|
|
|
152
|
+ /**
|
|
|
|
153
|
+ * @remark :保存建站部署
|
|
|
|
154
|
+ * @name :saveDeployBuild
|
|
|
|
155
|
+ * @author :lyh
|
|
|
|
156
|
+ * @method :post
|
|
|
|
157
|
+ * @time :2023/8/29 16:19
|
|
|
|
158
|
+ */
|
|
|
|
159
|
+ protected function saveProjectDeployBuild($deploy_build){
|
|
|
|
160
|
+ $deployBuildModel = new DeployBuild();
|
|
|
|
161
|
+ $deployBuildModel->edit($deploy_build,['id'=>$deploy_build['id']]);
|
|
|
|
162
|
+ return $this->success();
|
|
|
|
163
|
+ }
|
|
|
|
164
|
+
|
|
|
|
165
|
+ /**
|
|
|
|
166
|
+ * @remark :保存优化部署
|
|
|
|
167
|
+ * @name :saveDeployOptimize
|
|
|
|
168
|
+ * @author :lyh
|
|
|
|
169
|
+ * @method :post
|
|
|
|
170
|
+ * @time :2023/8/30 13:45
|
|
|
|
171
|
+ */
|
|
|
|
172
|
+ protected function saveProjectDeployOptimize($deploy_optimize){
|
|
|
|
173
|
+ if(isset($deploy_optimize['domain']) && !$deploy_optimize($deploy_optimize['domain'])){
|
|
|
|
174
|
+ if (!preg_match('/http/', $deploy_optimize['domain'])) {
|
|
|
|
175
|
+ $deploy_optimize['domain'] = 'https://'.trim($deploy_optimize['domain'],'/').'/';
|
|
|
|
176
|
+ }
|
|
|
|
177
|
+ }
|
|
|
|
178
|
+ if(isset($deploy_optimize['minor_languages']) && !empty($deploy_optimize['minor_languages'])){
|
|
|
|
179
|
+ $deploy_optimize['minor_languages'] = Arr::a2s($deploy_optimize['minor_languages']);
|
|
|
|
180
|
+ }
|
|
|
|
181
|
+ $this->model->edit($deploy_optimize,['id'=>$this->param['id']]);
|
|
|
|
182
|
+ return $this->success();
|
|
|
|
183
|
+ }
|
|
|
|
184
|
+
|
|
|
|
185
|
+ /**
|
|
|
|
186
|
+ * @remark :保存为售后部署
|
|
|
|
187
|
+ * @name :saveProjectAfter
|
|
|
|
188
|
+ * @author :lyh
|
|
|
|
189
|
+ * @method :post
|
|
|
|
190
|
+ * @time :2023/8/30 13:57
|
|
|
|
191
|
+ */
|
|
|
|
192
|
+ protected function saveProjectAfter($project_after){
|
|
|
|
193
|
+ //查询数据是否存在
|
|
|
|
194
|
+ $afterModel = new After();
|
|
|
|
195
|
+ $afterModel->edit($project_after,['id'=>$project_after['id']]);
|
|
|
|
196
|
+ return $this->success();
|
|
|
|
197
|
+ }
|
|
|
|
198
|
+
|
|
|
|
199
|
+ /**
|
|
|
|
200
|
+ * @remark :创建初始数据
|
|
|
|
201
|
+ * @name :createProjectData
|
|
|
|
202
|
+ * @author :lyh
|
|
|
|
203
|
+ * @method :post
|
|
|
|
204
|
+ * @time :2023/8/30 14:30
|
|
|
|
205
|
+ */
|
|
|
|
206
|
+ public function createProjectData($param){
|
|
|
|
207
|
+ //创建默认数据库
|
|
|
|
208
|
+ if($param['type'] == Project::TYPE_ONE){
|
|
|
|
209
|
+ //初始化数据库
|
|
|
|
210
|
+ if(isset($param['mysql_id']) && !empty($param['mysql_id'])){
|
|
|
|
211
|
+ $this->initializationMysql($param['id']);
|
|
|
|
212
|
+ }
|
|
|
|
213
|
+ //初始账号
|
|
|
|
214
|
+ if(isset($param['mobile']) && !empty($param['mobile'])){
|
|
|
|
215
|
+ $this->createUser($param['mobile'],$param['id'],$param['lead_name']);
|
|
|
|
216
|
+ }
|
|
|
|
217
|
+ //更改服务器状态
|
|
|
|
218
|
+ if(isset($param['serve_id']) && !empty($param['serve_id'])){
|
|
|
|
219
|
+ $this->updateServe($param['serve_id']);
|
|
|
|
220
|
+ }
|
|
|
|
221
|
+ }
|
|
|
|
222
|
+ return $this->success();
|
|
|
|
223
|
+ }
|
|
|
|
224
|
+
|
|
|
|
225
|
+ /**
|
|
133
|
* @remark :保存项目配置数据
|
226
|
* @remark :保存项目配置数据
|
|
134
|
* @name :save
|
227
|
* @name :save
|
|
135
|
* @author :lyh
|
228
|
* @author :lyh
|
|
@@ -145,7 +238,6 @@ class ProjectLogic extends BaseLogic |
|
@@ -145,7 +238,6 @@ class ProjectLogic extends BaseLogic |
|
145
|
}
|
238
|
}
|
|
146
|
$res = parent::save($param);
|
239
|
$res = parent::save($param);
|
|
147
|
$param['id'] = $res['id'];
|
240
|
$param['id'] = $res['id'];
|
|
148
|
- Common::del_user_cache($this->model->getTable(),$param['id']);
|
|
|
|
149
|
$this->savePayment($param);
|
241
|
$this->savePayment($param);
|
|
150
|
$this->saveDeployBuild($param);
|
242
|
$this->saveDeployBuild($param);
|
|
151
|
$this->saveDeployOptimize($param);
|
243
|
$this->saveDeployOptimize($param);
|
|
@@ -203,6 +295,8 @@ class ProjectLogic extends BaseLogic |
|
@@ -203,6 +295,8 @@ class ProjectLogic extends BaseLogic |
|
203
|
return $this->success();
|
295
|
return $this->success();
|
|
204
|
}
|
296
|
}
|
|
205
|
|
297
|
|
|
|
|
298
|
+
|
|
|
|
299
|
+
|
|
206
|
/**
|
300
|
/**
|
|
207
|
* @remark :创建用户
|
301
|
* @remark :创建用户
|
|
208
|
* @name :createUser
|
302
|
* @name :createUser
|