|
@@ -51,33 +51,50 @@ class CustomTemplateLogic extends BaseLogic |
|
@@ -51,33 +51,50 @@ class CustomTemplateLogic extends BaseLogic |
|
51
|
$this->fail('当前数据不存在');
|
51
|
$this->fail('当前数据不存在');
|
|
52
|
}
|
52
|
}
|
|
53
|
if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){
|
53
|
if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){
|
|
54
|
- $html = $this->getTemplateComHtml($info['html'],$info['html_style']);
|
54
|
+ $template_id = $this->getTemplateId();
|
|
|
|
55
|
+ $html = $this->getTemplateComHtml($info['html'],$info['html_style'],$template_id);
|
|
55
|
$info['html'] = $this->getHeadFooter($html);
|
56
|
$info['html'] = $this->getHeadFooter($html);
|
|
56
|
}
|
57
|
}
|
|
57
|
return $this->success($info);
|
58
|
return $this->success($info);
|
|
58
|
}
|
59
|
}
|
|
59
|
|
60
|
|
|
60
|
/**
|
61
|
/**
|
|
|
|
62
|
+ * @remark :获取模版id
|
|
|
|
63
|
+ * @name :getTemplateId
|
|
|
|
64
|
+ * @author :lyh
|
|
|
|
65
|
+ * @method :post
|
|
|
|
66
|
+ * @time :2023/12/27 10:51
|
|
|
|
67
|
+ */
|
|
|
|
68
|
+ public function getTemplateId(){
|
|
|
|
69
|
+ $bSettingModel = new Setting();
|
|
|
|
70
|
+ $bSettingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']],['id','template_id']);
|
|
|
|
71
|
+ if($bSettingInfo === false){
|
|
|
|
72
|
+ $this->fail('请先设置模板');
|
|
|
|
73
|
+ }
|
|
|
|
74
|
+ return $this->success($bSettingInfo['template_id']);
|
|
|
|
75
|
+ }
|
|
|
|
76
|
+ /**
|
|
61
|
* @remark :非定制获取头部+底部
|
77
|
* @remark :非定制获取头部+底部
|
|
62
|
* @name :getTemplateComHtml
|
78
|
* @name :getTemplateComHtml
|
|
63
|
* @author :lyh
|
79
|
* @author :lyh
|
|
64
|
* @method :post
|
80
|
* @method :post
|
|
65
|
* @time :2024/4/29 16:53
|
81
|
* @time :2024/4/29 16:53
|
|
66
|
*/
|
82
|
*/
|
|
67
|
- public function getTemplateComHtml($html,$html_style){
|
83
|
+ public function getTemplateComHtml($html,$html_style,$template_id){
|
|
68
|
if(empty($html)){
|
84
|
if(empty($html)){
|
|
69
|
$html = "<main></main>";
|
85
|
$html = "<main></main>";
|
|
70
|
$html_style = "<style id='globalsojs-styles'></style>";
|
86
|
$html_style = "<style id='globalsojs-styles'></style>";
|
|
71
|
}
|
87
|
}
|
|
72
|
- $headComInfo = $this->getHeadComHtml(['common_type'=>BTemplate::COMMON_HEAD]);
|
88
|
+ $headComInfo = $this->getHeadComHtml(['common_type'=>BTemplate::COMMON_HEAD,'template_id'=>$template_id]);
|
|
73
|
$bTemplateComModel = new BTemplateCom();
|
89
|
$bTemplateComModel = new BTemplateCom();
|
|
74
|
$condition['common_type'] = BTemplate::COMMON_OTHER;
|
90
|
$condition['common_type'] = BTemplate::COMMON_OTHER;
|
|
75
|
$condition['source'] = $headComInfo['source'];
|
91
|
$condition['source'] = $headComInfo['source'];
|
|
|
|
92
|
+ $condition['template_id'] = $template_id;
|
|
76
|
$otherInfo = $bTemplateComModel->read($condition);
|
93
|
$otherInfo = $bTemplateComModel->read($condition);
|
|
77
|
if($otherInfo === false){
|
94
|
if($otherInfo === false){
|
|
78
|
$this->fail('获取失败,请联系管理员');
|
95
|
$this->fail('获取失败,请联系管理员');
|
|
79
|
}
|
96
|
}
|
|
80
|
- $footerComInfo = $this->getFooterComHtml();
|
97
|
+ $footerComInfo = $this->getFooterComHtml($template_id);
|
|
81
|
$commonInfo = ['head_html'=>$headComInfo['html'] ?? '', 'head_style'=>$headComInfo['html_style'] ?? '', 'other'=>$otherInfo['html'] ?? '',
|
98
|
$commonInfo = ['head_html'=>$headComInfo['html'] ?? '', 'head_style'=>$headComInfo['html_style'] ?? '', 'other'=>$otherInfo['html'] ?? '',
|
|
82
|
'footer_html'=>$footerComInfo['html'] ?? '','footer_style'=>$footerComInfo['html_style'] ?? ''];
|
99
|
'footer_html'=>$footerComInfo['html'] ?? '','footer_style'=>$footerComInfo['html_style'] ?? ''];
|
|
83
|
$html = $commonInfo['head_style'].$html_style.$commonInfo['footer_style'].$commonInfo['other']. $commonInfo['head_html'].$html.$commonInfo['footer_html'];
|
100
|
$html = $commonInfo['head_style'].$html_style.$commonInfo['footer_style'].$commonInfo['other']. $commonInfo['head_html'].$html.$commonInfo['footer_html'];
|
|
@@ -98,6 +115,7 @@ class CustomTemplateLogic extends BaseLogic |
|
@@ -98,6 +115,7 @@ class CustomTemplateLogic extends BaseLogic |
|
98
|
$headComInfo = $bTemplateComModel->read($condition);
|
115
|
$headComInfo = $bTemplateComModel->read($condition);
|
|
99
|
if($headComInfo === false){
|
116
|
if($headComInfo === false){
|
|
100
|
//取默认公共的
|
117
|
//取默认公共的
|
|
|
|
118
|
+ $template_id = $this->getTemplateId();
|
|
101
|
$condition['source'] = BTemplate::SOURCE_COM;
|
119
|
$condition['source'] = BTemplate::SOURCE_COM;
|
|
102
|
$headComInfo = $bTemplateComModel->read($condition);
|
120
|
$headComInfo = $bTemplateComModel->read($condition);
|
|
103
|
if($headComInfo === false){
|
121
|
if($headComInfo === false){
|
|
@@ -113,12 +131,14 @@ class CustomTemplateLogic extends BaseLogic |
|
@@ -113,12 +131,14 @@ class CustomTemplateLogic extends BaseLogic |
|
113
|
* @method :post
|
131
|
* @method :post
|
|
114
|
* @time :2024/4/29 17:18
|
132
|
* @time :2024/4/29 17:18
|
|
115
|
*/
|
133
|
*/
|
|
116
|
- public function getFooterComHtml(){
|
134
|
+ public function getFooterComHtml($template_id){
|
|
117
|
$bTemplateComModel = new BTemplateCom();
|
135
|
$bTemplateComModel = new BTemplateCom();
|
|
|
|
136
|
+ $condition['template_id'] = $template_id;
|
|
118
|
$condition['common_type'] = BTemplate::COMMON_FOOTER;
|
137
|
$condition['common_type'] = BTemplate::COMMON_FOOTER;
|
|
119
|
$condition['source'] = $this->getType(BTemplate::COMMON_FOOTER);
|
138
|
$condition['source'] = $this->getType(BTemplate::COMMON_FOOTER);
|
|
120
|
$footerComInfo = $bTemplateComModel->read($condition);
|
139
|
$footerComInfo = $bTemplateComModel->read($condition);
|
|
121
|
if($footerComInfo === false){
|
140
|
if($footerComInfo === false){
|
|
|
|
141
|
+ $template_id = $this->getTemplateId();
|
|
122
|
//取默认首页的
|
142
|
//取默认首页的
|
|
123
|
$condition['source'] = BTemplate::SOURCE_COM;
|
143
|
$condition['source'] = BTemplate::SOURCE_COM;
|
|
124
|
$footerComInfo = $bTemplateComModel->read($condition);
|
144
|
$footerComInfo = $bTemplateComModel->read($condition);
|