|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @remark :
|
|
|
|
* @name :BProjectIsComLogic.php
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/8/1 14:25
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Http\Logic\Bside\BTemplate;
|
|
|
|
|
|
|
|
use App\Http\Logic\Bside\BaseLogic;
|
|
|
|
use App\Models\CustomModule\CustomModule;
|
|
|
|
use App\Models\IsCom\ProjectIsCom;
|
|
|
|
use App\Models\Template\BTemplate;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :独立头部——底部设置
|
|
|
|
* @name :BProjectIsComLogic
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/8/1 14:43
|
|
|
|
*/
|
|
|
|
class BProjectIsComLogic extends BaseLogic
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* 初始化数据
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
$this->model = new ProjectIsCom();
|
|
|
|
$this->param = $this->requestAll;
|
|
|
|
}
|
|
|
|
|
|
|
|
const PUB_STATUS = 0;//公共
|
|
|
|
const PRO_STATUS = 1;//獨立
|
|
|
|
const IS_LIST = 1;
|
|
|
|
const IS_DETAIL = 0;
|
|
|
|
const IS_NO_CUSTOM = 0;
|
|
|
|
const IS_CUSTOM = 1;//扩展模块
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取初始数据
|
|
|
|
* @name :getIsComSetting
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/8/1 15:02
|
|
|
|
*/
|
|
|
|
public function getIsComConfig(){
|
|
|
|
$data = [];
|
|
|
|
$data = $this->initParamData($data);
|
|
|
|
$data = $this->initPageParamData($data);
|
|
|
|
$data = $this->initCustomData($data);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :(独立头底)初始数据
|
|
|
|
* @name :initializedData
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/8/1 11:52
|
|
|
|
*/
|
|
|
|
public function initParamData(&$data){
|
|
|
|
//默认模块
|
|
|
|
$initParam = $this->model->initParam;
|
|
|
|
foreach ($initParam as $pKey => $pValue){
|
|
|
|
$is_list = [self::IS_LIST,self::IS_DETAIL];
|
|
|
|
foreach ($is_list as $isValue){
|
|
|
|
//查询当前数据是否已保存
|
|
|
|
$info = $this->read(['source'=>$pValue,'is_list'=>$isValue,'is_custom'=>BTemplate::IS_NO_CUSTOM],['name','source','is_list','is_custom','header_status','footer_status']);
|
|
|
|
if($info !== false){
|
|
|
|
$data[] = $info;
|
|
|
|
}else{
|
|
|
|
$data[] = [
|
|
|
|
'name'=>$pKey.($isValue == 0 ? '详情' : '列表'),
|
|
|
|
'source'=>$pValue,
|
|
|
|
'is_list'=>$isValue,
|
|
|
|
'is_custom'=>self::IS_NO_CUSTOM,
|
|
|
|
'header_status'=>self::PUB_STATUS,
|
|
|
|
'footer_status'=>self::PUB_STATUS,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :单页面初始化
|
|
|
|
* @name :initPageParamData
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/8/1 14:37
|
|
|
|
*/
|
|
|
|
public function initPageParamData(&$data){
|
|
|
|
$initPageParam = $this->model->initPageParam;
|
|
|
|
foreach($initPageParam as $key => $value){
|
|
|
|
$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']);
|
|
|
|
if($info !== false){
|
|
|
|
$data[] = $info;
|
|
|
|
}else{
|
|
|
|
$data[] = [
|
|
|
|
'name'=>$key,
|
|
|
|
'source'=>$value,
|
|
|
|
'is_list'=>self::IS_DETAIL,
|
|
|
|
'is_custom'=>self::IS_NO_CUSTOM,
|
|
|
|
'header_status'=>self::PUB_STATUS,
|
|
|
|
'footer_status'=>self::PUB_STATUS,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取扩展模块初始数据
|
|
|
|
* @name :initCustomData
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/8/1 14:42
|
|
|
|
*/
|
|
|
|
public function initCustomData(&$data){
|
|
|
|
$customModel = new CustomModule();
|
|
|
|
$customList = $customModel->list(['status'=>0]);
|
|
|
|
$is_list = [self::IS_LIST,self::IS_DETAIL];
|
|
|
|
foreach($customList as $value){
|
|
|
|
foreach ($is_list as $isValue){
|
|
|
|
$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']);
|
|
|
|
if($info !== false){
|
|
|
|
$data[] = $info;
|
|
|
|
}else{
|
|
|
|
$data[] = [
|
|
|
|
'name'=>$value['name'].($isValue == self::IS_DETAIL ? '详情' : '列表'),
|
|
|
|
'source'=>$value['id'],
|
|
|
|
'is_list'=>$isValue,
|
|
|
|
'is_custom'=>self::IS_CUSTOM,
|
|
|
|
'header_status'=>self::PUB_STATUS,
|
|
|
|
'footer_status'=>self::PUB_STATUS,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|