作者 lyh

gx

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