# 任务拆解：修复一番赏次数卡支付与退款逻辑

## 1. Backend Tasks
### 1.1 Update Lottery Logic (Atomize)
- **File**: `internal/api/activity/lottery_app.go`
- **Goal**: Record specific Game Pass usage in Order Remark.
- **Steps**:
    - Locate `JoinLottery` function.
    - Inside `useGamePass` block, accumulate used pass IDs and counts.
    - Append formatted string `gp_use:ID:Count` to `order.Remark`.
- **Verification**: Run local test, buy with count card, check DB `orders` table remark.

### 1.2 Update Refund Logic (Atomize)
- **File**: `internal/api/admin/pay_refund_admin.go`
- **Goal**: Parse `gp_use` and restore counts.
- **Steps**:
    - Locate `CreateRefund` function.
    - Replace/Extend existing Game Pass restoration logic.
    - Implement regex to find all `gp_use:(\d+):(\d+)`.
    - Loop and execute SQL updates.
- **Verification**: Create order with count card (using 1.1), then call refund API, check `user_game_passes` table restoration.

## 2. Frontend Tasks
### 2.1 Update Payment Flow (Atomize)
- **File**: `bindbox-mini/pages-activity/activity/yifanshang/index.vue`
- **Goal**: Skip WeChat Pay for 0-amount orders.
- **Steps**:
    - Locate `onPaymentConfirm`.
    - After `joinLottery` returns, check `joinResult.actual_amount === 0` or `status`.
    - If true, directly call logic to show results (e.g. `onPaymentSuccess` or equivalent logic to flip cards).
    - Ensure `getLotteryResult` is called (which is already there in logic, just need to skip `createWechatOrder`).
- **Verification**: UI test with count card.

## 3. Dependency Graph
```mermaid
graph TD
    B1[Backend: Lottery Logic] --> B2[Backend: Refund Logic]
    B1 --> F1[Frontend: Payment Flow]
```
(B2 and F1 can be parallel, but B1 is prerequisite for B2 to be testable with new data).
