ServiceController.php
3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
namespace App\Http\Controllers\Aside;
use App\Enums\Common\Code;
use App\Http\Logic\Aside\Service\ServiceLogic;
class ServiceController extends BaseController
{
/**
* @remark :列表
* @name :lists
* @author :lyh
* @method :post
* @time :2023/6/25 14:31
*/
public function lists(ServiceLogic $serviceLogic){
$lists = $serviceLogic->serviceLists($this->map,$this->page,$this->row,$this->order);
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :企业服务通知详情
* @name :read
* @author :lyh
* @method :post
* @time :2023/6/25 11:50
*/
public function read(ServiceLogic $serviceLogic){
$this->request->validate([
'id' => 'required',
],[
'id.required' => '主键不能为空',
]);
$info = $serviceLogic->serviceRead();
$this->response('success',Code::SUCCESS,$info);
}
/**
* @remark :新增或编辑
* @name :save
* @author :lyh
* @method :post
* @time :2023/6/25 11:51
*/
public function save(ServiceLogic $serviceLogic){
if(isset($this->param['id'])){
$this->request->validate([
'id' => 'required',
],[
'id.required' => '主键不能为空',
]);
}
//参数验证
$this->verifyParam();
$serviceLogic->serviceSave();
$this->response('success');
}
/**
* @remark :编辑指定状态
* @name :status
* @author :lyh
* @method :post
* @time :2023/6/25 14:15
*/
public function status(ServiceLogic $serviceLogic){
$this->request->validate([
'id' => 'required',
],[
'id.required' => '主键不能为空',
]);
$serviceLogic->serviceStatus();
$this->response('success');
}
/**
* @param ServiceLogic $serviceLogic
* @remark :删除信息
* @name :del
* @author :lyh
* @method :post
* @time :2023/6/25 14:26
*/
public function del(ServiceLogic $serviceLogic){
$this->request->validate([
'id' => 'required|array',
],[
'id.required' => '主键不能为空',
]);
$serviceLogic->serviceDel();
$this->response('success');
}
/**
* @remark :参数验证
* @name :validParam
* @author :lyh
* @method :post
* @time :2023/6/25 14:03
*/
public function verifyParam(){
$this->request->validate([
'address' => 'required',
'duty_phone' => 'required',
'landline_telephone' => 'required',
'free_hotline' => 'required',
'enterprise_qq' => 'required',
'android' => 'required',
'official_account' => 'required',
'ios' => 'required',
'status' => 'required',
],[
'address.required' => '地址不能为空',
'duty_phone.required' => '值班电话不能为空',
'landline_telephone.required' => '座机电话不能为空',
'free_hotline.required' => '免费热线不能为空',
'enterprise_qq.required' => '企业qq不能为空',
'android.required' => '安卓不能为空',
'official_account.required' => '公众号不能为空',
'ios.required' => 'ios下载地址不能为空',
'status.required' => '状态不能为空',
]);
}
}