# 连续未充值VIP礼包（gift_id=305）接口调用示例

## 1. 礼包入口接口 - 检查条件和返回档位

### 接口地址
```
POST /pay/vip_inactive_gift
```

### 请求示例
```bash
curl -X POST "https://your-domain.com/pay/vip_inactive_gift" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json"
```

### 响应示例

#### 情况1：不满足条件（不是VIP用户）
```json
{
  "code": 200,
  "msg": "success",
  "data": {
    "status": 0,
    "message": "您还不是VIP用户"
  }
}
```

#### 情况2：不满足条件（连续未充值天数不足）
```json
{
  "code": 200,
  "msg": "success",
  "data": {
    "status": 0,
    "message": "连续未充值天数不足3天",
    "inactive_days": 2
  }
}
```

#### 情况3：满足条件，未充值（含充值档位信息，参考 bankruptcyGift）
```json
{
  "code": 200,
  "msg": "success",
  "data": {
    "status": 1,
    "amount": 19.99,
    "inactive_days": 5,
    "total_recharge": 120.50,
    "avg_recharge": 15.06,
    "time_left": 82800,
    "expire_at": 1704067200,
    "message": "可以充值礼包",
    "total_reward_percent": 260.0,
    "list": [
      {
        "money": 19.99,
        "favorable_price": 23.99,
        "give": 4.0,
        "gear": "...",
        "gift_id": 305,
        "total_bonus": 260.0,
        "bonus": 160.0,
        "total_reward_percent": 260.0,
        "recommend": 1
      }
    ]
  }
}
```

#### 情况4：已充值，奖励未全部领取
```json
{
  "code": 200,
  "msg": "success",
  "data": {
    "status": 2,
    "amount": 19.99,
    "inactive_days": 5,
    "total_recharge": 120.50,
    "avg_recharge": 15.06,
    "time_left": 0,
    "expire_at": null,
    "message": "已充值，奖励未全部领取"
  }
}
```

#### 情况5：已充值，奖励全部领取
```json
{
  "code": 200,
  "msg": "success",
  "data": {
    "status": 3,
    "amount": 19.99,
    "inactive_days": 5,
    "total_recharge": 120.50,
    "avg_recharge": 15.06,
    "time_left": 0,
    "expire_at": null,
    "message": "已充值，奖励全部领取"
  }
}
```

### 字段说明
- `status`: 状态（0=不满足条件, 1=满足条件未充值, 2=已充值未全部领取, 3=已充值全部领取）
- `amount`: 应显示的礼包金额（9.99/19.99/29.99/39.99）
- `inactive_days`: 连续未充值天数
- `total_recharge`: 总充值金额
- `avg_recharge`: 平均单笔充值金额
- `time_left`: 未充值时的倒计时（秒，0表示无倒计时）
- `expire_at`: 倒计时过期时间戳
- `total_reward_percent`: 总奖励百分比（仅 status=1 时），120% 立即 + 7日礼包%（140%~200%）
- `list`: 充值档位列表（仅 status=1 时），结构参考 bankruptcyGift，gift_id 固定 305；每项含 money、favorable_price、give、gear、gift_id、total_bonus、bonus、total_reward_percent、recommend

---

## 2. 7日礼包信息接口 - 获取每日奖励详情

### 接口地址
```
POST /pay/vip_inactive_gift_info
```

### 请求示例
```bash
curl -X POST "https://your-domain.com/pay/vip_inactive_gift_info" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json"
```

### 响应示例

