|
@@ -204,19 +204,19 @@ class ReplaceHtmlLogic extends BaseLogic |
|
@@ -204,19 +204,19 @@ class ReplaceHtmlLogic extends BaseLogic |
|
204
|
* @method :post
|
204
|
* @method :post
|
|
205
|
* @time :2024/5/10 10:01
|
205
|
* @time :2024/5/10 10:01
|
|
206
|
*/
|
206
|
*/
|
|
207
|
- public function saveResultReplaceHtml($info){
|
207
|
+ public function saveResultReplaceHtml($info,$status = 0,$num = 0){
|
|
208
|
$logData = [
|
208
|
$logData = [
|
|
209
|
'source'=>$info['source'],
|
209
|
'source'=>$info['source'],
|
|
210
|
'is_custom'=>$info['is_custom'],
|
210
|
'is_custom'=>$info['is_custom'],
|
|
211
|
'is_list'=>$info['is_list'],
|
211
|
'is_list'=>$info['is_list'],
|
|
212
|
'template_id'=>$info['template_id'],
|
212
|
'template_id'=>$info['template_id'],
|
|
213
|
- 'status'=>$this->model::STATUS,
|
213
|
+ 'status'=>$status != 0 ? $status : $this->model::STATUS,
|
|
214
|
'old_html'=>$info['html'],
|
214
|
'old_html'=>$info['html'],
|
|
215
|
'html'=>$info['old_html'],
|
215
|
'html'=>$info['old_html'],
|
|
216
|
'project_id'=>$info['project_id'],
|
216
|
'project_id'=>$info['project_id'],
|
|
217
|
'is_rollback'=>1,
|
217
|
'is_rollback'=>1,
|
|
218
|
'rollback_id'=>$info['id'],
|
218
|
'rollback_id'=>$info['id'],
|
|
219
|
- 'total_num'=>$info['total_num'],
|
219
|
+ 'total_num'=>($num != 0) ? $num : $info['total_num'],
|
|
220
|
'operator_id'=>$this->manager['id']
|
220
|
'operator_id'=>$this->manager['id']
|
|
221
|
];
|
221
|
];
|
|
222
|
return $this->model->addReturnId($logData);
|
222
|
return $this->model->addReturnId($logData);
|
|
@@ -268,23 +268,48 @@ class ReplaceHtmlLogic extends BaseLogic |
|
@@ -268,23 +268,48 @@ class ReplaceHtmlLogic extends BaseLogic |
|
268
|
* @time :2024/5/11 11:31
|
268
|
* @time :2024/5/11 11:31
|
|
269
|
*/
|
269
|
*/
|
|
270
|
public function rollbackIdHtml(){
|
270
|
public function rollbackIdHtml(){
|
|
271
|
- $replaceHtmlLogModel = new TemplateReplaceHtmlLog();
|
|
|
|
272
|
- $info = $replaceHtmlLogModel->read(['id'=>$this->param['id']]);
|
|
|
|
273
|
- ProjectServer::useProject($info['project_id']);
|
|
|
|
274
|
- $bTemplateModel = new BTemplate();
|
|
|
|
275
|
- $condition = ['source'=>$info['source'],'source_id'=>$info['source_id'],
|
|
|
|
276
|
- 'template_id'=>$info['template_id'],'is_custom'=>$info['is_custom'],'is_list'=>$info['is_list']];
|
|
|
|
277
|
- $old_html = $info['old_html'];
|
|
|
|
278
|
- $html = $info['html'];
|
|
|
|
279
|
- if($info['template_id'] == 0){
|
|
|
|
280
|
- $bTemplateModel->formatQuery($condition)->update(['html' => DB::raw("REPLACE(html, '$old_html', '$html')")]);
|
|
|
|
281
|
- }else{
|
|
|
|
282
|
- $bTemplateModel->formatQuery($condition)->update(['main_html' => DB::raw("REPLACE(main_html, '$old_html', '$html')")]);
|
271
|
+ if(is_array($this->param['id']) && isset($this->param['id'])){
|
|
|
|
272
|
+ $save_id = 0;
|
|
|
|
273
|
+ foreach ($this->param['id'] as $k => $id){
|
|
|
|
274
|
+ $replaceHtmlLogModel = new TemplateReplaceHtmlLog();
|
|
|
|
275
|
+ $logInfo = $replaceHtmlLogModel->read(['id'=>$id]);
|
|
|
|
276
|
+ //查询当前主任务
|
|
|
|
277
|
+ $replaceHtmlModel = new TemplateReplaceHtml();
|
|
|
|
278
|
+ $info = $replaceHtmlModel->read(['id'=>$logInfo['replace_id']]);
|
|
|
|
279
|
+ if($k == 0){
|
|
|
|
280
|
+ //生成一条已完成的主记录
|
|
|
|
281
|
+ $save_id = $this->saveResultReplaceHtml($info,TemplateReplaceHtml::STATUS_END,count($this->param['id']));
|
|
|
|
282
|
+ }
|
|
|
|
283
|
+ //生成一条子记录
|
|
|
|
284
|
+ $this->saveResultSonInfo($save_id,$logInfo);
|
|
|
|
285
|
+ }
|
|
283
|
}
|
286
|
}
|
|
284
|
- //修改当前数据为还原数据
|
|
|
|
285
|
- $replaceHtmlLogModel->edit(['is_rollback'=>1],['id'=>$this->param['id']]);
|
|
|
|
286
|
- DB::disconnect('custom_mysql');
|
|
|
|
287
|
return $this->success();
|
287
|
return $this->success();
|
|
288
|
}
|
288
|
}
|
|
289
|
|
289
|
|
|
|
|
290
|
+ /**
|
|
|
|
291
|
+ * @remark :生成一条还原子记录
|
|
|
|
292
|
+ * @name :saveResultSonInfo
|
|
|
|
293
|
+ * @author :lyh
|
|
|
|
294
|
+ * @method :post
|
|
|
|
295
|
+ * @time :2024/5/13 15:14
|
|
|
|
296
|
+ */
|
|
|
|
297
|
+ public function saveResultSonInfo($save_id,$logInfo){
|
|
|
|
298
|
+ $saveData = [
|
|
|
|
299
|
+ 'replace_id'=>$save_id,
|
|
|
|
300
|
+ 'project_id'=>$logInfo['project_id'],
|
|
|
|
301
|
+ 'status'=>TemplateReplaceHtmlLog::STATUS,
|
|
|
|
302
|
+ 'old_html'=>$logInfo['html'],
|
|
|
|
303
|
+ 'html'=>$logInfo['old_html'],
|
|
|
|
304
|
+ 'source'=>$logInfo['source'],
|
|
|
|
305
|
+ 'source_id'=>$logInfo['source_id'],
|
|
|
|
306
|
+ 'is_custom'=>$logInfo['is_custom'],
|
|
|
|
307
|
+ 'is_list'=>$logInfo['is_list'],
|
|
|
|
308
|
+ 'is_rollback'=>1,
|
|
|
|
309
|
+ 'template_id'=>$logInfo['template_id'],
|
|
|
|
310
|
+ 'source_name'=>$logInfo['source_name']
|
|
|
|
311
|
+ ];
|
|
|
|
312
|
+ $replaceHtmlLogModel = new TemplateReplaceHtmlLog();
|
|
|
|
313
|
+ return $replaceHtmlLogModel->addReturnId($saveData);
|
|
|
|
314
|
+ }
|
|
290
|
} |
315
|
} |