作者 lyh

gx

@@ -28,7 +28,7 @@ class InitHtmlController extends BaseController @@ -28,7 +28,7 @@ class InitHtmlController extends BaseController
28 * @remark :获取可视化详情页模板数据 28 * @remark :获取可视化详情页模板数据
29 * @name :getDetailInfo 29 * @name :getDetailInfo
30 * @author :lyh 30 * @author :lyh
31 - * @method :post 31 + * @method :post $param (type:类型,2产品 3博客 4新闻 对应扩展模块的id)
32 * @time :2023/10/24 11:27 32 * @time :2023/10/24 11:27
33 */ 33 */
34 public function getDetailHtml(InitHtmlLogic $logic){ 34 public function getDetailHtml(InitHtmlLogic $logic){
@@ -45,7 +45,7 @@ class InitHtmlController extends BaseController @@ -45,7 +45,7 @@ class InitHtmlController extends BaseController
45 * @remark :保存详情页模板数据 45 * @remark :保存详情页模板数据
46 * @name :saveDetail 46 * @name :saveDetail
47 * @author :lyh 47 * @author :lyh
48 - * @method :post 48 + * @method :post $param (type:类型,2产品 3博客 4新闻 对应扩展模块的id)
49 * @time :2023/10/24 14:47 49 * @time :2023/10/24 14:47
50 */ 50 */
51 public function saveDetailHtml(InitHtmlLogic $logic){ 51 public function saveDetailHtml(InitHtmlLogic $logic){
@@ -28,7 +28,7 @@ class InitHtmlLogic extends BaseLogic @@ -28,7 +28,7 @@ class InitHtmlLogic extends BaseLogic
28 * @remark :获取非定制项目复合页数据 28 * @remark :获取非定制项目复合页数据
29 * @name :getDetailHtml 29 * @name :getDetailHtml
30 * @author :lyh 30 * @author :lyh
31 - * @method :post 31 + * @method :post $param (type:类型,2产品 3博客 4新闻 对应扩展模块的id)
32 * @time :2023/12/27 10:50 32 * @time :2023/12/27 10:50
33 */ 33 */
34 public function getDetailHtml(){ 34 public function getDetailHtml(){
@@ -94,17 +94,18 @@ class InitHtmlLogic extends BaseLogic @@ -94,17 +94,18 @@ class InitHtmlLogic extends BaseLogic
94 * @method :post 94 * @method :post
95 * @time :2023/12/15 18:12 95 * @time :2023/12/15 18:12
96 */ 96 */
97 - public function saveDetailCommonHtml($html,$template_id,$is_custom,$is_list){ 97 + public function saveDetailCommonHtml($html,$type,$template_id,$is_custom,$is_list){
98 $publicData = $this->handleCommonParam($html); 98 $publicData = $this->handleCommonParam($html);
99 $templateCommonModel = new BTemplateCommon(); 99 $templateCommonModel = new BTemplateCommon();
100 - if($is_custom == BTemplate::SOURCE_CUSTOM){//扩展模块  
101 - //更新首页头部底部  
102 - $templateCommonModel->edit($publicData,['type'=>BTemplate::SOURCE_HOME,'project_id'=>$this->user['project_id'],'template_id'=>$template_id]);  
103 - return $this->success();  
104 - }  
105 //查看当前模板是否有独立头部,有独立头部,更新独立头部,无独立头部,更新公共头部 100 //查看当前模板是否有独立头部,有独立头部,更新独立头部,无独立头部,更新公共头部
106 - if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {  
107 - $templateCommonInfo = $templateCommonModel->read(['type'=>$type,'project_id'=>$this->user['project_id'],'template_id'=>$template_id]); 101 + $is_head = $this->user['configuration']['is_head'] ?? 0;
  102 + if($is_custom == BTemplate::SOURCE_CUSTOM){//todo::扩展模块无独立头部底部
  103 + $is_head = BTemplate::IS_NO_HEADER;
  104 + }
  105 + if($is_head == BTemplate::IS_HEADER) {
  106 + //有独立头部,更新独立头部
  107 + $commonType = $this->getHeaderType($type,$is_list);
  108 + $templateCommonInfo = $templateCommonModel->read(['project_id'=>$this->user['project_id'],'template_id'=>$template_id,'type'=>$commonType]);
108 if($templateCommonInfo === false){ 109 if($templateCommonInfo === false){
109 $publicData['type'] = $type; 110 $publicData['type'] = $type;
110 $publicData['project_id'] = $this->user['project_id']; 111 $publicData['project_id'] = $this->user['project_id'];
@@ -114,9 +115,10 @@ class InitHtmlLogic extends BaseLogic @@ -114,9 +115,10 @@ class InitHtmlLogic extends BaseLogic
114 $templateCommonModel->edit($publicData,['id'=>$templateCommonInfo['id']]); 115 $templateCommonModel->edit($publicData,['id'=>$templateCommonInfo['id']]);
115 } 116 }
116 }else{ 117 }else{
117 - 118 + //更新首页头部底部
  119 + $templateCommonModel->edit($publicData,['type'=>BTemplate::SOURCE_HOME,'project_id'=>$this->user['project_id'],'template_id'=>$template_id]);
118 } 120 }
119 - return true; 121 + return $this->success();
120 } 122 }
121 123
122 /** 124 /**
@@ -161,20 +163,20 @@ class InitHtmlLogic extends BaseLogic @@ -161,20 +163,20 @@ class InitHtmlLogic extends BaseLogic
161 * @time :2023/12/15 18:06 163 * @time :2023/12/15 18:06
162 */ 164 */
163 public function getTypeCommonHtml($template_id,$type,$is_custom,$is_list){ 165 public function getTypeCommonHtml($template_id,$type,$is_custom,$is_list){
  166 + //判断当前项目是否有设置独立头部的权限
  167 + $is_head = $this->user['configuration']['is_head'] ?? 0;
  168 + if($is_custom == BTemplate::SOURCE_CUSTOM){//todo::拓展模块默认取首页
  169 + $is_head = BTemplate::IS_NO_HEADER;
  170 + }
164 //获取首页公共部分 171 //获取首页公共部分
165 $templateCommonModel = new BTemplateCommon(); 172 $templateCommonModel = new BTemplateCommon();
166 - $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>1]);  
167 - if($is_custom == BTemplate::SOURCE_CUSTOM){  
168 - return $this->success($commonInfo);  
169 - }  
170 - //判断当前项目是否有设置独立头部的权限  
171 - if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) { 173 + if($is_head == BTemplate::IS_HEADER) {
172 //有独立头部,获取独立头部 174 //有独立头部,获取独立头部
173 $commonType = $this->getHeaderType($type,$is_list); 175 $commonType = $this->getHeaderType($type,$is_list);
174 - $commonTypeInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$commonType['type']]);  
175 - if($commonTypeInfo !== false){  
176 - $commonInfo = $commonTypeInfo;  
177 - } 176 + $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$commonType]);
  177 + }else{
  178 + //首页头底
  179 + $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>BTemplate::SOURCE_HOME]);
178 } 180 }
179 return $this->success($commonInfo); 181 return $this->success($commonInfo);
180 } 182 }
@@ -209,7 +211,7 @@ class InitHtmlLogic extends BaseLogic @@ -209,7 +211,7 @@ class InitHtmlLogic extends BaseLogic
209 $resultType = BTemplate::TYPE_SIX; 211 $resultType = BTemplate::TYPE_SIX;
210 } 212 }
211 } 213 }
212 - return $this->success(['type'=>$resultType]); 214 + return $this->success($resultType);
213 } 215 }
214 216
215 /** 217 /**
@@ -38,6 +38,8 @@ class BTemplate extends Base @@ -38,6 +38,8 @@ class BTemplate extends Base
38 38
39 const TYPE_CUSTOM = 7;//扩展详情 39 const TYPE_CUSTOM = 7;//扩展详情
40 const IS_LIST = 1;//列表页 40 const IS_LIST = 1;//列表页
  41 + const IS_HEADER = 1;//独立头部底部
  42 + const IS_NO_HEADER = 0;//非独立头部底部
41 43
42 protected $table = 'gl_web_template'; 44 protected $table = 'gl_web_template';
43 //连接数据库 45 //连接数据库