正在显示
5 个修改的文件
包含
188 行增加
和
31 行删除
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :BProjectIsComController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/8/1 14:24 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Controllers\Bside\Template; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Controllers\Bside\BaseController; | ||
| 14 | +use App\Http\Logic\Bside\BTemplate\BProjectIsComLogic; | ||
| 15 | + | ||
| 16 | +class BProjectIsComController extends BaseController | ||
| 17 | +{ | ||
| 18 | + /** | ||
| 19 | + * @remark :获取头部底部配置 | ||
| 20 | + * @name :getIsComConfig | ||
| 21 | + * @author :lyh | ||
| 22 | + * @method :post | ||
| 23 | + * @time :2024/8/1 15:08 | ||
| 24 | + */ | ||
| 25 | + public function getIsComConfig(BProjectIsComLogic $logic){ | ||
| 26 | + $data = $logic->getIsComConfig(); | ||
| 27 | + $this->response('success',Code::SUCCESS,$data); | ||
| 28 | + } | ||
| 29 | +} |
| @@ -93,9 +93,11 @@ class CustomModuleLogic extends BaseLogic | @@ -93,9 +93,11 @@ class CustomModuleLogic extends BaseLogic | ||
| 93 | 'name'=>$this->param['route'], | 93 | 'name'=>$this->param['route'], |
| 94 | 'module_id'=>$id, | 94 | 'module_id'=>$id, |
| 95 | 'project_id'=>$this->param['project_id'], | 95 | 'project_id'=>$this->param['project_id'], |
| 96 | - 'route'=>RouteMap::setRoute($this->param['route'],RouteMap::SOURCE_MODULE_CATE,$id,$this->param['project_id']) | 96 | + 'route'=>$this->param['route'] |
| 97 | ]; | 97 | ]; |
| 98 | - $customModuleCateModel->add($data); | 98 | + $cateId = $customModuleCateModel->addReturnId($data); |
| 99 | + $route = RouteMap::setRoute($this->param['route'],RouteMap::SOURCE_MODULE_CATE,$cateId,$this->param['project_id']); | ||
| 100 | + $customModuleCateModel->edit(['route'=>$route],['id'=>$cateId]); | ||
| 99 | } | 101 | } |
| 100 | return $this->success(); | 102 | return $this->success(); |
| 101 | } | 103 | } |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :BProjectIsComLogic.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/8/1 14:25 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Logic\Bside\BTemplate; | ||
| 11 | + | ||
| 12 | +use App\Http\Logic\Bside\BaseLogic; | ||
| 13 | +use App\Models\CustomModule\CustomModule; | ||
| 14 | +use App\Models\IsCom\ProjectIsCom; | ||
| 15 | +use App\Models\Template\BTemplate; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * @remark :独立头部——底部设置 | ||
| 19 | + * @name :BProjectIsComLogic | ||
| 20 | + * @author :lyh | ||
| 21 | + * @method :post | ||
| 22 | + * @time :2024/8/1 14:43 | ||
| 23 | + */ | ||
| 24 | +class BProjectIsComLogic extends BaseLogic | ||
| 25 | +{ | ||
| 26 | + /** | ||
| 27 | + * 初始化数据 | ||
| 28 | + */ | ||
| 29 | + public function __construct() | ||
| 30 | + { | ||
| 31 | + parent::__construct(); | ||
| 32 | + $this->model = new ProjectIsCom(); | ||
| 33 | + $this->param = $this->requestAll; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + const PUB_STATUS = 0;//公共 | ||
| 37 | + const PRO_STATUS = 1;//獨立 | ||
| 38 | + const IS_LIST = 1; | ||
| 39 | + const IS_DETAIL = 0; | ||
| 40 | + const IS_NO_CUSTOM = 0; | ||
| 41 | + const IS_CUSTOM = 1;//扩展模块 | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * @remark :获取初始数据 | ||
| 45 | + * @name :getIsComSetting | ||
| 46 | + * @author :lyh | ||
| 47 | + * @method :post | ||
| 48 | + * @time :2024/8/1 15:02 | ||
| 49 | + */ | ||
| 50 | + public function getIsComConfig(){ | ||
| 51 | + $data = []; | ||
| 52 | + $data = $this->initParamData($data); | ||
| 53 | + $data = $this->initPageParamData($data); | ||
| 54 | + $data = $this->initCustomData($data); | ||
| 55 | + return $this->success($data); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * @remark :(独立头底)初始数据 | ||
| 61 | + * @name :initializedData | ||
| 62 | + * @author :lyh | ||
| 63 | + * @method :post | ||
| 64 | + * @time :2024/8/1 11:52 | ||
| 65 | + */ | ||
| 66 | + public function initParamData(&$data){ | ||
| 67 | + //默认模块 | ||
| 68 | + $initParam = $this->model->initParam; | ||
| 69 | + foreach ($initParam as $pKey => $pValue){ | ||
| 70 | + $is_list = [self::IS_LIST,self::IS_DETAIL]; | ||
| 71 | + foreach ($is_list as $isValue){ | ||
| 72 | + //查询当前数据是否已保存 | ||
| 73 | + $info = $this->read(['source'=>$pValue,'is_list'=>$isValue,'is_custom'=>BTemplate::IS_NO_CUSTOM],['name','source','is_list','is_custom','header_status','footer_status']); | ||
| 74 | + if($info !== false){ | ||
| 75 | + $data[] = $info; | ||
| 76 | + }else{ | ||
| 77 | + $data[] = [ | ||
| 78 | + 'name'=>$pKey.($isValue == 0 ? '详情' : '列表'), | ||
| 79 | + 'source'=>$pValue, | ||
| 80 | + 'is_list'=>$isValue, | ||
| 81 | + 'is_custom'=>self::IS_NO_CUSTOM, | ||
| 82 | + 'header_status'=>self::PUB_STATUS, | ||
| 83 | + 'footer_status'=>self::PUB_STATUS, | ||
| 84 | + ]; | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | + return $this->success($data); | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + /** | ||
| 92 | + * @remark :单页面初始化 | ||
| 93 | + * @name :initPageParamData | ||
| 94 | + * @author :lyh | ||
| 95 | + * @method :post | ||
| 96 | + * @time :2024/8/1 14:37 | ||
| 97 | + */ | ||
| 98 | + public function initPageParamData(&$data){ | ||
| 99 | + $initPageParam = $this->model->initPageParam; | ||
| 100 | + foreach($initPageParam as $key => $value){ | ||
| 101 | + $info = $this->read(['source'=>$value,'is_list'=>self::IS_DETAIL,'is_custom'=>BTemplate::IS_NO_CUSTOM],['name','source','is_list','is_custom','header_status','footer_status']); | ||
| 102 | + if($info !== false){ | ||
| 103 | + $data[] = $info; | ||
| 104 | + }else{ | ||
| 105 | + $data[] = [ | ||
| 106 | + 'name'=>$key, | ||
| 107 | + 'source'=>$value, | ||
| 108 | + 'is_list'=>self::IS_DETAIL, | ||
| 109 | + 'is_custom'=>self::IS_NO_CUSTOM, | ||
| 110 | + 'header_status'=>self::PUB_STATUS, | ||
| 111 | + 'footer_status'=>self::PUB_STATUS, | ||
| 112 | + ]; | ||
| 113 | + } | ||
| 114 | + } | ||
| 115 | + return $this->success($data); | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + /** | ||
| 119 | + * @remark :获取扩展模块初始数据 | ||
| 120 | + * @name :initCustomData | ||
| 121 | + * @author :lyh | ||
| 122 | + * @method :post | ||
| 123 | + * @time :2024/8/1 14:42 | ||
| 124 | + */ | ||
| 125 | + public function initCustomData(&$data){ | ||
| 126 | + $customModel = new CustomModule(); | ||
| 127 | + $customList = $customModel->list(['status'=>0]); | ||
| 128 | + $is_list = [self::IS_LIST,self::IS_DETAIL]; | ||
| 129 | + foreach($customList as $value){ | ||
| 130 | + foreach ($is_list as $isValue){ | ||
| 131 | + $info = $this->model->read(['source'=>$value['id'],'is_list'=>$isValue,'is_custom'=>BTemplate::IS_CUSTOM],['id','name','source','is_list','is_custom','header_status','footer_status']); | ||
| 132 | + if($info !== false){ | ||
| 133 | + $data[] = $info; | ||
| 134 | + }else{ | ||
| 135 | + $data[] = [ | ||
| 136 | + 'name'=>$value['name'].($isValue == self::IS_DETAIL ? '详情' : '列表'), | ||
| 137 | + 'source'=>$value['id'], | ||
| 138 | + 'is_list'=>$isValue, | ||
| 139 | + 'is_custom'=>self::IS_CUSTOM, | ||
| 140 | + 'header_status'=>self::PUB_STATUS, | ||
| 141 | + 'footer_status'=>self::PUB_STATUS, | ||
| 142 | + ]; | ||
| 143 | + } | ||
| 144 | + } | ||
| 145 | + } | ||
| 146 | + return $this->success($data); | ||
| 147 | + } | ||
| 148 | +} |
| @@ -23,13 +23,13 @@ use App\Models\Template\Template; | @@ -23,13 +23,13 @@ use App\Models\Template\Template; | ||
| 23 | */ | 23 | */ |
| 24 | class ProjectIsCom extends Base | 24 | class ProjectIsCom extends Base |
| 25 | { | 25 | { |
| 26 | - protected $table = 'gl_project_is_com'; | 26 | + protected $table = 'gl_project_com_config'; |
| 27 | 27 | ||
| 28 | /** | 28 | /** |
| 29 | * @name :(包含详情页+列表页) | 29 | * @name :(包含详情页+列表页) |
| 30 | * @var array | 30 | * @var array |
| 31 | */ | 31 | */ |
| 32 | - protected $initParam = [ | 32 | + public $initParam = [ |
| 33 | '首页'=>BTemplate::SOURCE_HOME, | 33 | '首页'=>BTemplate::SOURCE_HOME, |
| 34 | '产品'=>BTemplate::SOURCE_PRODUCT, | 34 | '产品'=>BTemplate::SOURCE_PRODUCT, |
| 35 | '博客'=>BTemplate::SOURCE_BLOG, | 35 | '博客'=>BTemplate::SOURCE_BLOG, |
| @@ -40,34 +40,8 @@ class ProjectIsCom extends Base | @@ -40,34 +40,8 @@ class ProjectIsCom extends Base | ||
| 40 | * @name : 单一界面 | 40 | * @name : 单一界面 |
| 41 | * @var array | 41 | * @var array |
| 42 | */ | 42 | */ |
| 43 | - protected $initPageParam = [ | 43 | + public $initPageParam = [ |
| 44 | '单页面'=>BTemplate::SOURCE_PAGE, | 44 | '单页面'=>BTemplate::SOURCE_PAGE, |
| 45 | ]; | 45 | ]; |
| 46 | 46 | ||
| 47 | - /** | ||
| 48 | - * @remark :初始数据 | ||
| 49 | - * @name :initializedData | ||
| 50 | - * @author :lyh | ||
| 51 | - * @method :post | ||
| 52 | - * @time :2024/8/1 11:52 | ||
| 53 | - */ | ||
| 54 | - public function initializedData(){ | ||
| 55 | - $data = []; | ||
| 56 | - $initParam = $this->initParam; | ||
| 57 | - foreach ($initParam as $pKey => $pValue){ | ||
| 58 | - $is_list = [BTemplate::IS_LIST,BTemplate::IS_DETAIL]; | ||
| 59 | - foreach ($is_list as $isValue){ | ||
| 60 | - $name = $pKey.($isValue == 0 ? '详情' : '列表'); | ||
| 61 | - $data[] = [ | ||
| 62 | - 'name'=>$name, | ||
| 63 | - 'source'=>$pValue, | ||
| 64 | - 'is_list'=>$isValue, | ||
| 65 | - 'header_status'=>0, | ||
| 66 | - 'footer_status'=>0, | ||
| 67 | - 'created_at'=>date('Y-m-d H:i:s'), | ||
| 68 | - 'updated_at'=>date('Y-m-d H:i:s'), | ||
| 69 | - ]; | ||
| 70 | - } | ||
| 71 | - } | ||
| 72 | - } | ||
| 73 | } | 47 | } |
| @@ -554,6 +554,10 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -554,6 +554,10 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 554 | Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'save'])->name('template_label_save'); | 554 | Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'save'])->name('template_label_save'); |
| 555 | Route::any('/del', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'del'])->name('template_label_del'); | 555 | Route::any('/del', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'del'])->name('template_label_del'); |
| 556 | }); | 556 | }); |
| 557 | + //设置公共头部+底部配置 | ||
| 558 | + Route::prefix('com_config')->group(function () { | ||
| 559 | + Route::any('/getIsComConfig', [\App\Http\Controllers\Bside\Template\BProjectIsComController::class, 'getIsComConfig'])->name('template_label_getUserLists'); | ||
| 560 | + }); | ||
| 557 | }); | 561 | }); |
| 558 | //无需登录验证的路由组 | 562 | //无需登录验证的路由组 |
| 559 | Route::group([], function () { | 563 | Route::group([], function () { |
-
请 注册 或 登录 后发表评论