|
...
|
...
|
@@ -49,12 +49,15 @@ class CustomModuleLogic extends BaseLogic |
|
|
|
* @time :2023/12/4 15:47
|
|
|
|
*/
|
|
|
|
public function customModuleSave(){
|
|
|
|
ProjectServer::useProject($this->param['project_id']);
|
|
|
|
$this->param = $this->handleParam($this->param);
|
|
|
|
$this->checkIsName($this->param['name'],$this->param['id'] ?? 0);
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
$this->moduleEdit();
|
|
|
|
}else{
|
|
|
|
$this->moduleAdd();
|
|
|
|
}
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -81,12 +84,10 @@ class CustomModuleLogic extends BaseLogic |
|
|
|
* @time :2023/12/5 9:39
|
|
|
|
*/
|
|
|
|
public function moduleAdd(){
|
|
|
|
ProjectServer::useProject($this->param['project_id']);
|
|
|
|
$rs = (new CustomModule())->add($this->param);
|
|
|
|
if($rs === false){
|
|
|
|
$this->fail('系统错误,请联系管理员');
|
|
|
|
}
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -98,16 +99,32 @@ class CustomModuleLogic extends BaseLogic |
|
|
|
* @time :2023/12/5 9:39
|
|
|
|
*/
|
|
|
|
public function moduleEdit(){
|
|
|
|
ProjectServer::useProject($this->param['project_id']);
|
|
|
|
$rs = (new CustomModule())->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
if($rs === false){
|
|
|
|
$this->fail('系统错误,请联系管理员');
|
|
|
|
}
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :验证名称是否存在
|
|
|
|
* @name :checkIsName
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/1/6 14:06
|
|
|
|
*/
|
|
|
|
public function checkIsName($name,$id = 0){
|
|
|
|
$param['name'] = $name;
|
|
|
|
if(!empty($id)){
|
|
|
|
$param['id'] = ['id'=>['!=',$id],];
|
|
|
|
}
|
|
|
|
$info = (new CustomModule())->read($param);
|
|
|
|
if($info !== false){
|
|
|
|
$this->fail('当前名称已存在');
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @remark :删除数据
|
|
|
|
* @name :ModuleDel
|
|
|
|
* @author :lyh
|
...
|
...
|
|