作者 lyh

gx

@@ -48,42 +48,4 @@ class VisualizationController extends BaseController @@ -48,42 +48,4 @@ class VisualizationController extends BaseController
48 $logic->saveVisualization(); 48 $logic->saveVisualization();
49 $this->response('success'); 49 $this->response('success');
50 } 50 }
51 -  
52 - /**  
53 - * @remark :可视化保存  
54 - * @name :saveHtml  
55 - * @author :lyh  
56 - * @method :post  
57 - * @time :2023/11/15 11:20  
58 - */  
59 - public function getHtml(VisualizationLogic $logic){  
60 - $this->request->validate([  
61 - 'source'=>'required',  
62 - 'source_id'=>'required',  
63 - ],[  
64 - 'source.required' => '类型不能为空',  
65 - 'source_id.required' => 'source_id不能为空',  
66 - ]);  
67 - $data = $logic->getHtml();  
68 - $this->response('success',Code::SUCCESS,$data);  
69 - }  
70 -  
71 - /**  
72 - * @remark :保存html  
73 - * @name :saveHtml  
74 - * @author :lyh  
75 - * @method :post  
76 - * @time :2023/11/15 11:44  
77 - */  
78 - public function saveHtml(VisualizationLogic $logic){  
79 - $this->request->validate([  
80 - 'source'=>'required',  
81 - 'source_id'=>'required',  
82 - ],[  
83 - 'source.required' => '类型不能为空',  
84 - 'source_id.required' => 'source_id不能为空',  
85 - ]);  
86 - $logic->saveHtml();  
87 - $this->response('success');  
88 - }  
89 } 51 }
@@ -87,7 +87,7 @@ class BTemplateLogic extends BaseLogic @@ -87,7 +87,7 @@ class BTemplateLogic extends BaseLogic
87 $type = $this->getCustomizedType($source, $source_id);//定制获取头部底部类型 87 $type = $this->getCustomizedType($source, $source_id);//定制获取头部底部类型
88 $commonInfo = $this->getCommonPage(0,$this->user['project_id'],$type);//获取定制头部 88 $commonInfo = $this->getCommonPage(0,$this->user['project_id'],$type);//获取定制头部
89 $html = $this->handleAllHtml($commonInfo,$templateInfo['html']); 89 $html = $this->handleAllHtml($commonInfo,$templateInfo['html']);
90 - return $this->success(['html'=>$html,'template_id'=>$template_id]); 90 + return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id']]);
91 } 91 }
92 $mainInfo = ['main_html'=>$templateInfo['main_html'], 'main_css'=>$templateInfo['main_css']]; 92 $mainInfo = ['main_html'=>$templateInfo['main_html'], 'main_css'=>$templateInfo['main_css']];
93 } 93 }
@@ -95,7 +95,9 @@ class BTemplateLogic extends BaseLogic @@ -95,7 +95,9 @@ class BTemplateLogic extends BaseLogic
95 $html = $commonInfo['head_css'].$mainInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other']. 95 $html = $commonInfo['head_css'].$mainInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other'].
96 $commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html']; 96 $commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html'];
97 $html = $this->getHeadFooter($html); 97 $html = $this->getHeadFooter($html);
98 - return $this->success(['html'=>$html,'template_id'=>$template_id]); 98 + $result = ['html'=>$html,'template_id'=>$template_id];
  99 + if($templateInfo !== false){$result['id'] = $templateInfo['id'];}
  100 + return $this->success($result);
