|
...
|
...
|
@@ -73,20 +73,15 @@ class ReplaceHtmlLogic extends BaseLogic |
|
|
|
$this->fail('当前类型不存在,请联系管理员');
|
|
|
|
}
|
|
|
|
$template_id = $this->getTemplateId($typeInfo);
|
|
|
|
//TODO::生成一条任务记录
|
|
|
|
$replaceId = $this->saveReplaceHtml($this->param,$typeInfo,$template_id);
|
|
|
|
//查询当前类型所有装修的记录
|
|
|
|
$bTemplateModel = new BTemplate();
|
|
|
|
$condition = ['source'=>$typeInfo['type'],'is_custom'=>$typeInfo['is_custom'],'is_list'=>$typeInfo['is_list'], 'template_id'=>$template_id];
|
|
|
|
$list = $bTemplateModel->list($condition);
|
|
|
|
//TODO::生成一条任务记录
|
|
|
|
$total_num = count($list);
|
|
|
|
$replaceId = $this->saveReplaceHtml($this->param,$typeInfo,$template_id,$total_num);
|
|
|
|
foreach ($list as $v){
|
|
|
|
if($v['type'] == 0){
|
|
|
|
$main_html = str_replace($this->param['old_html'],$this->param['html'],$v['main_html']);
|
|
|
|
$this->model->edit(['main_html'=>$main_html],['id'=>$v['id']]);
|
|
|
|
}else{
|
|
|
|
$html = str_replace($this->param['old_html'],$this->param['html'],$v['html']);
|
|
|
|
$this->model->edit(['html'=>$html],['id'=>$v['id']]);
|
|
|
|
}
|
|
|
|
//生成子任务
|
|
|
|
$this->saveReplaceHtmlLog($replaceId,$v['id']);
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
...
|
...
|
@@ -99,15 +94,17 @@ class ReplaceHtmlLogic extends BaseLogic |
|
|
|
* @method :post
|
|
|
|
* @time :2024/5/8 9:23
|
|
|
|
*/
|
|
|
|
public function saveReplaceHtml($param,$data,$template_id){
|
|
|
|
public function saveReplaceHtml($param,$data,$template_id,$total_num){
|
|
|
|
$logData = [
|
|
|
|
'type'=>$data['type'],
|
|
|
|
'is_custom'=>$data['is_custom'],
|
|
|
|
'is_list'=>$data['is_list'],
|
|
|
|
'template_id'=>$template_id,
|
|
|
|
'status'=>BTemplate::STATUS,
|
|
|
|
'old_html'=>$param['old_html'],
|
|
|
|
'html'=>$param['html'],
|
|
|
|
'project_id'=>$param['project_id'],
|
|
|
|
'total_num'=>$total_num,
|
|
|
|
];
|
|
|
|
return $this->model->addReturnId($logData);
|
|
|
|
}
|
...
|
...
|
|