|
@@ -0,0 +1,66 @@
|
|
|
|
+<?php
|
|
|
|
+
|
|
|
|
+namespace App\Admin\Controllers;
|
|
|
|
+
|
|
|
|
+use App\Services\ViewService;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * @group 后台
|
|
|
|
+ *
|
|
|
|
+ * 视图列表
|
|
|
|
+ *
|
|
|
|
+ * @property ViewService $service
|
|
|
|
+ */
|
|
|
|
+class ViewController
|
|
|
|
+{
|
|
|
|
+ protected ViewService $service;
|
|
|
|
+
|
|
|
|
+ public function __construct(ViewService $service)
|
|
|
|
+ {
|
|
|
|
+ $this->service = $service;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * [视图列表页]-视图列表查询
|
|
|
|
+ *
|
|
|
|
+ * @description 获取用户列表,支持条件查询和分页
|
|
|
|
+ *
|
|
|
|
+ * @queryParam viewName string 视图名称 Example: manage_user_list
|
|
|
|
+ * @queryParam page int 页码 Example: 1
|
|
|
|
+ * @queryParam perPage int 每页数量 Example: 20
|
|
|
|
+ * @queryParam orderBy string 排序字段 Example: mobile
|
|
|
|
+ * @queryParam orderDir string 排序方向 Example: desc
|
|
|
|
+ * @queryParam nickname string 昵称 Example: 张三
|
|
|
|
+ * @queryParam mobile string 手机号 Example: 13800138000
|
|
|
|
+ * @queryParam state int 用户状态(1:正常,2:禁用) Example: 1
|
|
|
|
+ *
|
|
|
|
+ * @response {
|
|
|
|
+ * "code": 200,
|
|
|
|
+ * "message": "success",
|
|
|
|
+ * "data": {
|
|
|
|
+ * "current_page": 1,
|
|
|
|
+ * "data": [{
|
|
|
|
+ * "id": 1,
|
|
|
|
+ * "mobile": "13800138000",
|
|
|
|
+ * "nickname": "张三",
|
|
|
|
+ * "avatar": "avatar.jpg",
|
|
|
|
+ * "gender": 1,
|
|
|
|
+ * "area_code": "110000",
|
|
|
|
+ * "state": 1,
|
|
|
|
+ * "created_at": "2024-01-01 00:00:00",
|
|
|
|
+ * "updated_at": "2024-01-01 00:00:00"
|
|
|
|
+ * }],
|
|
|
|
+ * "total": 100
|
|
|
|
+ * }
|
|
|
|
+ * }
|
|
|
|
+ */
|
|
|
|
+ public function viewList()
|
|
|
|
+ {
|
|
|
|
+ $viewName = request()->input('viewName');
|
|
|
|
+ $whereParams = request()->except(['_action', 'page', 'perPage', 'viewName', 'orderBy', 'orderDir']);
|
|
|
|
+ $pageParams = request()->only(['page', 'perPage']);
|
|
|
|
+ $sortParams = request()->only(['orderBy', 'orderDir']);
|
|
|
|
+
|
|
|
|
+ return $this->service->viewList($viewName, $whereParams, $pageParams, $sortParams);
|
|
|
|
+ }
|
|
|
|
+}
|