99 } 101 }
100 102
101 /** 103 /**
@@ -79,466 +79,4 @@ class VisualizationLogic extends BaseLogic @@ -79,466 +79,4 @@ class VisualizationLogic extends BaseLogic
79 } 79 }
80 return $this->success(); 80 return $this->success();
81 } 81 }
82 -  
83 - /**  
84 - * @remark :定制页面支持可视化装修获取html  
85 - * @name :getHtml  
86 - * @author :lyh  
87 - * @method :post  
88 - * @time :2023/11/15 11:30  
89 - */  
90 - public function getHtml(){  
91 - $type = $this->getType($this->param['source'],$this->param['source_id']);//获取类型  
92 - $page_array = (array)$this->user['is_visualization']->page_array;//获取定制界面  
93 - //查看当前类型是否是定制界面  
94 - if(in_array($type,$page_array)){//是定制界面  
95 - return $this->getVisualizationHtml($type);  
96 - }else{//非定制界面  
97 - return $this->getTemplateHtml();  
98 - }  
99 - }  
100 -  
101 - /**  
102 - * @remark :定制界面获取html  
103 - * @name :getVisualizationHtml  
104 - * @author :lyh  
105 - * @method :post  
106 - * @time :2023/12/6 11:47  
107 - */  
108 - public function getVisualizationHtml($type){  
109 -  
110 - if(in_array($type,[1,3,5,7])){//单页  
111 - $templateInfo = $this->getWebTemplate($this->param['source'],$this->param['source_id']);//查看当前定制单页是否有代码块  
112 - if($templateInfo === false){  
113 - $this->fail('请先上传定制代码块');  
114 - }  
115 - return ['html'=>$templateInfo['html']];  
116 - }else{//模块页  
117 - $templateInfo = $this->getWebTemplate($this->param['source'],$this->param['source_id']);//查看当前页面是否可视化  
118 - if($templateInfo === false){//获取代码块  
119 - $bTemplateMainModel = new BTemplateMain();  
120 - $mainInfo = $bTemplateMainModel->read(['type'=>$type]);  
121 - if($mainInfo === false){  
122 - $this->fail('请先上传定制代码块');  
123 - }  
124 - return ['html'=>$mainInfo['main_html']];  
125 - }  
126 - //替换为公共头部和底部  
127 - $templateCommonModel = new BTemplateCommon();  
128 - $headerFooterHtml = $templateCommonModel->read(['template_id'=>0,'project_id'=>$this->user['project_id'],'type'=>$type]);  
129 - $html = $templateInfo['html'];  
130 - if($headerFooterHtml !== false){  
131 - $html = preg_replace('/<header\b[^>]*>(.*?)<\/header>/s', $headerFooterHtml['head_html'], $html);  
132 - $html = preg_replace('/<footer\b[^>]*>(.*?)<\/footer>/s', $headerFooterHtml['footer_html'], $html);  
133 - $html = preg_replace('/<style id="globalsojs-header">(.*?)<\/style>/s', $headerFooterHtml['head_css'], $html);  
134 - $html = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', $headerFooterHtml['footer_css'], $html);  
135 - }  
136 - return ['html'=>$html];  
137 - }  
138 - }  
139 -  
140 - /**  
141 - * @remark :非定制项目获取html  
142 - * @name :getTemplateHtml  
143 - * @author :lyh  
144 - * @method :post  
145 - * @time :2023/12/6 11:44  
146 - */  
147 - public function getTemplateHtml(){  
148 - $bSettingModel = new Setting();  
149 - $settingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]);  
150 - if($settingInfo === false){  
151 - $this->fail('请先选择模版');  
152 - }  
153 - $templateInfo = $this->getWebTemplate($this->param['source'],$this->param['source_id'],$settingInfo['template_id']);//查看当前页面是否可视化  
154 - if($templateInfo === false){  
155 - //根据类型在获取中间部分  
156 - $mainData = $this->getCommonMain($this->param['source'],$this->param['source_id']);  
157 - }else{  
158 - $mainData = [  
159 - 'main_html'=>$templateInfo['main_html'],  
160 - 'main_css'=>$templateInfo['main_css']  
161 - ];  
162 - }  
163 - //获取公共头部底部  
164 - $commonInfo = $this->getCommonPage($this->param['source'],$this->param['source_id'],$settingInfo['template_id']);  
165 - //拼接数据  
166 - $html = $commonInfo['head_css'].$mainData['main_css'].$commonInfo['footer_css'].$commonInfo['other'].  
167 - $commonInfo['head_html'].$mainData['main_html'].$commonInfo['footer_html'];  
168 - $html = $this->getHeadFooter($html);  
169 - return $this->success(['html'=>$html,'template_id'=>$settingInfo['template_id']]);  
170 - }  
171 -  
172 - /**  
173 - * @remark :拼接获取公共头部底部  
174 - * @name :getHeadFooter  
175 - * @author :lyh  
176 - * @method :post  
177 - * @time :2023/7/21 17:22  
178 - */  
179 - public function getHeadFooter($html){  
180 - //获取公共主题头部底部  
181 - $serviceSettingModel = new ServiceSettingModel();  
182 - $list = $serviceSettingModel->list(['type'=>2],'created_at');  
183 - //拼接html  
184 - foreach ($list as $v){  
185 - if($v['key'] == 'head'){  
186 - $html = $v['values'].$html;  
187 - }  
188 - if($v['key'] == 'footer'){  
189 - $html = $html.$v['values'];  
190 - }  
191 - }  
192 - return $html;  
193 - }  
194 -  
195 - /**  
196 - * @remark :获取可视化装修记录  
197 - * @name :getWebTemplate  
198 - * @author :lyh  
199 - * @method :post  
200 - * @time :2023/11/16 11:21  
201 - */  
202 - public function getWebTemplate($source,$source_id,$template_id = 0){  
203 - //查询可视化是否第一次保存  
204 - $bTemplateModel = new BTemplate();  
205 - $param = [  
206 - 'source'=>$source,  
207 - 'project_id'=>$this->user['project_id'],  
208 - 'source_id'=>$source_id,  
209 - 'template_id'=>$template_id  
210 - ];  
211 - return $bTemplateModel->read($param);  
212 - }  
213 -  
214 - /**  
215 - * @remark :定制界面根据source+source_id获取type类型  
216 - * @name :getType  
217 - * @author :lyh  
218 - * @method :post  
219 - * @time :2023/11/16 11:20  
220 - */  
221 - public function getType($source,$source_id){  
222 - $type = BTemplate::TYPE_ONE;  
223 - if($source == BTemplate::SOURCE_PRODUCT){  
224 - if($source_id == 0){$type = BTemplate::TYPE_THREE;}else{$type = BTemplate::TYPE_TWO;}  
225 - }  
226 - if($source == BTemplate::SOURCE_BLOG){  
227 - if($source_id == 0){$type = BTemplate::TYPE_FIVE;}else{$type = BTemplate::TYPE_FOUR;}  
228 - }  
229 - if($source == BTemplate::SOURCE_NEWS){  
230 - if($source_id == 0){$type = BTemplate::TYPE_SEVEN;}else{$type = BTemplate::TYPE_SIX;}  
231 - }  
232 - return $type;  
233 - }  
234 -  
235 - /**  
236 - * @remark :非定制获取设置头部底部的类型  
237 - * @name :getType  
238 - * @author :lyh  
239 - * @method :post  
240 - * @time :2023/10/21 17:29  
241 - */  
242 - public function getSaveType($source,$source_id){  
243 - $type = 1;//首页公共头部底部  
244 - //查看页面是否设置自定义头部底部  
245 - if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {  
246 - $pageSettingModel = new PageSetting();  
247 - $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);  
248 - if ($pageInfo !== false) {  
249 - if ($source == 2) {if ($source_id != 0) {if ($pageInfo['product_details'] != 0) {$type = 2;}} else {if ($pageInfo['product_list'] != 0) {$type = 3;}}}  
250 - if ($source == 3) {if ($source_id != 0) {if ($pageInfo['blog_details'] != 0) {$type = 4;}} else {if ($pageInfo['blog_list'] != 0) {$type = 5;}}}  
251 - if ($source == 4) {if ($source_id != 0) {if ($pageInfo['news_details'] != 0) {$type = 6;}} else {if ($pageInfo['news_list'] != 0) {$type = 7;}}}  
252 - if ($source == 5) {if ($pageInfo['polymerization'] != 0) {$type = 8;}}  
253 - }  
254 - }  
255 - return $type;  
256 - }  
257 -  
258 - /**  
259 - * @remark :保存定制项目可视化  
260 - * @name :saveHtml  
261 - * @author :lyh  
262 - * @method :post  
263 - * @time :2023/11/15 11:47  
264 - */  
265 - public function saveHtml(){  
266 - if(!isset($this->user['is_visualization']->page_array)){  
267 - $this->fail('当前为定制项目,请先选择定制界面');  
268 - }  
269 - $page_array = (array)$this->user['is_visualization']->page_array;  
270 - $type = $this->getType($this->param['source'],$this->param['source_id']);  
271 - try {  
272 - if(in_array($type,$page_array)){//定制页面  
273 - $this->saveVisualizationHtml($type);  
274 - }else{  
275 - if(!isset($this->param['is_custom'])){  
276 - $this->param['is_custom'] = 0;  
277 - }  
278 - $this->saveTemplateHtml($this->param);  
279 - }  
280 - }catch (\Exception $e){  
281 - $this->fail('系统错误,请联系管理员');  
282 - }  
283 - return $this->success();  
284 - }  
285 -  
286 - /**  
287 - * @remark :保存定制界面  
288 - * @name :saveVisualizationHtml  
289 - * @author :lyh  
290 - * @method :post  
291 - * @time :2023/12/5 15:42  
292 - */  
293 - public function saveVisualizationHtml($type){  
294 - $bTemplateModel = new BTemplate();  
295 - $templateInfo = $bTemplateModel->read([  
296 - 'source'=>$this->param['source'], 'project_id'=>$this->user['project_id'],  
297 - 'source_id'=>$this->param['source_id'], 'template_id'=>0  
298 - ]);  
299 - try {  
300 - //更新头部底部  
301 - $this->visualizationSaveHeaderFooter($type);  
302 - if($templateInfo === false){  
303 - $this->param['project_id'] = $this->user['project_id'];  
304 - $this->param['template_id'] = 0;  
305 - $bTemplateModel->add($this->param);  
306 - }else{  
307 - $param['html'] = $this->param['html'];  
308 - $bTemplateModel->edit($param,['source'=>$this->param['source'],'source_id'=>$this->param['source_id'],'template_id'=>0]);  
309 - }  
310 - }catch (\Exception $e){  
311 - $this->fail('系统错误,请联系管理员');  
312 - }  
313 - return $this->success();  
314 - }  
315 -  
316 - /**  
317 - * @remark :定制界面保存头部底部  
318 - * @name :visualizationSaveHeaderFooter  
319 - * @author :lyh  
320 - * @method :post  
321 - * @time :2023/12/6 10:41  
322 - */  
323 - public function visualizationSaveHeaderFooter($type){  
324 - //更新头部底部代码  
325 - $header_footer = [  
326 - 'head_html'=>characterTruncation($this->param['html'],'/<header\b[^>]*>(.*?)<\/header>/s'),  
327 - 'head_css'=>characterTruncation($this->param['html'],'/<style id="globalsojs-header">(.*?)<\/style>/s'),  
328 - 'footer_html'=>characterTruncation($this->param['html'],'/<footer\b[^>]*>(.*?)<\/footer>/s'),  
329 - 'footer_css'=>characterTruncation($this->param['html'],'/<style id="globalsojs-footer">(.*?)<\/style>/s'),  
330 - ];  
331 - $templateCommonModel = new BTemplateCommon();  
332 - $info = $templateCommonModel->read(['template_id'=>0,'project_id'=>$this->user['project_id'],'type'=>$type]);  
333 - if($info === false){  
334 - $header_footer['template_id'] = 0;  
335 - $header_footer['project_id'] = $this->user['project_id'];  
336 - $header_footer['type'] = $type;  
337 - $templateCommonModel->add($header_footer);  
338 - }else{  
339 - $templateCommonModel->edit($header_footer,['template_id'=>0,'project_id'=>$this->user['project_id'],'type'=>$type]);  
340 - }  
341 - return $this->success();  
342 - }  
343 -  
344 - /**  
345 - * @remark :非定制界面保存数据  
346 - * @name :saveTemplateHtml  
347 - * @author :lyh  
348 - * @method :post  
349 - * @time :2023/12/5 15:44  
350 - */  
351 - public function saveTemplateHtml($param){  
352 - $bTemplateModel = new BTemplate();  
353 - $templateInfo = $bTemplateModel->read([  
354 - 'source'=>$param['source'],  
355 - 'project_id'=>$this->user['project_id'],  
356 - 'source_id'=>$param['source_id'],  
357 - 'template_id'=>$param['template_id'],  
358 - 'is_custom'=>$param['is_custom']  
359 - ]);  
360 - $this->param['main_html'] = characterTruncation($param['html'],'/<main\b[^>]*>(.*?)<\/main>/s');  
361 - $this->param['main_css'] = characterTruncation($param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s');  
362 - //保存头部  
363 - if($param['is_custom'] == BTemplate::SOURCE_NO_CUSTOM){//非扩展模块才可以保存头底  
364 - $this->saveCommonTemplate($param['html'],$param['source'],$param['source_id'],$param['template_id']);  
365 - }  
366 - if($templateInfo === false){  
367 - $param['project_id'] = $this->user['project_id'];  
368 - $bTemplateModel->add($param);  
369 - }else{  
370 - $bTemplateModel->edit($param,['source'=>$param['source'],'source_id'=>$param['source_id'],'is_custom'=>$param['is_custom']]);  
371 - }  
372 - $this->setTemplateLog($param['template_id'],$param['html'],$param['source'],$param['source_id'],$param['is_custom']);  
373 - $this->homeOrProduct($param['source'],$param['source_id'],$param['is_custom']);  
374 - }  
375 -  
376 - /**  
377 - * @remark :通知首页更新  
378 - * @name :IsHome  
379 - * @author :lyh  
380 - * @method :post  
381 - * @time :2023/7/31 16:05  
382 - */  
383 - public function homeOrProduct($source,$source_id = '',$is_custom = 0){  
384 - if($is_custom == 0){  
385 - if($source == BTemplate::SOURCE_HOME){  
386 - RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);  
387 - $type = RouteMap::SOURCE_INDEX;  
388 - }elseif($source == BTemplate::SOURCE_PRODUCT){  
389 - $type = RouteMap::SOURCE_PRODUCT;  
390 - }elseif($source == BTemplate::SOURCE_BLOG){  
391 - $type = RouteMap::SOURCE_BLOG;  
392 - }elseif($source == BTemplate::SOURCE_NEWS){  
393 - $type = RouteMap::SOURCE_NEWS;  
394 - }else{  
395 - $type = 'all';  
396 - }  
397 - $route = RouteMap::getRoute($type,$source_id,$this->user['project_id']);  
398 - }else{  
399 - $type = RouteMap::SOURCE_MODULE;  
400 - $route = RouteMap::getRoute($type,$source_id,$this->user['project_id']);  
401 - }  
402 - $this->addUpdateNotify($type,$route);  
403 - return $this->curlDelRoute(['route'=>$route,'new_route'=>$route]);  
404 - }  
405 -  
406 - /**  
407 - * @remark :生成记录  
408 - * @name :setTemplateLog  
409 - * @author :lyh  
410 - * @method :post  
411 - * @time :2023/8/23 11:16  
412 - */  
413 - public function setTemplateLog($template_id,$html,$source,$source_id,$is_custom){  
414 - $data = [  
415 - 'template_id'=>$template_id,  
416 - 'project_id'=>$this->user['project_id'],  
417 - 'operator_id'=>$this->user['id'],  
418 - 'text'=>$html,  
419 - 'source'=>$source,  
420 - 'source_id'=>$source_id,  
421 - 'main_html'=>characterTruncation($this->param['html'],'/<main\b[^>]*>(.*?)<\/main>/s'),  
422 - 'main_css'=>characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s'),  
423 - 'head_html'=>characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'),  
424 - 'head_css'=>characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'),  
425 - 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'),  
426 - 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'),  
427 - 'is_custom'=>$is_custom  
428 - ];  
429 - $footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s'));  
430 - $data['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);  
431 - $bTemplateLogModel = new BTemplateLog();  
432 - return $bTemplateLogModel->add($data);  
433 - }  
434 -  
435 - /**  
436 - * @remark :保存头部公共数据  
437 - * @name :saveCommonTemplate  
438 - * @author :lyh  
439 - * @method :post  
440 - * @time :2023/10/13 14:27  
441 - */  
442 - public function saveCommonTemplate($html,$source,$source_id,$template_id){  
443 - $type = $this->getSaveType($source,$source_id);  
444 - $templateCommonModel = new BTemplateCommon();  
445 - $info = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);  
446 - $data = [  
447 - 'head_html'=>characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'),  
448 - 'head_css'=>characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'),  
449 - 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'),  
450 - 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'),  
451 - ];  
452 - $footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s'));  
453 - $other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);  
454 - if($info === false){  
455 - $data['template_id'] = $template_id;  
456 - $data['project_id'] = $this->user['project_id'];  
457 - $data['type'] = $type;  
458 - $templateCommonModel->add($data);  
459 - }else{  
460 - $templateCommonModel->edit($data,['id'=>$info['id']]);  
461 - }  
462 - //更新所有界面的other  
463 - $templateCommonModel->edit(['other'=>$other],['project_id'=>$this->user['project_id'],'template_id'=>$template_id]);  
464 - return $this->success();  
465 - }  
466 -  
467 - /**  
468 - * @remark :获取中间公共部分  
469 - * @name :getCommonMain  
470 - * @author :lyh  
471 - * @method :post  
472 - * @time :2023/10/24 15:58  
473 - */  
474 - public function getCommonMain($source,$source_id){  
475 - $data = [];  
476 - if ($source == 2) {if ($source_id != 0) {$type = 2;} else {$type = 3;}}  
477 - if ($source == 3) {if ($source_id != 0) {$type = 4;} else {$type = 5;}}  
478 - if ($source == 4) {if ($source_id != 0) {$type = 6;} else {$type = 7;}}  
479 - if ($source == 5) {$type = 8;}  
480 - //查询有没有公共详情模板  
481 - $mainInfo = $this->model->read(['type'=>$type]);  
482 - if($mainInfo === false){  
483 - $data['main_html'] = $this->getModule($type);  
484 - $data['main_css'] = "<style id='globalsojs-styles'></style>";  
485 - }else{  
486 - $data['main_html'] = $mainInfo['main_html'];  
487 - $data['main_css'] = $mainInfo['main_css'];  
488 - }  
489 - return $data;  
490 - }  
491 -  
492 - /**  
493 - * @remark :默认产品模块  
494 - * @name :getProductModule  
495 - * @author :lyh  
496 - * @method :post  
497 - * @time :2023/7/27 15:08  
498 - */  
499 - public function getModule($type){  
500 - //获取公共主题头部底部  
501 - $mainModel = new TemplateTypeMain();  
502 - $info = $mainModel->read(['type'=>$type]);  
503 - return $info['main_html'];  
504 - }  
505 -  
506 - /**  
507 - * @remark :根据类型获取公共头和底  
508 - * @name :getCommonPage  
509 - * @author :lyh  
510 - * @method :post  
511 - * @time :2023/10/21 16:55  
512 - */  
513 - public function getCommonPage($source,$source_id,$template_id){  
514 - if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {  
515 - //查看页面是否设置自定义头部底部  
516 - $pageSettingModel = new PageSetting();  
517 - $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);  
518 - if ($pageInfo != false) {  
519 - $commonTemplateModel = new BTemplateCommon();  
520 - $data = [  
521 - 'template_id' => $template_id,  
522 - 'project_id' => $this->user['project_id']  
523 - ];  
524 - if ($source == BTemplate::SOURCE_PRODUCT) {//产品页  
525 - if($source_id != 0){$data['type'] = 2;if ($pageInfo['product_details'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}  
526 - else {$data['type'] = 3;if ($pageInfo['product_list'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}}  
527 - if ($source == BTemplate::SOURCE_BLOG) {//博客页  
528 - if ($source_id != 0) {$data['type'] = 4;if ($pageInfo['blog_details'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}  
529 - else {$data['type'] = 5;if ($pageInfo['blog_list'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}}  
530 - if ($source == BTemplate::SOURCE_NEWS) {//新闻页  
531 - if ($source_id != 0) {$data['type'] = 6;if ($pageInfo['news_details'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}  
532 - else {$data['type'] = 7;if ($pageInfo['news_list'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}}  
533 - if ($source == BTemplate::SOURCE_KEYWORD) {//聚合页  
534 - $data['type'] = 8;if ($pageInfo['polymerization'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}  
535 - }  
536 - }  
537 - //获取首页公共的头部和底部  
538 - if(!isset($commonInfo) || $commonInfo === false){  
539 - $commonTemplateModel = new BTemplateCommon();  
540 - $commonInfo = $commonTemplateModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>1]);  
541 - }  
542 - return $commonInfo;  
543 - }  
544 } 82 }
@@ -115,12 +115,13 @@ class NavLogic extends BaseLogic @@ -115,12 +115,13 @@ class NavLogic extends BaseLogic
115 public function handleParam($param){ 115 public function handleParam($param){
116 $data = [ 116 $data = [
117 'pid'=>$param['pid'] ?? 0, 117 'pid'=>$param['pid'] ?? 0,
118 - 'name'=>$param['name'] ?? '', 118 + 'name'=>$param['name'],
119 'location'=>$param['location'] ?? '', 119 'location'=>$param['location'] ?? '',
120 'url'=>$param['url'], 120 'url'=>$param['url'],
121 'status'=>$param['status'] ?? 1, 121 'status'=>$param['status'] ?? 1,
122 'target'=>$param['target'] ?? 1, 122 'target'=>$param['target'] ?? 1,
123 'remark'=>$param['remark'] ?? '', 123 'remark'=>$param['remark'] ?? '',
  124 + 'group_id'=>$param['group_id'],
124 ]; 125 ];
125 return $this->success($data); 126 return $this->success($data);
126 } 127 }
@@ -32,7 +32,7 @@ class NavRequest extends FormRequest @@ -32,7 +32,7 @@ class NavRequest extends FormRequest
32 public function rules() 32 public function rules()
33 { 33 {
34 $rule = [ 34 $rule = [
35 -// 'group_id' => ['required','integer'], 35 + 'group_id' => ['required','integer'],
36 'pid' => ['required','integer'], 36 'pid' => ['required','integer'],
37 'name' => ['required','max:100'], 37 'name' => ['required','max:100'],
38 'url' => ['required'], 38 'url' => ['required'],