1. 17 Apr, 2026 1 commit
    • erio's avatar
      fix(billing): reject rate_multiplier <= 0 on save; clamp negatives to 0 in compute · df57d277
      erio authored
      分组倍率和用户专属倍率在保存时没有校验,0 会触发计费层的 `<=0 → 1.0`
      防御条款,结果订阅/余额分组按标准价扣费;完全是沉默地绕过了业务规则。
      
      - 保存校验(admin_service):CreateGroup / UpdateGroup / BatchSetGroupRateMultipliers /
        UpdateUser.SyncUserGroupRates 全部要求 > 0
      - 计算层(billing_service):三处 `<=0 → 1.0` 改为 `<0 → 0`;负数按 0 结算,
        避免配置异常被静默按 1x 收费
      - 前端:分组倍率 / 用户专属倍率输入 min 统一到 0.001
      - 删除未使用的 IsFreeSubscription 方法
      
      测试:新增 billing_service_rate_multiplier_test.go 端到端验证;更新原有锁定
      旧 `<=0 → 1.0` 行为的测试。
      df57d277
  2. 09 Apr, 2026 1 commit
  3. 12 Mar, 2026 1 commit
    • erio's avatar
      feat(groups): add rate multipliers management modal · d6488112
      erio authored
      Add a dedicated modal in group management for viewing, adding, editing,
      and deleting per-user rate multipliers within a group.
      
      Backend:
      - GET /admin/groups/:id/rate-multipliers - list entries with user details
      - PUT /admin/groups/:id/rate-multipliers - batch sync (full replace)
      - DELETE /admin/groups/:id/rate-multipliers - clear all entries
      - Repository: GetByGroupID, SyncGroupRateMultipliers methods on
        user_group_rate_multipliers table (same table as user-side rates)
      
      Frontend:
      - New GroupRateMultipliersModal component with:
        - User search and add with email autocomplete
        - Editable rate column with local edit mode (cancel/save)
        - Batch adjust: multiply all rates by a factor
        - Clear all (local operation, requires save to persist)
        - Pagination (10/20/50 per page)
        - Platform icon with brand colors in group info bar
        - Unsaved changes indicator with revert option
      - Unit tests for all three backend endpoints
      d6488112