作者 lyh

gx

@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Http\Logic\Bside\BTemplate; 3 namespace App\Http\Logic\Bside\BTemplate;
4 4
5 use App\Http\Logic\Bside\BaseLogic; 5 use App\Http\Logic\Bside\BaseLogic;
  6 +use App\Models\Project\PageSetting;
6 use App\Models\RouteMap\RouteMap; 7 use App\Models\RouteMap\RouteMap;
7 use App\Models\Service\Service as ServiceSettingModel; 8 use App\Models\Service\Service as ServiceSettingModel;
8 use App\Models\Template\BCustomTemplate; 9 use App\Models\Template\BCustomTemplate;
@@ -110,6 +111,7 @@ class CustomTemplateLogic extends BaseLogic @@ -110,6 +111,7 @@ class CustomTemplateLogic extends BaseLogic
110 * @time :2023/10/13 14:27 111 * @time :2023/10/13 14:27
111 */ 112 */
112 public function saveCommonTemplate($html){ 113 public function saveCommonTemplate($html){
  114 + $type = $this->getType();
113 //获取设置的默认模版 115 //获取设置的默认模版
114 $bSettingModel = new Setting(); 116 $bSettingModel = new Setting();
115 $settingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]); 117 $settingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
@@ -118,7 +120,7 @@ class CustomTemplateLogic extends BaseLogic @@ -118,7 +120,7 @@ class CustomTemplateLogic extends BaseLogic
118 } 120 }
119 //查看当前 121 //查看当前
120 $templateCommonModel = new BTemplateCommon(); 122 $templateCommonModel = new BTemplateCommon();
121 - $commonInfo = $templateCommonModel->read(['template_id'=>$settingInfo['template_id'],'project_id'=>$this->user['project_id']]); 123 + $commonInfo = $templateCommonModel->read(['template_id'=>$settingInfo['template_id'],'project_id'=>$this->user['project_id'],'type'=>$type]);
122 if($commonInfo === false){ 124 if($commonInfo === false){
123 $this->fail('请先装修首页'); 125 $this->fail('请先装修首页');
124 } 126 }
@@ -128,11 +130,33 @@ class CustomTemplateLogic extends BaseLogic @@ -128,11 +130,33 @@ class CustomTemplateLogic extends BaseLogic
128 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'), 130 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'),
129 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'), 131 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'),
130 'other'=>str_replace('<header','',characterTruncation($html,"/<link id=\"google-fonts-link\"(.*?)<header/s")), 132 'other'=>str_replace('<header','',characterTruncation($html,"/<link id=\"google-fonts-link\"(.*?)<header/s")),
  133 + 'type'=>$type
131 ]; 134 ];
132 $templateCommonModel->edit($data,['id'=>$commonInfo['id']]); 135 $templateCommonModel->edit($data,['id'=>$commonInfo['id']]);
133 return $this->success(); 136 return $this->success();
134 } 137 }
135 138
  139 + /**
  140 + * @remark :获取设置的类型
  141 + * @name :getType
  142 + * @author :lyh
  143 + * @method :post
  144 + * @time :2023/10/21 17:29
  145 + */
  146 + public function getType(){
  147 + $type = 1;//首页公共头部底部
  148 + //查看页面是否设置自定义头部底部
  149 + if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
  150 + $pageSettingModel = new PageSetting();
  151 + $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);
  152 + if ($pageInfo !== false) {
  153 + if ($pageInfo['page_list'] != 0) {
  154 + $type = 9;
  155 + }
  156 + }
  157 + }
  158 + return $type;
  159 + }
136 160
137 /** 161 /**
138 * @remark :查看路由是否更新 162 * @remark :查看路由是否更新
@@ -224,7 +248,7 @@ class CustomTemplateLogic extends BaseLogic @@ -224,7 +248,7 @@ class CustomTemplateLogic extends BaseLogic
224 if($info === false){ 248 if($info === false){
225 $this->fail('请先设置模版'); 249 $this->fail('请先设置模版');
226 } 250 }
227 - 251 + //获取type类型
228 $commonTemplateModel = new BTemplateCommon(); 252 $commonTemplateModel = new BTemplateCommon();
229 $commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id'],'type'=>1]); 253 $commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id'],'type'=>1]);
230 $html = ''; 254 $html = '';
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 namespace App\Models\Product; 3 namespace App\Models\Product;
4 4
  5 +use App\Helper\Arr;
5 use App\Models\Base; 6 use App\Models\Base;
6 use Illuminate\Database\Eloquent\SoftDeletes; 7 use Illuminate\Database\Eloquent\SoftDeletes;
7 8
@@ -19,4 +20,26 @@ class Keyword extends Base @@ -19,4 +20,26 @@ class Keyword extends Base
19 // public function getRouteAttribute(){ 20 // public function getRouteAttribute(){
20 // return RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $this->id, $this->project_id); 21 // return RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $this->id, $this->project_id);
21 // } 22 // }
  23 +
  24 + /**
  25 + * @remark :图
  26 + * @name :getKeywordTopBannerAttribute
  27 + * @author :lyh
  28 + * @method :post
  29 + * @time :2023/7/21 11:11
  30 + */
  31 + public function getKeywordTopBannerAttribute($value){
  32 + return getImageUrl($value);
  33 + }
  34 +
  35 + /**
  36 + * @remark :图
  37 + * @name :getKeywordTopBannerAttribute
  38 + * @author :lyh
  39 + * @method :post
  40 + * @time :2023/7/21 11:11
  41 + */
  42 + public function getKeywordFootBannerAttribute($value){
  43 + return getImageUrl($value);
  44 + }
22 } 45 }