|
|
@@ -4,7 +4,7 @@
|
|
|
|
|
|
商家订单系统 API,提供订单创建、订单查询等功能。支持微信支付、支付宝支付和银联支付三种支付方式。
|
|
|
|
|
|
-**基础路径**: `/api/shopOrder`
|
|
|
+**基础路径**: `/api/shop_order`
|
|
|
**认证方式**: Bearer Token
|
|
|
**数据格式**: JSON
|
|
|
|
|
|
@@ -15,6 +15,7 @@
|
|
|
- [获取订单详情](#获取订单详情)
|
|
|
- [创建订单支付](#创建订单支付)
|
|
|
- [获取商户银联待入账金额列表](#获取商户银联待入账金额列表)
|
|
|
+- [获取商户银联待入账金额列表 (带日期和分页)](#获取商户银联待入账金额列表带日期和分页)
|
|
|
|
|
|
---
|
|
|
|
|
|
@@ -33,7 +34,7 @@
|
|
|
|
|
|
2. **Query 参数方式**:
|
|
|
```
|
|
|
- GET /api/shopOrder/info?order_sn=xxx&token=your-token
|
|
|
+ GET /api/shop_order/info?order_sn=xxx&token=your-token
|
|
|
```
|
|
|
|
|
|
---
|
|
|
@@ -41,7 +42,7 @@
|
|
|
### 1. 获取订单详情
|
|
|
|
|
|
#### 基本信息
|
|
|
-- **接口路径**: `/api/shopOrder/info`
|
|
|
+- **接口路径**: `/api/shop_order/info`
|
|
|
- **请求方式**: GET
|
|
|
- **接口描述**: 根据订单编号查询订单详细信息(包含店铺名称)
|
|
|
- **认证要求**: 需要 Token 认证
|
|
|
@@ -58,7 +59,7 @@
|
|
|
#### 请求示例
|
|
|
|
|
|
```http
|
|
|
-GET /api/shopOrder/info?order_sn=382FS1234567890 HTTP/1.1
|
|
|
+GET /api/shop_order/info?order_sn=382FS1234567890 HTTP/1.1
|
|
|
Host: localhost:8080
|
|
|
Content-Type: application/json
|
|
|
Authorization: Bearer your-token-here
|
|
|
@@ -122,14 +123,14 @@ Authorization: Bearer your-token-here
|
|
|
|
|
|
```bash
|
|
|
# 正常查询
|
|
|
-curl -X GET "http://localhost:8080/api/shopOrder/info?order_sn=382FS1234567890" \
|
|
|
+curl -X GET "http://localhost:8080/api/shop_order/info?order_sn=382FS1234567890" \
|
|
|
-H "Authorization: Bearer your-token"
|
|
|
|
|
|
# 缺少参数测试
|
|
|
-curl -X GET "http://localhost:8080/api/shopOrder/info"
|
|
|
+curl -X GET "http://localhost:8080/api/shop_order/info"
|
|
|
|
|
|
# 订单不存在测试
|
|
|
-curl -X GET "http://localhost:8080/api/shopOrder/info?order_sn=INVALID_SN"
|
|
|
+curl -X GET "http://localhost:8080/api/shop_order/info?order_sn=INVALID_SN"
|
|
|
```
|
|
|
|
|
|
#### 注意事项
|
|
|
@@ -144,7 +145,7 @@ curl -X GET "http://localhost:8080/api/shopOrder/info?order_sn=INVALID_SN"
|
|
|
### 2. 创建订单支付
|
|
|
|
|
|
#### 基本信息
|
|
|
-- **接口路径**: `/api/shopOrder/create`
|
|
|
+- **接口路径**: `/api/shop_order/create`
|
|
|
- **请求方式**: GET/POST
|
|
|
- **接口描述**: 创建订单并获取支付信息(支持微信、支付宝、银联)
|
|
|
- **认证要求**: ⚠️ 必须登录(微信支付时需要验证用户身份)
|
|
|
@@ -170,7 +171,7 @@ curl -X GET "http://localhost:8080/api/shopOrder/info?order_sn=INVALID_SN"
|
|
|
#### 请求示例
|
|
|
|
|
|
```http
|
|
|
-POST /api/shopOrder/create HTTP/1.1
|
|
|
+POST /api/shop_order/create HTTP/1.1
|
|
|
Host: localhost:8080
|
|
|
Content-Type: application/json
|
|
|
Authorization: Bearer your-token-here
|
|
|
@@ -276,7 +277,7 @@ Authorization: Bearer your-token-here
|
|
|
|
|
|
```bash
|
|
|
# 创建微信订单
|
|
|
-curl -X POST "http://localhost:8080/api/shopOrder/create" \
|
|
|
+curl -X POST "http://localhost:8080/api/shop_order/create" \
|
|
|
-H "Content-Type: application/json" \
|
|
|
-H "Authorization: Bearer your-token" \
|
|
|
-d '{
|
|
|
@@ -286,7 +287,7 @@ curl -X POST "http://localhost:8080/api/shopOrder/create" \
|
|
|
}'
|
|
|
|
|
|
# 创建支付宝订单
|
|
|
-curl -X POST "http://localhost:8080/api/shopOrder/create" \
|
|
|
+curl -X POST "http://localhost:8080/api/shop_order/create" \
|
|
|
-H "Content-Type: application/json" \
|
|
|
-H "Authorization: Bearer your-token" \
|
|
|
-d '{
|
|
|
@@ -309,7 +310,7 @@ curl -X POST "http://localhost:8080/api/shopOrder/create" \
|
|
|
### 3. 获取商户银联待入账金额列表
|
|
|
|
|
|
#### 基本信息
|
|
|
-- **接口路径**: `/api/shopOrder/shopBankOrder`
|
|
|
+- **接口路径**: `/api/shop_order/bank_total`
|
|
|
- **请求方式**: GET
|
|
|
- **接口描述**: 获取商户银联待入账订单列表(最新 10 条)及待入账总金额(已扣除清分金额)
|
|
|
- **认证要求**: 需要 Token 认证
|
|
|
@@ -324,7 +325,7 @@ curl -X POST "http://localhost:8080/api/shopOrder/create" \
|
|
|
#### 请求示例
|
|
|
|
|
|
```http
|
|
|
-GET /api/shopOrder/shopBankOrder HTTP/1.1
|
|
|
+GET /api/shop_order/bank_total HTTP/1.1
|
|
|
Host: localhost:8080
|
|
|
Content-Type: application/json
|
|
|
Authorization: Bearer your-token-here
|
|
|
@@ -398,7 +399,7 @@ Authorization: Bearer your-token-here
|
|
|
|
|
|
```bash
|
|
|
# 查询最新 10 条银联待入账订单
|
|
|
-curl -X GET "http://localhost:8080/api/shopOrder/shopBankOrder" \
|
|
|
+curl -X GET "http://localhost:8080/api/shop_order/bank_total" \
|
|
|
-H "Authorization: Bearer your-token"
|
|
|
```
|
|
|
|
|
|
@@ -414,6 +415,132 @@ curl -X GET "http://localhost:8080/api/shopOrder/shopBankOrder" \
|
|
|
|
|
|
---
|
|
|
|
|
|
+### 4. 获取商户银联待入账金额列表 (带日期和分页)
|
|
|
+
|
|
|
+#### 基本信息
|
|
|
+- **接口路径**: `/api/shop_order/bank_list`
|
|
|
+- **请求方式**: GET
|
|
|
+- **接口描述**: 获取指定月份的商户银联待入账订单列表(支持分页)及统计信息
|
|
|
+- **认证要求**: 需要 Token 认证
|
|
|
+- **请求头要求**:
|
|
|
+ - `Content-Type`: application/json
|
|
|
+ - `Authorization`: Bearer {token}
|
|
|
+
|
|
|
+#### 请求参数
|
|
|
+
|
|
|
+| 参数名 | 类型 | 位置 | 必填 | 说明 | 验证规则 |
|
|
|
+|--------|------|------|------|------|----------|
|
|
|
+| date | string | query | 否 | 查询月份,格式:Y-m,默认本月 | datetime=2006-01 |
|
|
|
+| page | int | query | 否 | 页码,默认 1 | gt=0 |
|
|
|
+| page_size | int | query | 否 | 每页数量,默认 10,最大 100 | gt=0, lte=100 |
|
|
|
+
|
|
|
+#### 请求示例
|
|
|
+
|
|
|
+```http
|
|
|
+GET /api/shop_order/bank_list?date=2026-03&page=1&page_size=10 HTTP/1.1
|
|
|
+Host: localhost:8080
|
|
|
+Content-Type: application/json
|
|
|
+Authorization: Bearer your-token-here
|
|
|
+```
|
|
|
+
|
|
|
+#### 响应格式
|
|
|
+
|
|
|
+**成功响应 (200)**
|
|
|
+```json
|
|
|
+{
|
|
|
+ "code": 200,
|
|
|
+ "message": "success",
|
|
|
+ "data": {
|
|
|
+ "total": 50,
|
|
|
+ "items": [
|
|
|
+ {
|
|
|
+ "rs_sn": "382FS1234567890",
|
|
|
+ "pay_money": "98.00",
|
|
|
+ "is_clearing": 0,
|
|
|
+ "status": 6,
|
|
|
+ "created_at": "2026-03-14T10:00:00Z"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "rs_sn": "382FS1234567891",
|
|
|
+ "pay_money": "196.00",
|
|
|
+ "is_clearing": 0,
|
|
|
+ "status": 4,
|
|
|
+ "created_at": "2026-03-13T09:00:00Z"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "limit": 10,
|
|
|
+ "end_date": "2026-04"
|
|
|
+ }
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+**失败响应 - 未授权 (401)**
|
|
|
+```json
|
|
|
+{
|
|
|
+ "code": 401,
|
|
|
+ "message": "缺少登陆信息",
|
|
|
+ "data": []
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+**失败响应 - 参数错误 (400)**
|
|
|
+```json
|
|
|
+{
|
|
|
+ "code": 400,
|
|
|
+ "message": "日期格式不正确",
|
|
|
+ "data": []
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+#### 返回字段说明
|
|
|
+
|
|
|
+| 字段名 | 类型 | 说明 |
|
|
|
+|--------|------|------|
|
|
|
+| total | int | 订单总数 |
|
|
|
+| items | array | 订单列表(已扣除清分金额) |
|
|
|
+| limit | int | 每页数量 |
|
|
|
+| end_date | string | 查询月份的下一月(用于前端显示范围) |
|
|
|
+
|
|
|
+**items 数组元素结构:**
|
|
|
+
|
|
|
+| 字段名 | 类型 | 说明 |
|
|
|
+|--------|------|------|
|
|
|
+| rs_sn | string | 订单编号 |
|
|
|
+| pay_money | string | 支付金额(已扣除清分金额) |
|
|
|
+| is_clearing | int | 是否清分(0:待清分,1:已清分) |
|
|
|
+| status | int | 订单状态(4:已支付,6:待入账) |
|
|
|
+| created_at | string | 创建时间(RFC3339 格式) |
|
|
|
+
|
|
|
+#### cURL 测试示例
|
|
|
+
|
|
|
+```bash
|
|
|
+# 查询本月数据
|
|
|
+curl -X GET "http://localhost:8080/api/shop_order/bank_list" \
|
|
|
+ -H "Authorization: Bearer your-token"
|
|
|
+
|
|
|
+# 查询指定月份
|
|
|
+curl -X GET "http://localhost:8080/api/shop_order/bank_list?date=2026-03" \
|
|
|
+ -H "Authorization: Bearer your-token"
|
|
|
+
|
|
|
+# 自定义分页
|
|
|
+curl -X GET "http://localhost:8080/api/shop_order/bank_list?date=2026-03&page=2&page_size=20" \
|
|
|
+ -H "Authorization: Bearer your-token"
|
|
|
+```
|
|
|
+
|
|
|
+#### 注意事项
|
|
|
+
|
|
|
+1. 该接口需要登录认证,自动从 token 中获取会员 ID
|
|
|
+2. 根据会员 ID 自动查询其关联的店铺(未删除且状态为 1)
|
|
|
+3. 仅查询 is_bank=1(银联支付)且 status 为 4 或 6 的订单
|
|
|
+4. 日期参数格式为 `Y-m`(如:2026-03),默认为当前月份
|
|
|
+5. 查询范围为指定月份的 1 号至月底
|
|
|
+6. 返回的金额为扣除清分金额后的实际收益金额
|
|
|
+7. 清分比例由商户配置的 discount 字段决定(折扣百分比)
|
|
|
+8. 分页参数有默认值,page 默认 1,page_size 默认 10,最大 100
|
|
|
+9. end_date 返回的是查询月份的下一月,用于前端显示时间范围
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
### 通用说明
|
|
|
|
|
|
### 错误码说明
|
|
|
@@ -446,6 +573,16 @@ curl -X GET "http://localhost:8080/api/shopOrder/shopBankOrder" \
|
|
|
|
|
|
### 更新日志
|
|
|
|
|
|
+#### v1.2.0 (2026-03-14)
|
|
|
+- ✨ 新增:获取商户银联待入账金额列表接口 `/bank_list`(带日期和分页)
|
|
|
+- 📝 说明:原 `/bank_total` 接口保留,作为快速查询接口
|
|
|
+
|
|
|
+#### v1.1.0 (2026-03-14)
|
|
|
+- ✨ 新增:获取商户银联待入账金额列表接口 `/bank_total`
|
|
|
+- 🐛 修复:优化订单查询逻辑,移除分页参数
|
|
|
+- 🔧 改进:简化响应数据结构,提升查询性能
|
|
|
+- 📝 重构:方法名从 `GetBankOrderList` 改为 `GetShopBankOrder`
|
|
|
+
|
|
|
#### v1.0.0 (2026-03-13)
|
|
|
- ✨ 新增:获取订单详情接口 `/info`
|
|
|
- 🐛 修复:优化订单查询接口的参数验证
|