From 2041d87ddcdf6f43462b1df3b29c0590883ae6f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?old=E6=98=93?= <156663459@qq.com> Date: Thu, 10 Jul 2025 15:25:19 +0800 Subject: [PATCH] =?UTF-8?q?feat(mock):=20=E6=B7=BB=E5=8A=A0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=9C=B0=E5=9D=80=E7=AE=A1=E7=90=86=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3mock=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加用户地址管理的全套接口mock数据,包括地址列表获取、新增、删除、修改、设置默认地址和获取详情功能 --- mock-config.json | 203 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+) diff --git a/mock-config.json b/mock-config.json index ac2b805..1406b5d 100644 --- a/mock-config.json +++ b/mock-config.json @@ -76,7 +76,210 @@ } ] } +}, +{ + "method": "GET", + "path": "/api/user/address/list", + "response": { + "list|2": [ + { + "id|+1": 1, + "name": "刘先生", + "phone": "134****7788", + "fullAddress": "山东省济南市某某区幸福小区5号10楼1003室", + "isDefault|1": [true, false], + "locationStatus|1": ["正常", "选中地址为高亮跳回"], + "canEdit": true, + "canDelete": true + } + ] + }, + "swagger": { + "summary": "获取用户收货地址列表", + "description": "用于地址管理页展示用户所有地址", + "responses": { + "200": { + "description": "返回地址列表", + "content": { + "application/json": { + "example": { + "code": 200, + "message": "success", + "result": { + "list": [ + { + "id": 1, + "name": "刘先生", + "phone": "134****7788", + "fullAddress": "山东省济南市某某区幸福小区5号10楼1003室", + "isDefault": true, + "locationStatus": "正常", + "canEdit": true, + "canDelete": true + }, + { + "id": 2, + "name": "刘先生", + "phone": "134****7788", + "fullAddress": "山东省济南市某某区幸福小区5号10楼1003室", + "isDefault": false, + "locationStatus": "选中地址为高亮跳回", + "canEdit": true, + "canDelete": true + } + ] + } + } + } + } + } + } + } +}, +{ + "method": "POST", + "path": "/api/user/address/add", + "response": { + "id": "@increment", + "message": "地址新增成功" + }, + "swagger": { + "summary": "新增收货地址", + "description": "用于添加用户的新收货地址信息", + "responses": { + "200": { + "description": "成功响应", + "content": { + "application/json": { + "example": { + "code": 200, + "message": "地址新增成功", + "result": { + "id": 3 + } + } + } + } + } + } + } +},{ + "method": "POST", + "path": "/api/user/address/delete", + "response": { + "message": "地址已删除" + }, + "swagger": { + "summary": "删除收货地址", + "description": "根据地址ID删除用户地址", + "responses": { + "200": { + "description": "成功", + "content": { + "application/json": { + "example": { + "code": 200, + "message": "地址已删除", + "result": null + } + } + } + } + } + } +}, +{ + "method": "POST", + "path": "/api/user/address/update", + "response": { + "message": "地址已更新" + }, + "swagger": { + "summary": "修改收货地址", + "description": "根据地址ID更新地址信息", + "responses": { + "200": { + "description": "成功", + "content": { + "application/json": { + "example": { + "code": 200, + "message": "地址已更新", + "result": null + } + } + } + } + } + } +} +,{ + "method": "POST", + "path": "/api/user/address/set-default", + "response": { + "message": "已设置为默认地址" + }, + "swagger": { + "summary": "设置默认地址", + "description": "将指定地址设为默认", + "responses": { + "200": { + "description": "成功", + "content": { + "application/json": { + "example": { + "code": 200, + "message": "已设置为默认地址", + "result": null + } + } + } + } + } + } +}, +{ + "method": "GET", + "path": "/api/user/address/detail", + "response": { + "id": 2, + "name": "刘先生", + "phone": "134****7788", + "fullAddress": "山东省济南市某某区幸福小区5号10楼1003室", + "isDefault": false + }, + "swagger": { + "summary": "获取单个收货地址详情", + "description": "根据地址 ID 获取详细信息,用于编辑表单回显", + "responses": { + "200": { + "description": "成功返回地址信息", + "content": { + "application/json": { + "example": { + "code": 200, + "message": "success", + "result": { + "id": 2, + "name": "刘先生", + "phone": "134****7788", + "fullAddress": "山东省济南市某某区幸福小区5号10楼1003室", + "isDefault": false + }, + "extras": null, + "time": "2025-07-10 16:30:00" + } + } + } + } + } + } } + + + + + ]