# 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 `channel/index` | | Company total bet | Total bets in readable scope; clickable records dialog requires `channel/index` | 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** (read + write): `admin.channel_id` and/or any role group `channel_id` → only those channels. **All channels** (read + write): super admin, **or** no channel binding **and** any channel module permission (`channel/index`, `channel/edit`, etc.). **No access**: unbound and no channel module permissions → empty list. --- ## 4. Actions & permissions | Node | Label | Behavior | |------|-------|----------| | `channel/index` | View | List, stat card clicks, bet/dividend record dialogs | | `channel/manualSettle` | Manual settle | Preview + submit (readable channel) | | `channel/batchSettlePending` | Batch settle | Writable enabled channels in scope | 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 (column) | `directBetRecordList` | All play records for that channel | | Company total bet (top card) | `companyBetRecordList` | All play records in readable scope | **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 |