|
@@ -215,7 +215,7 @@ class BTemplateLogic extends BaseLogic |
|
@@ -215,7 +215,7 @@ class BTemplateLogic extends BaseLogic |
|
215
|
public function getCommonMain($source,$source_id,$is_custom){
|
215
|
public function getCommonMain($source,$source_id,$is_custom){
|
|
216
|
$data = [];
|
216
|
$data = [];
|
|
217
|
if($is_custom == BTemplate::SOURCE_CUSTOM){
|
217
|
if($is_custom == BTemplate::SOURCE_CUSTOM){
|
|
218
|
- if($source_id != 0){$type = BTemplate::TYPE_SIX;}else{$type = BTemplate::TYPE_SEVEN;}
|
218
|
+ if($source_id != 0){$type = BTemplate::TYPE_CUSTOM_DETAIL;}else{$type = BTemplate::TYPE_CUSTOM_LIST;}
|
|
219
|
}else{
|
219
|
}else{
|
|
220
|
if ($source == BTemplate::SOURCE_PRODUCT) {if ($source_id != 0) {$type = BTemplate::TYPE_TWO;} else {$type = BTemplate::TYPE_THREE;}}
|
220
|
if ($source == BTemplate::SOURCE_PRODUCT) {if ($source_id != 0) {$type = BTemplate::TYPE_TWO;} else {$type = BTemplate::TYPE_THREE;}}
|
|
221
|
if ($source == BTemplate::SOURCE_BLOG) {if ($source_id != 0) {$type = BTemplate::TYPE_FOUR;} else {$type = BTemplate::TYPE_FIVE;}}
|
221
|
if ($source == BTemplate::SOURCE_BLOG) {if ($source_id != 0) {$type = BTemplate::TYPE_FOUR;} else {$type = BTemplate::TYPE_FIVE;}}
|
|
@@ -284,8 +284,8 @@ class BTemplateLogic extends BaseLogic |
|
@@ -284,8 +284,8 @@ class BTemplateLogic extends BaseLogic |
|
284
|
public function templateSave(){
|
284
|
public function templateSave(){
|
|
285
|
//演示项目不允许修改
|
285
|
//演示项目不允许修改
|
|
286
|
$this->showProjectNoEdit($this->param['source']);
|
286
|
$this->showProjectNoEdit($this->param['source']);
|
|
287
|
-// DB::beginTransaction();
|
|
|
|
288
|
-// try {
|
287
|
+ DB::beginTransaction();
|
|
|
|
288
|
+ try {
|
|
289
|
$this->param = $this->handleDefaultString($this->param);//设置默认字符
|
289
|
$this->param = $this->handleDefaultString($this->param);//设置默认字符
|
|
290
|
$templateInfo = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],
|
290
|
$templateInfo = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],
|
|
291
|
$this->param['source_id'],$this->param['is_custom']);
|
291
|
$this->param['source_id'],$this->param['is_custom']);
|
|
@@ -299,11 +299,11 @@ class BTemplateLogic extends BaseLogic |
|
@@ -299,11 +299,11 @@ class BTemplateLogic extends BaseLogic |
|
299
|
//更新头部信息
|
299
|
//更新头部信息
|
|
300
|
$this->saveCommonHtml($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id']);
|
300
|
$this->saveCommonHtml($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id']);
|
|
301
|
$this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom']);
|
301
|
$this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom']);
|
|
302
|
-// DB::commit();
|
|
|
|
303
|
-// }catch (\Exception $e){
|
|
|
|
304
|
-// DB::rollBack();
|
|
|
|
305
|
-// $this->fail('系统错误,请联系管理员');
|
|
|
|
306
|
-// }
|
302
|
+ DB::commit();
|
|
|
|
303
|
+ }catch (\Exception $e){
|
|
|
|
304
|
+ DB::rollBack();
|
|
|
|
305
|
+ $this->fail('系统错误,请联系管理员');
|
|
|
|
306
|
+ }
|
|
307
|
//通知更新
|
307
|
//通知更新
|
|
308
|
$this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom']);
|
308
|
$this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom']);
|
|
309
|
return $this->success();
|
309
|
return $this->success();
|
|
@@ -541,7 +541,7 @@ class BTemplateLogic extends BaseLogic |
|
@@ -541,7 +541,7 @@ class BTemplateLogic extends BaseLogic |
|
541
|
public function homeOrProduct($source,$source_id = 0,$is_custom = 0){
|
541
|
public function homeOrProduct($source,$source_id = 0,$is_custom = 0){
|
|
542
|
if($is_custom == 0){
|
542
|
if($is_custom == 0){
|
|
543
|
if($source == BTemplate::SOURCE_HOME){
|
543
|
if($source == BTemplate::SOURCE_HOME){
|
|
544
|
- RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);
|
544
|
+ $route = RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);
|
|
545
|
$type = RouteMap::SOURCE_PAGE;
|
545
|
$type = RouteMap::SOURCE_PAGE;
|
|
546
|
}elseif($source == BTemplate::SOURCE_PRODUCT){
|
546
|
}elseif($source == BTemplate::SOURCE_PRODUCT){
|
|
547
|
$type = RouteMap::SOURCE_PRODUCT;
|
547
|
$type = RouteMap::SOURCE_PRODUCT;
|
|
@@ -552,7 +552,6 @@ class BTemplateLogic extends BaseLogic |
|
@@ -552,7 +552,6 @@ class BTemplateLogic extends BaseLogic |
|
552
|
}else{
|
552
|
}else{
|
|
553
|
$type = 'all';
|
553
|
$type = 'all';
|
|
554
|
}
|
554
|
}
|
|
555
|
- $route = RouteMap::getRoute($type,$source_id,$this->user['project_id']);
|
|
|
|
556
|
}else{
|
555
|
}else{
|
|
557
|
$type = RouteMap::SOURCE_MODULE;
|
556
|
$type = RouteMap::SOURCE_MODULE;
|
|
558
|
$route = RouteMap::getRoute($type,$source_id,$this->user['project_id']);
|
557
|
$route = RouteMap::getRoute($type,$source_id,$this->user['project_id']);
|
|
@@ -721,7 +720,7 @@ class BTemplateLogic extends BaseLogic |
|
@@ -721,7 +720,7 @@ class BTemplateLogic extends BaseLogic |
|
721
|
$this->fail('请先设置模板');
|
720
|
$this->fail('请先设置模板');
|
|
722
|
}
|
721
|
}
|
|
723
|
$is_custom = $this->param['is_custom'] ?? 0;//扩展模块详情模版
|
722
|
$is_custom = $this->param['is_custom'] ?? 0;//扩展模块详情模版
|
|
724
|
- $commonInfo = $this->getTypeCommonHtml($bSettingInfo['template_id'],$is_custom);
|
723
|
+ $commonInfo = $this->getTypeCommonHtml($bSettingInfo['template_id'],$this->param['type'],$is_custom);
|
|
725
|
//获取设置的默认中间部分
|
724
|
//获取设置的默认中间部分
|
|
726
|
$bTemplateMainModel = new BTemplateMain();
|
725
|
$bTemplateMainModel = new BTemplateMain();
|
|
727
|
$mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
|
726
|
$mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
|
|
@@ -745,17 +744,17 @@ class BTemplateLogic extends BaseLogic |
|
@@ -745,17 +744,17 @@ class BTemplateLogic extends BaseLogic |
|
745
|
* @method :post
|
744
|
* @method :post
|
|
746
|
* @time :2023/12/15 18:06
|
745
|
* @time :2023/12/15 18:06
|
|
747
|
*/
|
746
|
*/
|
|
748
|
- public function getTypeCommonHtml($template_id,$is_custom){
|
747
|
+ public function getTypeCommonHtml($template_id,$type,$is_custom){
|
|
749
|
//获取首页公共部分
|
748
|
//获取首页公共部分
|
|
750
|
$templateCommonModel = new BTemplateCommon();
|
749
|
$templateCommonModel = new BTemplateCommon();
|
|
751
|
$commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>1]);
|
750
|
$commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>1]);
|
|
752
|
- //判断当前项目是否有设置独立头部的权限
|
|
|
|
753
|
if($is_custom == BTemplate::SOURCE_CUSTOM){
|
751
|
if($is_custom == BTemplate::SOURCE_CUSTOM){
|
|
754
|
return $this->success($commonInfo);
|
752
|
return $this->success($commonInfo);
|
|
755
|
}
|
753
|
}
|
|
|
|
754
|
+ //判断当前项目是否有设置独立头部的权限
|
|
756
|
if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
|
755
|
if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
|
|
757
|
//有权限时,获取独立头部
|
756
|
//有权限时,获取独立头部
|
|
758
|
- $commonTypeInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
|
757
|
+ $commonTypeInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);
|
|
759
|
if($commonTypeInfo !== false){
|
758
|
if($commonTypeInfo !== false){
|
|
760
|
$commonInfo = $commonTypeInfo;
|
759
|
$commonInfo = $commonTypeInfo;
|
|
761
|
}
|
760
|
}
|