|
...
|
...
|
@@ -9,10 +9,12 @@ |
|
|
|
|
|
|
|
namespace App\Http\Logic\Bside\CustomModule;
|
|
|
|
|
|
|
|
use App\Helper\Arr;
|
|
|
|
use App\Http\Logic\Bside\BaseLogic;
|
|
|
|
use App\Models\CustomModule\CustomModuleCategory;
|
|
|
|
use App\Models\CustomModule\CustomModuleContent;
|
|
|
|
use App\Models\RouteMap\RouteMap;
|
|
|
|
use App\Models\Template\BTemplate;
|
|
|
|
|
|
|
|
class CustomModuleCategoryLogic extends BaseLogic
|
|
|
|
{
|
|
...
|
...
|
@@ -247,4 +249,92 @@ class CustomModuleCategoryLogic extends BaseLogic |
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :复制扩展模块内容页
|
|
|
|
* @name :copyModuleContentInfo
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/4/28 16:32
|
|
|
|
*/
|
|
|
|
public function copyCategory(){
|
|
|
|
$info = $this->model->read(['id'=>$this->param['id']]);
|
|
|
|
$param = $this->setContentParams($info);
|
|
|
|
$save_id = $this->model->insertGetId($param);
|
|
|
|
$this->copyTemplate($this->param['id'],$info['project_id'],$save_id,$info['module_id']);
|
|
|
|
$this->response('success');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :字段处理
|
|
|
|
* @name :setContentParams
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/4/28 16:33
|
|
|
|
*/
|
|
|
|
public function setContentParams($info){
|
|
|
|
return [
|
|
|
|
'name'=>$info['name'].'-copy',
|
|
|
|
'status'=>$info['status'],
|
|
|
|
'sort'=>$info['sort'],
|
|
|
|
'pid'=>0,
|
|
|
|
'remark'=>$info['remark'],
|
|
|
|
'route'=>$info['route'],
|
|
|
|
'project_id'=>$info['project_id'],
|
|
|
|
'operator_id'=>$this->user['id'],
|
|
|
|
'module_id'=>$info['module_id'],
|
|
|
|
'image'=>$info['image'],
|
|
|
|
'created_at'=>date('Y-m-d H:i:s'),
|
|
|
|
'updated_at'=>date('Y-m-d H:i:s')
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :同步模版数据
|
|
|
|
* @name :copyTemplate
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/29 15:53
|
|
|
|
*/
|
|
|
|
public function copyTemplate($id,$project_id,$save_id,$module_id){
|
|
|
|
$BTemplateModel = new BTemplate();
|
|
|
|
$list = $BTemplateModel->list(['source'=>$module_id,'source_id'=>$id,'is_list'=>BTemplate::IS_LIST,'is_custom'=>BTemplate::IS_CUSTOM,'project_id'=>$project_id]);
|
|
|
|
if(!empty($list)){
|
|
|
|
$data = [];
|
|
|
|
foreach ($list as $v){
|
|
|
|
$data[] = $this->setTemplateParams($v,$project_id,$save_id);
|
|
|
|
}
|
|
|
|
$rs = $BTemplateModel->insert($data);
|
|
|
|
if($rs === false){
|
|
|
|
$this->fail('error');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :组装模版数据
|
|
|
|
* @name :setTemplateParams
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/29 15:54
|
|
|
|
*/
|
|
|
|
public function setTemplateParams($v,$project_id,$save_id){
|
|
|
|
$param = [
|
|
|
|
'html'=>$v['html'],
|
|
|
|
'project_id'=>$project_id,
|
|
|
|
'source'=>$v['source'],
|
|
|
|
'source_id'=>$save_id,
|
|
|
|
'template_id'=>$v['template_id'],
|
|
|
|
'section_list_id'=>$v['section_list_id'],
|
|
|
|
'main_html'=>$v['main_html'],
|
|
|
|
'main_css'=>$v['main_css'],
|
|
|
|
'is_custom'=>$v['is_custom'],
|
|
|
|
'is_list'=>$v['is_list'],
|
|
|
|
'type'=>$v['type'],
|
|
|
|
'created_at'=>$v['created_at'],
|
|
|
|
'updated_at'=>$v['updated_at']
|
|
|
|
];
|
|
|
|
return $this->success($param);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|