|
@@ -36,7 +36,7 @@ class BTemplateLogic extends BaseLogic |
|
@@ -36,7 +36,7 @@ class BTemplateLogic extends BaseLogic |
|
36
|
}
|
36
|
}
|
|
37
|
|
37
|
|
|
38
|
/**
|
38
|
/**
|
|
39
|
- * @remark :获取当前选择的模板
|
39
|
+ * @remark :获取当前选择使用的模板
|
|
40
|
* @name :getModuleTemplate
|
40
|
* @name :getModuleTemplate
|
|
41
|
* @author :lyh
|
41
|
* @author :lyh
|
|
42
|
* @method :post
|
42
|
* @method :post
|
|
@@ -47,8 +47,13 @@ class BTemplateLogic extends BaseLogic |
|
@@ -47,8 +47,13 @@ class BTemplateLogic extends BaseLogic |
|
47
|
$info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
|
47
|
$info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
|
|
48
|
$TemplateInfo = [];
|
48
|
$TemplateInfo = [];
|
|
49
|
if($info !== false){
|
49
|
if($info !== false){
|
|
50
|
- //查看当前模板是否已编辑保存
|
|
|
|
51
|
- $TemplateInfo = $this->model->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]);
|
50
|
+ //查看当前模板是否已编辑保存web_template
|
|
|
|
51
|
+ $TemplateInfo = $this->model->read([
|
|
|
|
52
|
+ 'template_id'=>$info['template_id'],
|
|
|
|
53
|
+ 'source'=>$this->param['source'],
|
|
|
|
54
|
+ 'project_id'=>$this->user['project_id'],
|
|
|
|
55
|
+ 'source_id'=>$this->param['source_id'],
|
|
|
|
56
|
+ ]);
|
|
52
|
if($TemplateInfo === false){
|
57
|
if($TemplateInfo === false){
|
|
53
|
//获取模板详情
|
58
|
//获取模板详情
|
|
54
|
$ATemplateModel = new Template();
|
59
|
$ATemplateModel = new Template();
|
|
@@ -91,6 +96,15 @@ class BTemplateLogic extends BaseLogic |
|
@@ -91,6 +96,15 @@ class BTemplateLogic extends BaseLogic |
|
91
|
* @time :2023/6/29 11:05
|
96
|
* @time :2023/6/29 11:05
|
|
92
|
*/
|
97
|
*/
|
|
93
|
public function templateSave(){
|
98
|
public function templateSave(){
|
|
|
|
99
|
+ //查询当前模版是否已保存
|
|
|
|
100
|
+ $info = $this->model->read(
|
|
|
|
101
|
+ [
|
|
|
|
102
|
+ 'project_id'=>$this->user['project_id'],
|
|
|
|
103
|
+ 'source'=>$this->param['source'],
|
|
|
|
104
|
+ 'source_id'=>$this->param['source_id'],
|
|
|
|
105
|
+ 'template_id'=>$this->param['template_id'],
|
|
|
|
106
|
+ ]
|
|
|
|
107
|
+ );
|
|
94
|
//字符串截取
|
108
|
//字符串截取
|
|
95
|
$this->param['head_html'] = characterTruncation($this->param['html'],'<header>','</header>');
|
109
|
$this->param['head_html'] = characterTruncation($this->param['html'],'<header>','</header>');
|
|
96
|
$this->param['main_html'] = characterTruncation($this->param['html'],'<main>','</main>');
|
110
|
$this->param['main_html'] = characterTruncation($this->param['html'],'<main>','</main>');
|
|
@@ -98,11 +112,11 @@ class BTemplateLogic extends BaseLogic |
|
@@ -98,11 +112,11 @@ class BTemplateLogic extends BaseLogic |
|
98
|
$this->param['head_css'] = characterTruncation($this->param['html'],'<style id="vvvebjs-header">','</style>');
|
112
|
$this->param['head_css'] = characterTruncation($this->param['html'],'<style id="vvvebjs-header">','</style>');
|
|
99
|
$this->param['main_css'] = characterTruncation($this->param['html'],'<style id="vvvebjs-style">','</style>');
|
113
|
$this->param['main_css'] = characterTruncation($this->param['html'],'<style id="vvvebjs-style">','</style>');
|
|
100
|
$this->param['footer_css'] = characterTruncation($this->param['html'],'<style id="vvvebjs-footer">','</style>');
|
114
|
$this->param['footer_css'] = characterTruncation($this->param['html'],'<style id="vvvebjs-footer">','</style>');
|
|
101
|
- if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
102
|
- $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
103
|
- }else{
|
115
|
+ if($info === false){
|
|
104
|
$this->param['project_id'] = $this->user['project_id'];
|
116
|
$this->param['project_id'] = $this->user['project_id'];
|
|
105
|
$rs = $this->model->add($this->param);
|
117
|
$rs = $this->model->add($this->param);
|
|
|
|
118
|
+ }else{
|
|
|
|
119
|
+ $rs = $this->model->edit($this->param,['id'=>$info['id']]);
|
|
106
|
}
|
120
|
}
|
|
107
|
if($rs === false){
|
121
|
if($rs === false){
|
|
108
|
$this->fail('error');
|
122
|
$this->fail('error');
|