|
@@ -22,28 +22,13 @@ class ServerInformationController extends BaseController |
|
@@ -22,28 +22,13 @@ class ServerInformationController extends BaseController |
|
22
|
*/
|
22
|
*/
|
|
23
|
public function lists($deleted = ServerInformation::DELETED_NORMAL)
|
23
|
public function lists($deleted = ServerInformation::DELETED_NORMAL)
|
|
24
|
{
|
24
|
{
|
|
25
|
- $request = $this->param;
|
|
|
|
26
|
- $search = [];
|
|
|
|
27
|
- $search_array = [
|
|
|
|
28
|
- 'ip' => 'ip',
|
|
|
|
29
|
- 'title' => 'title'
|
|
|
|
30
|
- ];
|
|
|
|
31
|
- foreach ($search_array as $key => $item) {
|
|
|
|
32
|
- if (isset($request[$key]) && $request[$key]) {
|
|
|
|
33
|
- $search[$item] = $request[$key];
|
|
|
|
34
|
- }
|
|
|
|
35
|
- }
|
|
|
|
36
|
- $size = request()->input('size', $this->row);
|
|
|
|
37
|
- $query = ServerInformation::query()->select(['id', 'title', 'ip']);
|
|
|
|
38
|
- if ($search) {
|
|
|
|
39
|
- foreach ($search as $key => $item) {
|
|
|
|
40
|
- $query = $query->Where("{$key}", 'like', "%{$item}%");
|
|
|
|
41
|
- }
|
25
|
+ if(isset($this->map['title']) && !empty($this->map['title'])){
|
|
|
|
26
|
+ $this->map['title'] = ['like','%'.$this->map['title'],','];
|
|
42
|
}
|
27
|
}
|
|
43
|
- $data = $query->where('deleted', $deleted)
|
|
|
|
44
|
- ->orderBy('id', 'desc')
|
|
|
|
45
|
- ->paginate($size);
|
|
|
|
46
|
- return $this->response('success', Code::SUCCESS, $data);
|
28
|
+ $serverInformationModel = new ServerInformation();
|
|
|
|
29
|
+ $this->map['deleted'] = ServerInformation::DELETED_NORMAL;
|
|
|
|
30
|
+ $lists = $serverInformationModel->lists($this->map,$this->page,$this->row,$this->order);
|
|
|
|
31
|
+ $this->response('success', Code::SUCCESS, $lists);
|
|
47
|
|
32
|
|
|
48
|
}
|
33
|
}
|
|
49
|
|
34
|
|