|
@@ -10,8 +10,11 @@ |
|
@@ -10,8 +10,11 @@ |
|
10
|
namespace App\Http\Logic\Aside\Template;
|
10
|
namespace App\Http\Logic\Aside\Template;
|
|
11
|
|
11
|
|
|
12
|
use App\Http\Logic\aside\BaseLogic;
|
12
|
use App\Http\Logic\aside\BaseLogic;
|
|
|
|
13
|
+use App\Models\Template\BTemplate;
|
|
13
|
use App\Models\Template\TemplateReplaceHtml;
|
14
|
use App\Models\Template\TemplateReplaceHtml;
|
|
14
|
use App\Models\Template\TemplateReplaceHtmlLog;
|
15
|
use App\Models\Template\TemplateReplaceHtmlLog;
|
|
|
|
16
|
+use App\Services\ProjectServer;
|
|
|
|
17
|
+use Illuminate\Support\Facades\DB;
|
|
15
|
|
18
|
|
|
16
|
class ReplaceHtmlLogic extends BaseLogic
|
19
|
class ReplaceHtmlLogic extends BaseLogic
|
|
17
|
{
|
20
|
{
|
|
@@ -30,6 +33,7 @@ class ReplaceHtmlLogic extends BaseLogic |
|
@@ -30,6 +33,7 @@ class ReplaceHtmlLogic extends BaseLogic |
|
30
|
* @time :2024/5/7 15:52
|
33
|
* @time :2024/5/7 15:52
|
|
31
|
*/
|
34
|
*/
|
|
32
|
public function replaceHtml(){
|
35
|
public function replaceHtml(){
|
|
|
|
36
|
+ ProjectServer::useProject($this->param['project_id']);
|
|
33
|
$type = $this->getCustomizedType($this->param['type'], $this->param['is_list']);//获取定制界面类型
|
37
|
$type = $this->getCustomizedType($this->param['type'], $this->param['is_list']);//获取定制界面类型
|
|
34
|
//查看当前页面是否定制,是否开启可视化
|
38
|
//查看当前页面是否定制,是否开启可视化
|
|
35
|
$page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
|
39
|
$page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
|
|
@@ -52,6 +56,7 @@ class ReplaceHtmlLogic extends BaseLogic |
|
@@ -52,6 +56,7 @@ class ReplaceHtmlLogic extends BaseLogic |
|
52
|
}
|
56
|
}
|
|
53
|
$this->saveReplaceHtmlLog($replaceId,$v['id']);
|
57
|
$this->saveReplaceHtmlLog($replaceId,$v['id']);
|
|
54
|
}
|
58
|
}
|
|
|
|
59
|
+ DB::disconnect('custom_mysql');
|
|
55
|
return $this->success();
|
60
|
return $this->success();
|
|
56
|
}
|
61
|
}
|
|
57
|
|
62
|
|
|
@@ -90,4 +95,42 @@ class ReplaceHtmlLogic extends BaseLogic |
|
@@ -90,4 +95,42 @@ class ReplaceHtmlLogic extends BaseLogic |
|
90
|
$replaceHtmlModel = new TemplateReplaceHtmlLog();
|
95
|
$replaceHtmlModel = new TemplateReplaceHtmlLog();
|
|
91
|
return $replaceHtmlModel->add($logData);
|
96
|
return $replaceHtmlModel->add($logData);
|
|
92
|
}
|
97
|
}
|
|
|
|
98
|
+
|
|
|
|
99
|
+ /**
|
|
|
|
100
|
+ * @remark :还原所有记录
|
|
|
|
101
|
+ * @name :reductionHtml
|
|
|
|
102
|
+ * @author :lyh
|
|
|
|
103
|
+ * @method :post
|
|
|
|
104
|
+ * @time :2024/5/8 10:35
|
|
|
|
105
|
+ */
|
|
|
|
106
|
+ public function reductionHtml(){
|
|
|
|
107
|
+ ProjectServer::useProject($this->param['project_id']);
|
|
|
|
108
|
+ //获取当前数据详情
|
|
|
|
109
|
+ $info = $this->model->read(['id'=>$this->param['id']]);
|
|
|
|
110
|
+ if($info === false){
|
|
|
|
111
|
+ $this->fail('当前数据不存在');
|
|
|
|
112
|
+ }
|
|
|
|
113
|
+ $replaceLogModel = new TemplateReplaceHtmlLog();
|
|
|
|
114
|
+ $logList = $replaceLogModel->list(['replace_id'=>$this->param['id']]);
|
|
|
|
115
|
+ $replaceArr = [];
|
|
|
|
116
|
+ foreach ($logList as $v){
|
|
|
|
117
|
+ $replaceArr[] = $v['replace_template_id'];
|
|
|
|
118
|
+ }
|
|
|
|
119
|
+ if(!empty($replaceArr)){
|
|
|
|
120
|
+ //查询可视化数据
|
|
|
|
121
|
+ $bTemplateModel = new BTemplate();
|
|
|
|
122
|
+ $templateList = $bTemplateModel->list(['id'=>['in',$replaceArr]]);
|
|
|
|
123
|
+ foreach ($templateList as $value){
|
|
|
|
124
|
+ if($v['type'] == 0){
|
|
|
|
125
|
+ $main_html = str_replace($info['html'],$info['old_html'],$value['main_html']);
|
|
|
|
126
|
+ $this->model->edit(['main_html'=>$main_html],['id'=>$v['id']]);
|
|
|
|
127
|
+ }else{
|
|
|
|
128
|
+ $html = str_replace($info['html'],$info['old_html'],$value['html']);
|
|
|
|
129
|
+ $this->model->edit(['html'=>$html],['id'=>$v['id']]);
|
|
|
|
130
|
+ }
|
|
|
|
131
|
+ }
|
|
|
|
132
|
+ }
|
|
|
|
133
|
+ DB::disconnect('custom_mysql');
|
|
|
|
134
|
+ return $this->success();
|
|
|
|
135
|
+ }
|
|
93
|
} |
136
|
} |