作者 lyh

gx

@@ -248,164 +248,23 @@ class BTemplateLogic extends BaseLogic @@ -248,164 +248,23 @@ class BTemplateLogic extends BaseLogic
248 * @time :2023/10/21 16:55 248 * @time :2023/10/21 16:55
249 */ 249 */
250 public function getCommonHtml($source,$is_list,$template_id){ 250 public function getCommonHtml($source,$is_list,$template_id){
251 - $is_head = $this->user['configuration']['is_head'] ?? 0; 251 + $type = $this->getType($source,$is_list,$template_id);
252 $data = [ 252 $data = [
253 'template_id' => $template_id, 253 'template_id' => $template_id,
254 - 'project_id' => $this->user['project_id'] 254 + 'project_id' => $this->user['project_id'],
  255 + 'type'=>$type
255 ]; 256 ];
256 - if($template_id == 0){  
257 - $is_head = BTemplate::IS_HEADER;  
258 - }  
259 - if($is_head != BTemplate::IS_NO_HEADER) {  
260 - //查看页面是否设置自定义头部底部  
261 - $pageSettingModel = new PageSetting();  
262 - $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);  
263 - if($pageInfo !== false){  
264 - $commonInfo = [];  
265 - if ($source == BTemplate::SOURCE_BLOG) {//产品页  
266 - $commonInfo = $this->getProductCommonHtml($data,$is_list,$pageInfo);  
267 - }  
268 - if ($source == BTemplate::SOURCE_BLOG) {//博客页  
269 - $commonInfo = $this->getBlogCommonHtml($data,$is_list,$pageInfo);  
270 - }  
271 - if ($source == BTemplate::SOURCE_NEWS) {//新闻页  
272 - $commonInfo = $this->getNewsCommonHtml($data,$is_list,$pageInfo);  
273 - }  
274 - if ($source == BTemplate::SOURCE_KEYWORD) {//聚合页  
275 - $commonInfo = $this->getKeywordCommonHtml($data,$pageInfo);  
276 - }  
277 - if(!empty($commonInfo)){  
278 - return $this->success($commonInfo);  
279 - }  
280 - }  
281 - }  
282 - //获取首页公共的头部和底部  
283 - $commonInfo = $this->getHomeCommonHtml($data);  
284 - return $commonInfo;  
285 - }  
286 -  
287 - /**  
288 - * @remark :获取首页头部底部  
289 - * @name :getHomeCommonHtml  
290 - * @author :lyh  
291 - * @method :post  
292 - * @time :2023/12/27 16:11  
293 - */  
294 - public function getHomeCommonHtml($data){  
295 - $data['type'] = BTemplate::SOURCE_HOME;  
296 - $commonTemplateModel = new BTemplateCommon();  
297 - return $commonTemplateModel->read($data);  
298 - }  
299 -  
300 - /**  
301 - * @remark :聚合页  
302 - * @name :getKeywordCommonHtml  
303 - * @author :lyh  
304 - * @method :post  
305 - * @time :2023/12/27 16:09  
306 - */  
307 - public function getKeywordCommonHtml($data,$pageInfo){  
308 - $commonInfo = [];  
309 - $commonTemplateModel = new BTemplateCommon();  
310 - $data['type'] = BTemplate::TYPE_EIGHT;  
311 - if ($pageInfo['polymerization'] != 0) {  
312 - $commonInfo = $commonTemplateModel->read($data);  
313 - if($commonInfo === false){  
314 - $commonInfo = [];  
315 - }  
316 - }  
317 - return $this->success($commonInfo);  
318 - }  
319 -  
320 - /**  
321 - * @remark :产品头部底部  
322 - * @name :getProductCommonHtml  
323 - * @author :lyh  
324 - * @method :post  
325 - * @time :2023/12/27 16:01  
326 - */  
327 - public function getProductCommonHtml($data,$is_list,$pageInfo){  
328 - $commonInfo = [];  
329 $commonTemplateModel = new BTemplateCommon(); 257 $commonTemplateModel = new BTemplateCommon();
330 - if($is_list == BTemplate::IS_LIST){  
331 - $data['type'] = BTemplate::TYPE_THREE;  
332 - if ($pageInfo['product_list'] != 0) {  
333 $commonInfo = $commonTemplateModel->read($data); 258 $commonInfo = $commonTemplateModel->read($data);
334 if($commonInfo === false){ 259 if($commonInfo === false){
335 - $commonInfo = [];  
336 - }  
337 - }  
338 - } else {  
339 - $data['type'] = BTemplate::TYPE_TWO;  
340 - if ($pageInfo['product_details'] != 0) { 260 + $data['type'] = BTemplate::SOURCE_HOME;
341 $commonInfo = $commonTemplateModel->read($data); 261 $commonInfo = $commonTemplateModel->read($data);
342 - if($commonInfo === false){  
343 - $commonInfo = [];  
344 - }  
345 - }  
346 } 262 }
347 return $this->success($commonInfo); 263 return $this->success($commonInfo);
348 } 264 }
349 265
350 - /**  
351 - * @remark :博客头部  
352 - * @name :getBlogCommonHtml  
353 - * @author :lyh  
354 - * @method :post  
355 - * @time :2023/12/27 16:05  
356 - */  
357 - public function getBlogCommonHtml($data,$is_list,$pageInfo){  
358 - $commonInfo = [];  
359 - $commonTemplateModel = new BTemplateCommon();  
360 - if ($is_list == BTemplate::IS_LIST) {  
361 - $data['type'] = BTemplate::TYPE_SEVEN;  
362 - if ($pageInfo['blog_list'] != 0) {  
363 - $commonInfo = $commonTemplateModel->read($data);  
364 - if($commonInfo === false){  
365 - $commonInfo = [];  
366 - }  
367 - }  
368 - } else {  
369 - $data['type'] = BTemplate::TYPE_SIX;  
370 - if ($pageInfo['blog_details'] != 0) {  
371 - $commonInfo = $commonTemplateModel->read($data);  
372 - if($commonInfo === false){  
373 - $commonInfo = [];  
374 - }  
375 - }  
376 - }  
377 - return $this->success($commonInfo);  
378 - }  
379 266
380 - /**  
381 - * @remark :新闻头部  
382 - * @name :getNewsCommonHtml  
383 - * @author :lyh  
384 - * @method :post  
385 - * @time :2023/12/27 16:07  
386 - */  
387 - public function getNewsCommonHtml($data,$is_list,$pageInfo){  
388 - $commonInfo = [];  
389 - $commonTemplateModel = new BTemplateCommon();  
390 - if ($is_list == BTemplate::IS_LIST) {  
391 - $data['type'] = BTemplate::TYPE_SEVEN;  
392 - if ($pageInfo['news_list'] != 0) {  
393 - $commonInfo = $commonTemplateModel->read($data);  
394 - if($commonInfo === false){  
395 - $commonInfo = [];  
396 - }  
397 - }  
398 - } else {  
399 - $data['type'] = BTemplate::TYPE_SIX;  
400 - if ($pageInfo['news_details'] != 0) {  
401 - $commonInfo = $commonTemplateModel->read($data);  
402 - if($commonInfo === false){  
403 - $commonInfo = [];  
404 - }  
405 - }  
406 - }  
407 - return $this->success($commonInfo);  
408 - } 267 +
409 268
410 /** 269 /**
411 * @remark :保存修改后的模版 270 * @remark :保存修改后的模版