diff --git a/app/Constants/Admin/MemberCode.php b/app/Constants/Admin/MemberCode.php new file mode 100644 index 0000000..98c5bb1 --- /dev/null +++ b/app/Constants/Admin/MemberCode.php @@ -0,0 +1,20 @@ +handle(); + } +} diff --git a/app/Request/Admin/MemberRequest.php b/app/Request/Admin/MemberRequest.php new file mode 100644 index 0000000..154127b --- /dev/null +++ b/app/Request/Admin/MemberRequest.php @@ -0,0 +1,36 @@ + 'required|integer', + 'query_id' =>'sometimes|integer|exists:user,id', + 'query_name' =>'sometimes|string', + 'query_mobile' =>'sometimes|digits:11', + 'query_city_id' => 'sometimes|integer|exists:system_city,id', + ]; + } + + protected array $scenes = [ + 'list' => ['limit','query_id','query_name','query_mobile','query_city_id'], + ]; +} diff --git a/app/Service/Admin/User/MemberService.php b/app/Service/Admin/User/MemberService.php new file mode 100644 index 0000000..efa904c --- /dev/null +++ b/app/Service/Admin/User/MemberService.php @@ -0,0 +1,53 @@ +request->input('limit', 10); + + $id = (int)$this->request->input('query_id'); + $name = $this->request->input('query_name'); + $mobile = $this->request->input('query_mobile'); + $cityId = $this->request->input('query_city_id'); + + $list = $this->userModel + ->where('is_del',MemberCode::IS_NO_DEL) + ->when(!empty($id), function ($query) use ($id) { + $query->where('id', $id); + }) + ->when(!empty($name), function ($query) use ($name) { + $query->where('nickname', 'like', "$name%"); + }) + ->when(!empty($mobile), function ($query) use ($mobile) { + $query->where('mobile', $mobile); + }) + ->when(!empty($cityId), function ($query) use ($cityId) { + $query->where('city_id', $cityId); + }) + ->paginate($limit,$this->filed) + ->toArray(); + + return $this->return->success('success',$list); + } +} \ No newline at end of file diff --git a/sync/http/admin/auth.http b/sync/http/admin/auth.http index 8c818f5..365c486 100644 --- a/sync/http/admin/auth.http +++ b/sync/http/admin/auth.http @@ -264,9 +264,14 @@ GET {{host}}/admin/good/list_category content-type: application/json Authorization: Bearer {{admin_token}} -### 部门添加 +### 商品种类添加 POST {{host}}/admin/good/add_category Content-Type: application/x-www-form-urlencoded Authorization: Bearer {{admin_token}} -name=主食&image_id=4 \ No newline at end of file +name=主食&image_id=4 + +### 用户列表 +GET {{host}}/admin/member/list?limit=10 +content-type: application/json +Authorization: Bearer {{admin_token}} \ No newline at end of file