|
...
|
...
|
@@ -204,19 +204,19 @@ class ReplaceHtmlLogic extends BaseLogic |
|
|
|
* @method :post
|
|
|
|
* @time :2024/5/10 10:01
|
|
|
|
*/
|
|
|
|
public function saveResultReplaceHtml($info){
|
|
|
|
public function saveResultReplaceHtml($info,$status = 0,$num = 0){
|
|
|
|
$logData = [
|
|
|
|
'source'=>$info['source'],
|
|
|
|
'is_custom'=>$info['is_custom'],
|
|
|
|
'is_list'=>$info['is_list'],
|
|
|
|
'template_id'=>$info['template_id'],
|
|
|
|
'status'=>$this->model::STATUS,
|
|
|
|
'status'=>$status != 0 ? $status : $this->model::STATUS,
|
|
|
|
'old_html'=>$info['html'],
|
|
|
|
'html'=>$info['old_html'],
|
|
|
|
'project_id'=>$info['project_id'],
|
|
|
|
'is_rollback'=>1,
|
|
|
|
'rollback_id'=>$info['id'],
|
|
|
|
'total_num'=>$info['total_num'],
|
|
|
|
'total_num'=>($num != 0) ? $num : $info['total_num'],
|
|
|
|
'operator_id'=>$this->manager['id']
|
|
|
|
];
|
|
|
|
return $this->model->addReturnId($logData);
|
|
...
|
...
|
@@ -268,23 +268,48 @@ class ReplaceHtmlLogic extends BaseLogic |
|
|
|
* @time :2024/5/11 11:31
|
|
|
|
*/
|
|
|
|
public function rollbackIdHtml(){
|
|
|
|
if(is_array($this->param['id']) && isset($this->param['id'])){
|
|
|
|
$save_id = 0;
|
|
|
|
foreach ($this->param['id'] as $k => $id){
|
|
|
|
$replaceHtmlLogModel = new TemplateReplaceHtmlLog();
|
|
|
|
$info = $replaceHtmlLogModel->read(['id'=>$this->param['id']]);
|
|
|
|
ProjectServer::useProject($info['project_id']);
|
|
|
|
$bTemplateModel = new BTemplate();
|
|
|
|
$condition = ['source'=>$info['source'],'source_id'=>$info['source_id'],
|
|
|
|
'template_id'=>$info['template_id'],'is_custom'=>$info['is_custom'],'is_list'=>$info['is_list']];
|
|
|
|
$old_html = $info['old_html'];
|
|
|
|
$html = $info['html'];
|
|
|
|
if($info['template_id'] == 0){
|
|
|
|
$bTemplateModel->formatQuery($condition)->update(['html' => DB::raw("REPLACE(html, '$old_html', '$html')")]);
|
|
|
|
}else{
|
|
|
|
$bTemplateModel->formatQuery($condition)->update(['main_html' => DB::raw("REPLACE(main_html, '$old_html', '$html')")]);
|
|
|
|
$logInfo = $replaceHtmlLogModel->read(['id'=>$id]);
|
|
|
|
//查询当前主任务
|
|
|
|
$replaceHtmlModel = new TemplateReplaceHtml();
|
|
|
|
$info = $replaceHtmlModel->read(['id'=>$logInfo['replace_id']]);
|
|
|
|
if($k == 0){
|
|
|
|
//生成一条已完成的主记录
|
|
|
|
$save_id = $this->saveResultReplaceHtml($info,TemplateReplaceHtml::STATUS_END,count($this->param['id']));
|
|
|
|
}
|
|
|
|
//生成一条子记录
|
|
|
|
$this->saveResultSonInfo($save_id,$logInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//修改当前数据为还原数据
|
|
|
|
$replaceHtmlLogModel->edit(['is_rollback'=>1],['id'=>$this->param['id']]);
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :生成一条还原子记录
|
|
|
|
* @name :saveResultSonInfo
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/5/13 15:14
|
|
|
|
*/
|
|
|
|
public function saveResultSonInfo($save_id,$logInfo){
|
|
|
|
$saveData = [
|
|
|
|
'replace_id'=>$save_id,
|
|
|
|
'project_id'=>$logInfo['project_id'],
|
|
|
|
'status'=>TemplateReplaceHtmlLog::STATUS,
|
|
|
|
'old_html'=>$logInfo['html'],
|
|
|
|
'html'=>$logInfo['old_html'],
|
|
|
|
'source'=>$logInfo['source'],
|
|
|
|
'source_id'=>$logInfo['source_id'],
|
|
|
|
'is_custom'=>$logInfo['is_custom'],
|
|
|
|
'is_list'=>$logInfo['is_list'],
|
|
|
|
'is_rollback'=>1,
|
|
|
|
'template_id'=>$logInfo['template_id'],
|
|
|
|
'source_name'=>$logInfo['source_name']
|
|
|
|
];
|
|
|
|
$replaceHtmlLogModel = new TemplateReplaceHtmlLog();
|
|
|
|
return $replaceHtmlLogModel->addReturnId($saveData);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|