正在显示
4 个修改的文件
包含
21 行增加
和
140 行删除
| @@ -22,28 +22,11 @@ class ServiceController extends BaseController | @@ -22,28 +22,11 @@ class ServiceController extends BaseController | ||
| 22 | * @time :2023/6/25 14:31 | 22 | * @time :2023/6/25 14:31 |
| 23 | */ | 23 | */ |
| 24 | public function lists(ServiceLogic $serviceLogic){ | 24 | public function lists(ServiceLogic $serviceLogic){ |
| 25 | - $lists = $serviceLogic->serviceLists($this->map,$this->page,$this->row,$this->order); | 25 | + $lists = $serviceLogic->serviceLists($this->map); |
| 26 | $this->response('success',Code::SUCCESS,$lists); | 26 | $this->response('success',Code::SUCCESS,$lists); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | /** | 29 | /** |
| 30 | - * @remark :企业服务通知详情 | ||
| 31 | - * @name :read | ||
| 32 | - * @author :lyh | ||
| 33 | - * @method :post | ||
| 34 | - * @time :2023/6/25 11:50 | ||
| 35 | - */ | ||
| 36 | - public function read(ServiceLogic $serviceLogic){ | ||
| 37 | - $this->request->validate([ | ||
| 38 | - 'id' => 'required', | ||
| 39 | - ],[ | ||
| 40 | - 'id.required' => '主键不能为空', | ||
| 41 | - ]); | ||
| 42 | - $info = $serviceLogic->serviceRead(); | ||
| 43 | - $this->response('success',Code::SUCCESS,$info); | ||
| 44 | - } | ||
| 45 | - | ||
| 46 | - /** | ||
| 47 | * @remark :新增或编辑 | 30 | * @remark :新增或编辑 |
| 48 | * @name :save | 31 | * @name :save |
| 49 | * @author :lyh | 32 | * @author :lyh |
| @@ -51,53 +34,11 @@ class ServiceController extends BaseController | @@ -51,53 +34,11 @@ class ServiceController extends BaseController | ||
| 51 | * @time :2023/6/25 11:51 | 34 | * @time :2023/6/25 11:51 |
| 52 | */ | 35 | */ |
| 53 | public function save(ServiceLogic $serviceLogic){ | 36 | public function save(ServiceLogic $serviceLogic){ |
| 54 | - if(isset($this->param['id'])){ | ||
| 55 | - $this->request->validate([ | ||
| 56 | - 'id' => 'required', | ||
| 57 | - ],[ | ||
| 58 | - 'id.required' => '主键不能为空', | ||
| 59 | - ]); | ||
| 60 | - } | ||
| 61 | - //参数验证 | ||
| 62 | - $this->verifyParam(); | ||
| 63 | $serviceLogic->serviceSave(); | 37 | $serviceLogic->serviceSave(); |
| 64 | $this->response('success'); | 38 | $this->response('success'); |
| 65 | } | 39 | } |
| 66 | 40 | ||
| 67 | - /** | ||
| 68 | - * @remark :编辑指定状态 | ||
| 69 | - * @name :status | ||
| 70 | - * @author :lyh | ||
| 71 | - * @method :post | ||
| 72 | - * @time :2023/6/25 14:15 | ||
| 73 | - */ | ||
| 74 | - public function status(ServiceLogic $serviceLogic){ | ||
| 75 | - $this->request->validate([ | ||
| 76 | - 'id' => 'required', | ||
| 77 | - ],[ | ||
| 78 | - 'id.required' => '主键不能为空', | ||
| 79 | - ]); | ||
| 80 | - $serviceLogic->serviceStatus(); | ||
| 81 | - $this->response('success'); | ||
| 82 | - } | ||
| 83 | 41 | ||
| 84 | - /** | ||
| 85 | - * @param ServiceLogic $serviceLogic | ||
| 86 | - * @remark :删除信息 | ||
| 87 | - * @name :del | ||
| 88 | - * @author :lyh | ||
| 89 | - * @method :post | ||
| 90 | - * @time :2023/6/25 14:26 | ||
| 91 | - */ | ||
| 92 | - public function del(ServiceLogic $serviceLogic){ | ||
| 93 | - $this->request->validate([ | ||
| 94 | - 'id' => 'required|array', | ||
| 95 | - ],[ | ||
| 96 | - 'id.required' => '主键不能为空', | ||
| 97 | - ]); | ||
| 98 | - $serviceLogic->serviceDel(); | ||
| 99 | - $this->response('success'); | ||
| 100 | - } | ||
| 101 | 42 | ||
| 102 | /** | 43 | /** |
| 103 | * @remark :参数验证 | 44 | * @remark :参数验证 |
| @@ -22,49 +22,29 @@ class ServiceLogic extends BaseLogic | @@ -22,49 +22,29 @@ class ServiceLogic extends BaseLogic | ||
| 22 | * @method :post | 22 | * @method :post |
| 23 | * @time :2023/6/25 14:32 | 23 | * @time :2023/6/25 14:32 |
| 24 | */ | 24 | */ |
| 25 | - public function serviceLists($map,$page,$row,$order = 'id',$filed = ['*']){ | ||
| 26 | - $lists = $this->model->lists($map,$page,$row,$order,$filed); | 25 | + public function serviceLists($map){ |
| 26 | + $map['type'] = 1; | ||
| 27 | + $lists = $this->model->list($map); | ||
| 27 | foreach ($lists as $k => $v){ | 28 | foreach ($lists as $k => $v){ |
| 28 | - if(!empty($v['images'])){ | ||
| 29 | - $arr = explode(',',$v['images']); | ||
| 30 | - foreach ($arr as $k1 => $v1){ | ||
| 31 | - $v['images_link'][$k1] = url('a/image/'.$v1); | ||
| 32 | - } | ||
| 33 | - } | ||
| 34 | - if(!empty($v['android'])){ | ||
| 35 | - $v['android_link'] = url('a/image/'.$v['android']); | ||
| 36 | - } | ||
| 37 | - if(!empty($v['ios'])){ | ||
| 38 | - $v['ios_link'] = url('a/image/'.$v['ios']); | 29 | + switch ($v['key']){ |
| 30 | + case 'images': | ||
| 31 | + $arr = explode(',',$v['values']); | ||
| 32 | + foreach ($arr as $k1 => $v1){ | ||
| 33 | + $v['images_link'][$k1] = url('a/image/'.$v1); | ||
| 34 | + } | ||
| 35 | + break; | ||
| 36 | + case 'android': | ||
| 37 | + $v['android_link'] = url('a/image/'.$v['values']); | ||
| 38 | + break; | ||
| 39 | + case 'ios': | ||
| 40 | + $v['ios_link'] = url('a/image/'.$v['values']); | ||
| 41 | + break; | ||
| 39 | } | 42 | } |
| 40 | $lists[$k] = $v; | 43 | $lists[$k] = $v; |
| 41 | } | 44 | } |
| 42 | return $this->success($lists); | 45 | return $this->success($lists); |
| 43 | } | 46 | } |
| 44 | 47 | ||
| 45 | - /** | ||
| 46 | - * @remark :获取详情 | ||
| 47 | - * @name :serviceRead | ||
| 48 | - * @author :lyh | ||
| 49 | - * @method :post | ||
| 50 | - * @time :2023/6/25 13:44 | ||
| 51 | - */ | ||
| 52 | - public function serviceRead(){ | ||
| 53 | - $info = $this->model->read(['id'=>$this->param['id']]); | ||
| 54 | - if(!empty($info['images'])){ | ||
| 55 | - $arr = explode(',',$info['images']); | ||
| 56 | - foreach ($arr as $k => $v){ | ||
| 57 | - $info['images_link'][$k] = url('a/image/'.$v); | ||
| 58 | - } | ||
| 59 | - } | ||
| 60 | - if(!empty($info['android'])){ | ||
| 61 | - $info['android_link'] = url('a/image/'.$info['android']); | ||
| 62 | - } | ||
| 63 | - if(!empty($info['ios'])){ | ||
| 64 | - $info['ios_link'] = url('a/image/'.$info['ios']); | ||
| 65 | - } | ||
| 66 | - return $this->success($info); | ||
| 67 | - } | ||
| 68 | 48 | ||
| 69 | /** | 49 | /** |
| 70 | * @remark :新增或编辑 | 50 | * @remark :新增或编辑 |
| @@ -74,49 +54,12 @@ class ServiceLogic extends BaseLogic | @@ -74,49 +54,12 @@ class ServiceLogic extends BaseLogic | ||
| 74 | * @time :2023/6/25 13:45 | 54 | * @time :2023/6/25 13:45 |
| 75 | */ | 55 | */ |
| 76 | public function serviceSave(){ | 56 | public function serviceSave(){ |
| 77 | - if(isset($this->param['id'])){ | ||
| 78 | - $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 79 | - }else{ | ||
| 80 | - $rs = $this->model->add($this->param); | ||
| 81 | - } | 57 | + $rs = $this->model->insert($this->param['data']); |
| 82 | if($rs === false){ | 58 | if($rs === false){ |
| 83 | - $this->fail('error'); | 59 | + $this->fail('批量插入失败'); |
| 84 | } | 60 | } |
| 85 | return $this->success(); | 61 | return $this->success(); |
| 86 | } | 62 | } |
| 87 | 63 | ||
| 88 | - /** | ||
| 89 | - * @remark :指定状态始终为一条数据 | ||
| 90 | - * @name :serviceStatus | ||
| 91 | - * @author :lyh | ||
| 92 | - * @method :post | ||
| 93 | - * @time :2023/6/25 14:09 | ||
| 94 | - */ | ||
| 95 | - public function serviceStatus(){ | ||
| 96 | - DB::beginTransaction(); | ||
| 97 | - try { | ||
| 98 | - $this->model->edit(['status'=>1],['id'=>['!=',$this->param['id']]]); | ||
| 99 | - $this->model->edit(['status'=>0],['id'=>$this->param['id']]); | ||
| 100 | - DB::commit(); | ||
| 101 | - }catch (\Exception $e){ | ||
| 102 | - DB::rollBack(); | ||
| 103 | - $this->fail('error'); | ||
| 104 | - } | ||
| 105 | - return $this->success(); | ||
| 106 | - } | ||
| 107 | 64 | ||
| 108 | - /** | ||
| 109 | - * @remark :删除企业服务信息 | ||
| 110 | - * @name :serviceDel | ||
| 111 | - * @author :lyh | ||
| 112 | - * @method :post | ||
| 113 | - * @time :2023/6/25 14:22 | ||
| 114 | - */ | ||
| 115 | - public function serviceDel(){ | ||
| 116 | - $rs = $this->model->del(['id'=>['in',$this->param['id']]]); | ||
| 117 | - if($rs === false){ | ||
| 118 | - $this->fail('error'); | ||
| 119 | - } | ||
| 120 | - return $this->success(); | ||
| 121 | - } | ||
| 122 | } | 65 | } |
| @@ -3,12 +3,12 @@ | @@ -3,12 +3,12 @@ | ||
| 3 | namespace App\Models; | 3 | namespace App\Models; |
| 4 | 4 | ||
| 5 | /** | 5 | /** |
| 6 | - * @remark :企业服务中心 | 6 | + * @remark :企业服务中心设置 |
| 7 | * @name :Service | 7 | * @name :Service |
| 8 | * @author :lyh | 8 | * @author :lyh |
| 9 | * @time :2023/6/25 11:53 | 9 | * @time :2023/6/25 11:53 |
| 10 | */ | 10 | */ |
| 11 | class Service extends Base | 11 | class Service extends Base |
| 12 | { | 12 | { |
| 13 | - protected $table = 'gl_enterprise_service'; | 13 | + protected $table = 'gl_service_setting'; |
| 14 | } | 14 | } |
| @@ -117,10 +117,7 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -117,10 +117,7 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 117 | //企业服务配置信息 | 117 | //企业服务配置信息 |
| 118 | Route::prefix('service')->group(function () { | 118 | Route::prefix('service')->group(function () { |
| 119 | Route::any('/', [Aside\ServiceController::class, 'lists'])->name('admin.service_lists'); | 119 | Route::any('/', [Aside\ServiceController::class, 'lists'])->name('admin.service_lists'); |
| 120 | - Route::any('/read', [Aside\ServiceController::class, 'read'])->name('admin.service_read'); | ||
| 121 | Route::any('/save', [Aside\ServiceController::class, 'save'])->name('admin.service_save'); | 120 | Route::any('/save', [Aside\ServiceController::class, 'save'])->name('admin.service_save'); |
| 122 | - Route::any('/status', [Aside\ServiceController::class, 'status'])->name('admin.service_status'); | ||
| 123 | - Route::any('/del', [Aside\ServiceController::class, 'del'])->name('admin.service_del'); | ||
| 124 | }); | 121 | }); |
| 125 | 122 | ||
| 126 | //项目管理 | 123 | //项目管理 |
-
请 注册 或 登录 后发表评论