|
...
|
...
|
@@ -10,8 +10,11 @@ |
|
|
|
namespace App\Http\Logic\Aside\Template;
|
|
|
|
|
|
|
|
use App\Http\Logic\aside\BaseLogic;
|
|
|
|
use App\Models\Template\BTemplate;
|
|
|
|
use App\Models\Template\TemplateReplaceHtml;
|
|
|
|
use App\Models\Template\TemplateReplaceHtmlLog;
|
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
|
|
class ReplaceHtmlLogic extends BaseLogic
|
|
|
|
{
|
|
...
|
...
|
@@ -30,6 +33,7 @@ class ReplaceHtmlLogic extends BaseLogic |
|
|
|
* @time :2024/5/7 15:52
|
|
|
|
*/
|
|
|
|
public function replaceHtml(){
|
|
|
|
ProjectServer::useProject($this->param['project_id']);
|
|
|
|
$type = $this->getCustomizedType($this->param['type'], $this->param['is_list']);//获取定制界面类型
|
|
|
|
//查看当前页面是否定制,是否开启可视化
|
|
|
|
$page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
|
|
...
|
...
|
@@ -52,6 +56,7 @@ class ReplaceHtmlLogic extends BaseLogic |
|
|
|
}
|
|
|
|
$this->saveReplaceHtmlLog($replaceId,$v['id']);
|
|
|
|
}
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -90,4 +95,42 @@ class ReplaceHtmlLogic extends BaseLogic |
|
|
|
$replaceHtmlModel = new TemplateReplaceHtmlLog();
|
|
|
|
return $replaceHtmlModel->add($logData);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :还原所有记录
|
|
|
|
* @name :reductionHtml
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/5/8 10:35
|
|
|
|
*/
|
|
|
|
public function reductionHtml(){
|
|
|
|
ProjectServer::useProject($this->param['project_id']);
|
|
|
|
//获取当前数据详情
|
|
|
|
$info = $this->model->read(['id'=>$this->param['id']]);
|
|
|
|
if($info === false){
|
|
|
|
$this->fail('当前数据不存在');
|
|
|
|
}
|
|
|
|
$replaceLogModel = new TemplateReplaceHtmlLog();
|
|
|
|
$logList = $replaceLogModel->list(['replace_id'=>$this->param['id']]);
|
|
|
|
$replaceArr = [];
|
|
|
|
foreach ($logList as $v){
|
|
|
|
$replaceArr[] = $v['replace_template_id'];
|
|
|
|
}
|
|
|
|
if(!empty($replaceArr)){
|
|
|
|
//查询可视化数据
|
|
|
|
$bTemplateModel = new BTemplate();
|
|
|
|
$templateList = $bTemplateModel->list(['id'=>['in',$replaceArr]]);
|
|
|
|
foreach ($templateList as $value){
|
|
|
|
if($v['type'] == 0){
|
|
|
|
$main_html = str_replace($info['html'],$info['old_html'],$value['main_html']);
|
|
|
|
$this->model->edit(['main_html'=>$main_html],['id'=>$v['id']]);
|
|
|
|
}else{
|
|
|
|
$html = str_replace($info['html'],$info['old_html'],$value['html']);
|
|
|
|
$this->model->edit(['html'=>$html],['id'=>$v['id']]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|