作者 lyh

gx

... ... @@ -50,8 +50,8 @@ class ExtendController extends BaseController
'title.required' => '字段名称不能为空',
'type.required' => '字段类型不能为空',
]);
$extendLogic->extendSave();
$this->response('success');
$info = $extendLogic->extendSave();
$this->response('success',Code::SUCCESS,$info);
}
/**
... ...
... ... @@ -31,13 +31,13 @@ class ExtendLogic extends BaseLogic
* @time :2023/11/9 14:29
*/
public function extendSave(){
$info = $this->model->read(['title'=>$this->param['title']]);
if($info !== false){
$this->fail('当前扩展名称已存在');
}
if(isset($this->param['id']) && !empty($this->param['id'])){
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$info = $this->model->read(['title'=>$this->param['title']]);
if($info !== false){
$this->fail('当前扩展名称已存在');
}
$key = trim(strtolower(preg_replace('/[\W]+/', '-', trim(Translate::tran($this->param['title'], 'en')))), '-');
$this->param['key'] = $this->getKey($key);
$this->param['project_id'] = $this->user['project_id'];
... ... @@ -46,7 +46,7 @@ class ExtendLogic extends BaseLogic
if($rs === false){
$this->fail('error');
}
return $this->success();
return $this->success($this->param);
}
/**
... ...