|
@@ -62,21 +62,13 @@ class BTemplateLogic extends BaseLogic |
|
@@ -62,21 +62,13 @@ class BTemplateLogic extends BaseLogic |
|
62
|
* @time :2023/6/29 9:44
|
62
|
* @time :2023/6/29 9:44
|
|
63
|
*/
|
63
|
*/
|
|
64
|
public function getTemplate(){
|
64
|
public function getTemplate(){
|
|
65
|
- $bSettingModel = new Setting();
|
|
|
|
66
|
- $info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
|
|
|
|
67
|
- if($info === false){
|
|
|
|
68
|
- $this->fail('请先选择模版');
|
|
|
|
69
|
- }
|
|
|
|
70
|
- //自定义模块单独处理
|
|
|
|
71
|
- if(isset($this->param['is_custom']) && $this->param['is_custom'] == 1){
|
|
|
|
72
|
- $TemplateInfo = $this->customHtml($info,$this->param['source'],$this->param['source_id'],$this->param['is_custom']);
|
|
|
|
73
|
- }else{//系统页面
|
|
|
|
74
|
- if($this->param['source'] == $this->model::SOURCE_HOME){//首页
|
|
|
|
75
|
- $TemplateInfo = $this->homeHtml($info,$this->param['source'],$this->param['source_id']);
|
|
|
|
76
|
- }else{
|
|
|
|
77
|
- $TemplateInfo = $this->otherHtml($info,$this->param['source'],$this->param['source_id']);
|
|
|
|
78
|
- }
|
65
|
+ $settingInfo = $this->getSettingTemplate();//模版详情
|
|
|
|
66
|
+ if($this->param['source'] == $this->model::SOURCE_HOME){//首页
|
|
|
|
67
|
+ $TemplateInfo = $this->homeHtml($settingInfo,$this->param['source'],$this->param['source_id']);
|
|
|
|
68
|
+ }else{
|
|
|
|
69
|
+ $TemplateInfo = $this->otherHtml($settingInfo,$this->param['source'],$this->param['source_id']);
|
|
79
|
}
|
70
|
}
|
|
|
|
71
|
+
|
|
80
|
return $this->success($TemplateInfo);
|
72
|
return $this->success($TemplateInfo);
|
|
81
|
}
|
73
|
}
|
|
82
|
|
74
|
|
|
@@ -87,29 +79,88 @@ class BTemplateLogic extends BaseLogic |
|
@@ -87,29 +79,88 @@ class BTemplateLogic extends BaseLogic |
|
87
|
* @method :post
|
79
|
* @method :post
|
|
88
|
* @time :2023/12/13 10:47
|
80
|
* @time :2023/12/13 10:47
|
|
89
|
*/
|
81
|
*/
|
|
90
|
- public function getTemplateHtml(){
|
|
|
|
91
|
- $settingTemplateInfo = $this->getSettingTemplate();//模版详情
|
|
|
|
92
|
- $is_customized = $this->watchProjectIsCustomized();//查看是否为定制项目
|
|
|
|
93
|
-
|
82
|
+ public function getTemplateHtml($settingInfo,$source,$source_id,$is_custom = 0){
|
|
|
|
83
|
+ $templateInfo = $this->webTemplateInfo($settingInfo['template_id'],$source,$source_id,$is_custom);
|
|
|
|
84
|
+ if($templateInfo === false){
|
|
|
|
85
|
+ if($this->user['is_customized'] == BTemplate::SOURCE_VISUALIZATION){//处理定制页面初始数据
|
|
|
|
86
|
+ $resultCode = $this->isCustomizedPage($source,$source_id);//查看当前页面是否定制
|
|
|
|
87
|
+ if($resultCode !== true){
|
|
|
|
88
|
+ return ['html'=>$resultCode['html'],'template_id'=>$resultCode['template_id']];
|
|
|
|
89
|
+ }
|
|
|
|
90
|
+ }
|
|
|
|
91
|
+ }
|
|
|
|
92
|
+ if($templateInfo['type'] == BTemplate::ALL_HTML){//返回整个html代码
|
|
|
|
93
|
+ return ['html'=>$templateInfo['html'],'template_id'=>$settingInfo['template_id']];
|
|
|
|
94
|
+ }
|
|
|
|
95
|
+ $commonInfo = $this->getCommonPage($source,$source_id,$settingInfo['template_id']);//获取头部
|
|
|
|
96
|
+ $mainInfo = $this->getCommonMain($source,$source_id);//获取中间部分代码
|
|
|
|
97
|
+ $html = $commonInfo['head_css'].$mainInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other'].
|
|
|
|
98
|
+ $commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html'];
|
|
|
|
99
|
+ return ['html'=>$templateInfo['html'],'template_id'=>$settingInfo['template_id']];
|
|
94
|
}
|
100
|
}
|
|
95
|
|
101
|
|
|
96
|
/**
|
102
|
/**
|
|
97
|
- * @remark :处理定制项目
|
103
|
+ * @remark :页面是否为定制页面
|
|
98
|
* @name :watchProjectIsCustomized
|
104
|
* @name :watchProjectIsCustomized
|
|
99
|
* @author :lyh
|
105
|
* @author :lyh
|
|
100
|
* @method :post
|
106
|
* @method :post
|
|
101
|
* @time :2023/12/13 10:55
|
107
|
* @time :2023/12/13 10:55
|
|
102
|
*/
|
108
|
*/
|
|
103
|
- public function watchProjectIsCustomized($source,$source_id){
|
|
|
|
104
|
- //定制项目
|
|
|
|
105
|
- if($this->user['is_customized'] == Project::CUSTOMIZED_ONE){
|
|
|
|
106
|
- $type = $this->getCustomizedType($source,$source_id);//获取定制界面类型
|
|
|
|
107
|
- //查看当前页面是否定制,是否开启可视化
|
|
|
|
108
|
- $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
|
|
|
|
109
|
- if(in_array($type,$page_array)){//是定制界面
|
|
|
|
110
|
- return $this->getVisualizationHtml($type);
|
109
|
+ public function isCustomizedPage($source,$source_id)
|
|
|
|
110
|
+ {
|
|
|
|
111
|
+ $type = $this->getCustomizedType($source, $source_id);//获取定制界面类型
|
|
|
|
112
|
+ //查看当前页面是否定制,是否开启可视化
|
|
|
|
113
|
+ $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
|
|
|
|
114
|
+ if (in_array($type, $page_array)) {//是定制界面
|
|
|
|
115
|
+ //TODO::获取初始代码
|
|
|
|
116
|
+ $bTemplateMainModel = new BTemplateMain();
|
|
|
|
117
|
+ $customHtmlInfo = $bTemplateMainModel->read(['type'=>$type]);
|
|
|
|
118
|
+ if($customHtmlInfo === false){
|
|
|
|
119
|
+ $this->fail('定制页面,请先上传代码块');
|
|
111
|
}
|
120
|
}
|
|
|
|
121
|
+ return ['html'=>$customHtmlInfo['html']];
|
|
112
|
}
|
122
|
}
|
|
|
|
123
|
+ return true;
|
|
|
|
124
|
+ }
|
|
|
|
125
|
+
|
|
|
|
126
|
+ /**
|
|
|
|
127
|
+ * @remark :查看定制页面是否支持可视化
|
|
|
|
128
|
+ * @name :checkCustomizedPageVisualization
|
|
|
|
129
|
+ * @author :lyh
|
|
|
|
130
|
+ * @method :post
|
|
|
|
131
|
+ * @time :2023/12/13 11:25
|
|
|
|
132
|
+ */
|
|
|
|
133
|
+ public function checkCustomizedPageVisualization($type){
|
|
|
|
134
|
+ switch ($type){
|
|
|
|
135
|
+ case BTemplate::TYPE_ONE:
|
|
|
|
136
|
+ $is_visualization = $this->user['is_visualization']->index_page;
|
|
|
|
137
|
+ break;
|
|
|
|
138
|
+ case BTemplate::TYPE_TWO:
|
|
|
|
139
|
+ $is_visualization = $this->user['is_visualization']->product_details;
|
|
|
|
140
|
+ break;
|
|
|
|
141
|
+ case BTemplate::TYPE_THREE:
|
|
|
|
142
|
+ $is_visualization = $this->user['is_visualization']->product_list;
|
|
|
|
143
|
+ break;
|
|
|
|
144
|
+ case BTemplate::TYPE_FOUR:
|
|
|
|
145
|
+ $is_visualization = $this->user['is_visualization']->blog_details;
|
|
|
|
146
|
+ break;
|
|
|
|
147
|
+ case BTemplate::TYPE_FIVE:
|
|
|
|
148
|
+ $is_visualization = $this->user['is_visualization']->blog_list;
|
|
|
|
149
|
+ break;
|
|
|
|
150
|
+ case BTemplate::TYPE_SIX:
|
|
|
|
151
|
+ $is_visualization = $this->user['is_visualization']->product_list;
|
|
|
|
152
|
+ break;
|
|
|
|
153
|
+ case BTemplate::TYPE_SEVEN:
|
|
|
|
154
|
+ $is_visualization = $this->user['is_visualization']->news_details;
|
|
|
|
155
|
+ break;
|
|
|
|
156
|
+ case BTemplate::TYPE_EIGHT:
|
|
|
|
157
|
+ $is_visualization = $this->user['is_visualization']->news_list;
|
|
|
|
158
|
+ break;
|
|
|
|
159
|
+ default:
|
|
|
|
160
|
+ $is_visualization = 1;
|
|
|
|
161
|
+ break;
|
|
|
|
162
|
+ }
|
|
|
|
163
|
+ return $is_visualization;
|
|
113
|
}
|
164
|
}
|
|
114
|
|
165
|
|
|
115
|
/**
|
166
|
/**
|
|
@@ -156,10 +207,10 @@ class BTemplateLogic extends BaseLogic |
|
@@ -156,10 +207,10 @@ class BTemplateLogic extends BaseLogic |
|
156
|
* @method :post
|
207
|
* @method :post
|
|
157
|
* @time :2023/12/13 9:50
|
208
|
* @time :2023/12/13 9:50
|
|
158
|
*/
|
209
|
*/
|
|
159
|
- public function watchHomeISVisualization($template_id){
|
|
|
|
160
|
- $homeTemplateInfo = $this->webTemplateInfo($template_id,1,0);
|
210
|
+ public function homeISVisualization($template_id){
|
|
|
|
211
|
+ $homeTemplateInfo = $this->webTemplateInfo($template_id,BTemplate::SOURCE_HOME,0);
|
|
161
|
if($homeTemplateInfo === false){
|
212
|
if($homeTemplateInfo === false){
|
|
162
|
- return false;
|
213
|
+ $this->fail('请先装修首页');
|
|
163
|
}
|
214
|
}
|
|
164
|
return $this->success($homeTemplateInfo);
|
215
|
return $this->success($homeTemplateInfo);
|
|
165
|
}
|
216
|
}
|