# Channel Management (Admin) ## 1. Purpose Documents the **Channel Management** page (`/admin/channel`): summary cards, list scope, button permissions, bet-record dialogs, and APIs. For commission calculation and agent tree split, see [commission-share-guide.md](./commission-share-guide.md). --- ## 2. Summary cards | Card | Description | |------|-------------| | Total channels | Count in **readable scope** | | Enabled | `status = 1` | | Pending dividend (count) | `carryover_balance > 0` | | Pending dividend (amount) | Sum of those balances | | Paid dividend | Sum of paid `agent_commission_record` in scope; clickable dialog requires `viewDividendRecords` | List filters: **All / With balance / No balance / Enabled only / Disabled only** (UI search only). --- ## 3. Read scope `AdminChannelScopeService` applies to list and stats: **Bound channel wins** (only those channels) if `admin.channel_id` > 0 and/or any role group has `channel_id` — even with `viewAllChannels`. **Global read** only when: super admin, **or** no channel binding on account and all groups **and** `viewAllChannels`. **Write** (add/edit/delete/manual settle DB) stays on **writable** channels only; `viewAllChannels` does not expand write scope. --- ## 4. Actions & permissions | Node | Label | Behavior | |------|-------|----------| | `channel/viewAllChannels` | View all channels | Global read scope | | `channel/viewDividendRecords` | Paid dividend records | Top card + dialog | | `channel/viewDirectBetRecords` | Direct bet records | Direct bet column click | | `channel/viewSettlementBetRecords` | Settlement-scope bets | Row action | | `channel/manualSettle` | Manual settle | Preview + submit (readable channel) | | `channel/batchSettlePending` | Batch settle | **Super admin only** | Re-login after role changes to refresh `authNode`. --- ## 5. Manual settlement - `GET /admin/channel/manualSettlePreview?id=` - `POST /admin/channel/manualSettle` - Super admin **or** `channel/manualSettle` with channel in read scope - Same payout flow as super-admin settle (`ChannelSettlementService::settleBySuperAdmin`) --- ## 6. Bet record dialogs | Entry | API | Data | |-------|-----|------| | Direct bet amount | `directBetRecordList` | All play records for channel | | View settlement bets | `settlementBetRecordList` | `status = 2` only | **Filters (GET):** `period_no`, `user_keyword`, `result_number`, `pick_number`, `win_hit` (`won`/`lost`/`pending`), `page`, `limit`. **Columns:** period, player, channel, picks, winning number, win status, bet amount, win amount. **Mobile:** ~92% width, scrollable body, 3 summary cards per row, horizontal table scroll. --- ## 7. APIs See §8 in the Chinese doc `docs/渠道管理后台说明.md` (same paths under `/admin/channel/`). --- ## 8. Changelog | Date | Note | |------|------| | 2026-05-30 | Bet record columns, filters, mobile layout; `viewAllChannels`; manual settle by permission |