作者 lyh

gx

@@ -15,7 +15,7 @@ class WebSettingServiceController extends BaseController @@ -15,7 +15,7 @@ class WebSettingServiceController extends BaseController
15 * @time :2023/5/4 11:28 15 * @time :2023/5/4 11:28
16 */ 16 */
17 public function lists(WebSettingServiceLogic $webSettingServiceLogic){ 17 public function lists(WebSettingServiceLogic $webSettingServiceLogic){
18 - $lists = $webSettingServiceLogic->setting_service_info(); 18 + $lists = $webSettingServiceLogic->setting_service_list();
19 $this->response('success',Code::SUCCESS,$lists); 19 $this->response('success',Code::SUCCESS,$lists);
20 } 20 }
21 /** 21 /**
@@ -29,14 +29,4 @@ class WebSettingServiceController extends BaseController @@ -29,14 +29,4 @@ class WebSettingServiceController extends BaseController
29 $this->response('success'); 29 $this->response('success');
30 } 30 }
31 31
32 - /**  
33 - * @name :del  
34 - * @author :lyh  
35 - * @method :post  
36 - * @time :2023/5/4 11:28  
37 - */  
38 - public function del(WebSettingServiceLogic $webSettingServiceLogic){  
39 - $webSettingServiceLogic->setting_service_del();  
40 - $this->response('success');  
41 - }  
42 } 32 }
@@ -28,6 +28,7 @@ class WebSettingFromLogic extends BaseLogic @@ -28,6 +28,7 @@ class WebSettingFromLogic extends BaseLogic
28 } 28 }
29 return $this->success($info); 29 return $this->success($info);
30 } 30 }
  31 +
31 /** 32 /**
32 * @name :(表单设置)setting_from_save 33 * @name :(表单设置)setting_from_save
33 * @param :(is_required是否必填,name名称) 34 * @param :(is_required是否必填,name名称)
@@ -36,30 +37,16 @@ class WebSettingFromLogic extends BaseLogic @@ -36,30 +37,16 @@ class WebSettingFromLogic extends BaseLogic
36 * @time :2023/5/4 10:39 37 * @time :2023/5/4 10:39
37 */ 38 */
38 public function setting_from_save(){ 39 public function setting_from_save(){
39 - if(isset($this->param['id']) && !empty($this->param['id'])){  
40 - $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);  
41 - }else{  
42 - $this->param['project_id'] = $this->user['project_id'];  
43 - $rs = $this->model->add($this->param);  
44 - }  
45 - if($rs === false){ 40 + try {
  41 + //删除以前的数据
  42 + $param['project_id'] = ['in',$this->user['project_id']];
  43 + $this->model->del($param);
  44 + //新增
  45 + $this->model->add($this->param);
  46 + }catch (\Exception $e){
46 $this->fail('error'); 47 $this->fail('error');
47 } 48 }
48 return $this->success(); 49 return $this->success();
49 } 50 }
50 51
51 - /**  
52 - * @name :(删除表单设置)setting_from_del  
53 - * @param : (id主键)  
54 - * @author :lyh  
55 - * @method :post  
56 - * @time :2023/5/4 11:01  
57 - */  
58 - public function setting_from_del(){  
59 - $rs = $this->model->del($this->param);  
60 - if($rs === false){  
61 - $this->fail('error');  
62 - }  
63 - return $this->success();  
64 - }  
65 } 52 }
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 2
3 namespace App\Http\Logic\Bside\Setting; 3 namespace App\Http\Logic\Bside\Setting;
4 4
5 -use App\Http\Controllers\ImageLogic;  
6 use App\Http\Logic\Bside\BaseLogic; 5 use App\Http\Logic\Bside\BaseLogic;
7 use App\Models\Image; 6 use App\Models\Image;
8 use App\Models\WebSetting\WebSettingService; 7 use App\Models\WebSetting\WebSettingService;
@@ -24,9 +23,9 @@ class WebSettingServiceLogic extends BaseLogic @@ -24,9 +23,9 @@ class WebSettingServiceLogic extends BaseLogic
24 * @method :post 23 * @method :post
25 * @time :2023/5/4 11:23 24 * @time :2023/5/4 11:23
26 */ 25 */
27 - public function setting_service_info(){  
28 - $info = $this->model->read(['project_id'=>$this->param['project_id']]);  
29 - return $this->success($info); 26 + public function setting_service_list(){
  27 + $list = $this->model->list(['project_id'=>$this->param['project_id']]);
  28 + return $this->success($list);
30 } 29 }
31 30
32 /** 31 /**
@@ -36,12 +35,13 @@ class WebSettingServiceLogic extends BaseLogic @@ -36,12 +35,13 @@ class WebSettingServiceLogic extends BaseLogic
36 * @time :2023/5/4 11:10 35 * @time :2023/5/4 11:10
37 */ 36 */
38 public function setting_service_save(){ 37 public function setting_service_save(){
39 - if(isset($this->param['id'])){  
40 - $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);  
41 - }else{  
42 - $rs = $this->model->add($this->param);  
43 - }  
44 - if($rs === false){ 38 + try {
  39 + //删除以前的数据
  40 + $param['project_id'] = ['in',$this->user['project_id']];
  41 + $this->model->del($param);
  42 + //新增
  43 + $this->model->add($this->param);
  44 + }catch (\Exception $e){
45 $this->fail('error'); 45 $this->fail('error');
46 } 46 }
47 return $this->success(); 47 return $this->success();