#### 成功响应
```json
{
  "code": 200,
  "msg": "success",
  "data": {
    "record": {
      "pay_amount": 19.99,
      "total_percent": 260.0,
      "seven_days_percent": 140.0,
      "per_day_amount": 3.99,
      "inactive_days": 5,
      "created_at": "2024-01-01 10:30:00",
      "expired_at": "2024-01-08 10:30:00"
    },
    "days": [
      {
        "day": 1,
        "amount": 3.99,
        "status": 2,
        "status_text": "已领取",
        "target_date": "2024-01-02",
        "bet_progress": null
      },
      {
        "day": 2,
        "amount": 3.99,
        "status": 2,
        "status_text": "已领取",
        "target_date": "2024-01-03",
        "bet_progress": null
      },
      {
        "day": 3,
        "amount": 3.99,
        "status": 2,
        "status_text": "已领取",
        "target_date": "2024-01-04",
        "bet_progress": null
      },
      {
        "day": 4,
        "amount": 3.99,
        "status": 1,
        "status_text": "可领取",
        "target_date": "2024-01-05",
        "bet_progress": {
          "current": 125.50,
          "required": 100,
          "progress_percent": 100.0,
          "is_completed": true
        }
      },
      {
        "day": 5,
        "amount": 3.99,
        "status": 0,
        "status_text": "不可领取",
        "target_date": "2024-01-06",
        "bet_progress": {
          "current": 65.30,
          "required": 100,
          "progress_percent": 65.3,
          "is_completed": false
        }
      },
      {
        "day": 6,
        "amount": 3.99,
        "status": 0,
        "status_text": "不可领取",
        "target_date": "2024-01-07",
        "bet_progress": {
          "current": 0,
          "required": 100,
          "progress_percent": 0,
          "is_completed": false
        }
      },
      {
        "day": 7,
        "amount": 3.99,
        "status": 0,
        "status_text": "不可领取",
        "target_date": "2024-01-08",
        "bet_progress": {
          "current": 0,
          "required": 100,
          "progress_percent": 0,
          "is_completed": false
        }
      }
    ],
    "current_day": 5,
    "is_expired": false,
    "time_left": 0,
    "expire_at": 1704675000
  }
}
```

#### 失败响应（未找到记录）
```json
{
  "code": 400,
  "msg": "error",
  "data": {
    "message": "未找到7日礼包记录"
  }
}
```

### 字段说明

#### record 对象
- `pay_amount`: 充值金额
- `total_percent`: 总奖励百分比（120% + 7日礼包百分比）
- `seven_days_percent`: 7日礼包总奖励百分比
- `per_day_amount`: 每日奖励金额
- `inactive_days`: 触发前连续未充值天数
- `created_at`: 创建时间
- `expired_at`: 过期时间

#### days 数组
- `day`: 第几天（1-7）
- `amount`: 该天的奖励金额
- `status`: 状态（0=不可领取, 1=可领取, 2=已领取, 3=过期）
- `status_text`: 状态文本
- `target_date`: 目标日期（该天对应的日期）
- `bet_progress`: 流水进度（仅第4-7天，第1-3天为null）
  - `current`: 当前流水金额
  - `required`: 需要流水金额（100）
  - `progress_percent`: 进度百分比（0-100）
  - `is_completed`: 是否完成

---

## 3. 领取某日奖励接口

### 接口地址
```
POST /pay/claim_vip_inactive_gift_day
```

### 请求参数
```json
{
  "day": 4
}
```

### 请求示例
```bash
curl -X POST "https://your-domain.com/pay/claim_vip_inactive_gift_day" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{"day": 4}'
```

### 响应示例

#### 成功响应
```json
{
  "code": 200,
  "msg": "success",
  "data": {
    "amount": 3.99,
    "day": 4,
    "message": "成功领取3.99奖励"
  }
}
```

#### 失败响应 - 无效的天数
```json
{
  "code": 400,
  "msg": "error",
  "data": {
    "message": "无效的奖励类型"
  }
}
```

#### 失败响应 - 未找到记录
```json
{
  "code": 400,
  "msg": "error",
  "data": {
    "message": "未找到7日礼包记录"
  }
}
```

#### 失败响应 - 已过期
```json
{
  "code": 400,
  "msg": "error",
  "data": {
    "message": "7日礼包已过期"
  }
}
```

#### 失败响应 - 已领取
```json
{
  "code": 400,
  "msg": "error",
  "data": {
    "message": "第4天的奖励已领取"
  }
}
```

#### 失败响应 - 还未到时间
```json
{
  "code": 400,
  "msg": "error",
  "data": {
    "message": "还未到第5天的领取时间"
  }
}
```

#### 失败响应 - 流水不足（第4-7天）
```json
{
  "code": 400,
  "msg": "error",
  "data": {
    "message": "当天游戏流水不足，需要流水100"
  }
}
```

---

## 注意事项

1. **认证**：所有接口都需要用户登录（middleware: `checkGameLogin`, `mustGameLogin`）
2. **多语言**：响应消息会根据用户的语言设置自动切换
3. **时间计算**：第1天的奖励在充值后的次日才能领取；某一天未领取则过期后无法补领
4. **流水要求**：第4-7天需要当天游戏流水 >= 100 才能领取
5. **倒计时**：满足条件但未充值时，有24小时倒计时，每天重置
6. **奖励计算**：7日礼包奖励比例 = 140% + (未充值天数-3) × 10%，最高200%
