# HoneyBox API 商品系统接口测试文件
# 用于验证所有商品系统相关的控制器接口
# Checkpoint 15: 控制器测试验证

@baseUrl = http://localhost:5238/api
@contentType = application/json

# 测试用Token（需要通过登录接口获取真实Token后替换）
# 下面是一个有效的测试Token（用户ID: 21583），有效期至2026年
@authToken = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoi5b6u5L-h55So5oi3MTMxMCIsImV4cCI6MTc2NzQzMTM1OCwidWlkIjoiMzMyMjY2IiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvbmFtZWlkZW50aWZpZXIiOiIyMTU4MyIsImF1ZCI6IkhvbmV5Qm94VXNlcnMiLCJpc3MiOiJIb25leUJveCJ9.700XWIUmzEumNk5tNYRshh7M42A8MG1X4yTHuz9PZbc

# 测试用商品ID（需要替换为数据库中存在的商品ID）
@testGoodsId = 1
@testGoodsNum = 1
@testGoodsListId = 1
@testShangId = 1

### ============================================
### 1. 健康检查接口
### ============================================

### 1.1 健康检查 - 验证服务是否正常运行
# GET /api/health
GET {{baseUrl}}/health
Accept: {{contentType}}

### ============================================
### 2. 商品列表接口 (GoodsController)
### Requirements: 1.1-1.6
### ============================================

### 2.1 获取商品列表 - 全部类型
# POST /api/goods_list
# Requirements: 1.1, 1.2
POST {{baseUrl}}/goods_list
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "type": -1,
    "page": 1,
    "pageSize": 15
}

### 2.2 获取商品列表 - 按类型过滤（一番赏 type=1）
# POST /api/goods_list
# Requirements: 1.1
POST {{baseUrl}}/goods_list
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "type": 1,
    "page": 1,
    "pageSize": 15
}

### 2.3 获取商品列表 - 按类型过滤（无限赏 type=2）
# POST /api/goods_list
# Requirements: 1.1
POST {{baseUrl}}/goods_list
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "type": 2,
    "page": 1,
    "pageSize": 15
}

### 2.4 获取商品列表 - 第二页
# POST /api/goods_list
# Requirements: 1.1
POST {{baseUrl}}/goods_list
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "type": -1,
    "page": 2,
    "pageSize": 15
}

### ============================================
### 3. 商品详情接口 (GoodsController)
### Requirements: 2.1-2.7
### ============================================

### 3.1 获取商品详情 - 自动选择箱号
# POST /api/goods_detail
# Requirements: 2.1, 2.2
POST {{baseUrl}}/goods_detail
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_id": {{testGoodsId}},
    "goods_num": 0
}

### 3.2 获取商品详情 - 指定箱号
# POST /api/goods_detail
# Requirements: 2.1, 2.3-2.7
POST {{baseUrl}}/goods_detail
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_id": {{testGoodsId}},
    "goods_num": {{testGoodsNum}}
}

### ============================================
### 4. 商品子奖品接口 (GoodsController)
### Requirements: 3.1-3.3
### ============================================

### 4.1 获取商品子奖品列表
# POST /api/goods_children
# Requirements: 3.1-3.3
POST {{baseUrl}}/goods_children
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_id": {{testGoodsId}},
    "goods_num": {{testGoodsNum}},
    "goods_list_id": {{testGoodsListId}}
}

### ============================================
### 5. 商品扩展配置接口 (GoodsController)
### Requirements: 4.1-4.3
### ============================================

### 5.1 获取商品扩展配置 - 一番赏类型
# POST /api/goods_extend
# Requirements: 4.1-4.3
POST {{baseUrl}}/goods_extend
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_id": {{testGoodsId}},
    "goods_type": 1
}


### 5.2 获取商品扩展配置 - 无限赏类型
# POST /api/goods_extend
# Requirements: 4.1-4.3
POST {{baseUrl}}/goods_extend
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_id": {{testGoodsId}},
    "goods_type": 2
}

### ============================================
### 6. 箱号管理接口 (GoodsController)
### Requirements: 5.1-5.4
### ============================================

### 6.1 获取箱号列表
# POST /api/goods_num_list
# Requirements: 5.1
POST {{baseUrl}}/goods_num_list
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_id": {{testGoodsId}}
}

### 6.2 获取箱号详情 - 箱号升序
# POST /api/goods_num_detail
# Requirements: 5.2-5.4
POST {{baseUrl}}/goods_num_detail
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_id": {{testGoodsId}},
    "page_no": 0,
    "sort": 0
}

### 6.3 获取箱号详情 - 箱号降序
# POST /api/goods_num_detail
# Requirements: 5.2-5.4
POST {{baseUrl}}/goods_num_detail
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_id": {{testGoodsId}},
    "page_no": 0,
    "sort": 1
}

### 6.4 获取箱号详情 - 余量降序
# POST /api/goods_num_detail
# Requirements: 5.2-5.4
POST {{baseUrl}}/goods_num_detail
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_id": {{testGoodsId}},
    "page_no": 0,
    "sort": 2
}

### ============================================
### 7. 奖品统计接口 (GoodsController)
### Requirements: 7.1-7.2
### ============================================

### 7.1 获取奖品数量统计
# POST /api/goods_prize_count
# Requirements: 7.1
POST {{baseUrl}}/goods_prize_count
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_id": {{testGoodsId}}
}

### 7.2 获取奖品内容 - 指定箱号
# POST /api/goods_prize_content
# Requirements: 7.2
POST {{baseUrl}}/goods_prize_content
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_id": {{testGoodsId}},
    "num": {{testGoodsNum}}
}

### 7.3 获取奖品内容 - 默认箱号
# POST /api/goods_prize_content
# Requirements: 7.2
POST {{baseUrl}}/goods_prize_content
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_id": {{testGoodsId}},
    "num": 0
}

### ============================================
### 8. 中奖记录接口 (GoodsController)
### Requirements: 8.1-8.4
### ============================================

### 8.1 获取中奖记录 - 全部分类
# POST /api/goods_prize_logs
# Requirements: 8.1, 8.3
POST {{baseUrl}}/goods_prize_logs
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_id": {{testGoodsId}},
    "goods_num": {{testGoodsNum}},
    "shang_id": 0,
    "page": 1,
    "pageSize": 15
}

### 8.2 获取中奖记录 - 按分类过滤
# POST /api/goods_prize_logs
# Requirements: 8.1, 8.2
POST {{baseUrl}}/goods_prize_logs
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_id": {{testGoodsId}},
    "goods_num": {{testGoodsNum}},
    "shang_id": {{testShangId}},
    "page": 1,
    "pageSize": 15
}

### ============================================
### 9. 收藏接口 (CollectionController)
### Requirements: 6.1-6.4
### ============================================

### 9.1 收藏/取消收藏商品
# POST /api/addCollect
# Requirements: 6.1-6.3
POST {{baseUrl}}/addCollect
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_id": {{testGoodsId}},
    "goods_num": {{testGoodsNum}}
}

### 9.2 获取收藏列表 - 全部类型
# POST /api/listCollect
# Requirements: 6.4
POST {{baseUrl}}/listCollect
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "type": -1,
    "page": 1,
    "pageSize": 100
}

### 9.3 获取收藏列表 - 按类型过滤（一番赏）
# POST /api/listCollect
# Requirements: 6.4
POST {{baseUrl}}/listCollect
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "type": 1,
    "page": 1,
    "pageSize": 100
}

### 9.4 删除收藏
# POST /api/delCollect
# 注意：需要替换为有效的收藏ID
POST {{baseUrl}}/delCollect
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "id": 1
}

### ============================================
### 10. 错误场景测试
### ============================================

### 10.1 未授权访问 - 获取商品列表（无Token）
POST {{baseUrl}}/goods_list
Content-Type: {{contentType}}

{
    "type": -1,
    "page": 1,
    "pageSize": 15
}

### 10.2 未授权访问 - 获取商品详情（无Token）
POST {{baseUrl}}/goods_detail
Content-Type: {{contentType}}

{
    "goods_id": {{testGoodsId}},
    "goods_num": 0
}

### 10.3 未授权访问 - 收藏商品（无Token）
POST {{baseUrl}}/addCollect
Content-Type: {{contentType}}

{
    "goods_id": {{testGoodsId}},
    "goods_num": {{testGoodsNum}}
}

### 10.4 未授权访问 - 获取收藏列表（无Token）
POST {{baseUrl}}/listCollect
Content-Type: {{contentType}}

{
    "type": -1,
    "page": 1,
    "pageSize": 100
}

### 10.5 参数缺失 - 商品详情（无商品ID）
POST {{baseUrl}}/goods_detail
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{}

### 10.6 参数缺失 - 商品详情（商品ID为0）
POST {{baseUrl}}/goods_detail
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_id": 0,
    "goods_num": 0
}

### 10.7 参数缺失 - 子奖品（无商品ID）
POST {{baseUrl}}/goods_children
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_num": {{testGoodsNum}},
    "goods_list_id": {{testGoodsListId}}
}

### 10.8 参数缺失 - 子奖品（无奖品列表ID）
POST {{baseUrl}}/goods_children
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_id": {{testGoodsId}},
    "goods_num": {{testGoodsNum}}
}

### 10.9 参数缺失 - 扩展配置（无商品ID）
POST {{baseUrl}}/goods_extend
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_type": 1
}

### 10.10 参数缺失 - 箱号列表（无商品ID）
POST {{baseUrl}}/goods_num_list
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{}

### 10.11 参数缺失 - 奖品统计（无商品ID）
POST {{baseUrl}}/goods_prize_count
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{}

### 10.12 参数缺失 - 收藏商品（无商品ID）
POST {{baseUrl}}/addCollect
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{
    "goods_num": {{testGoodsNum}}
}

### 10.13 参数缺失 - 删除收藏（无收藏ID）
POST {{baseUrl}}/delCollect
Content-Type: {{contentType}}
Authorization: Bearer {{authToken}}

{}

