feat(ECR-015): RedemptionCode 兑换码并 Closed

批次生成/作废、C 端兑码延长会员;admin-h5 /codes。
Loop continuous。Next:ECR-016 UserIntelligence。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-07 18:16:13 +08:00
co-authored by Cursor
parent 0e26aabef8
commit 1eeb0b00e7
33 changed files with 1073 additions and 36 deletions
@@ -4,6 +4,7 @@ package membership
import (
"context"
"errors"
"strings"
"time"
"github.com/google/uuid"
@@ -58,6 +59,15 @@ func (s *Service) CreateOrder(ctx context.Context, userID uuid.UUID, in CreateOr
return s.Reports.CreateOrder(ctx, userID, in.Kind, plan, in.ReportID, amount)
}
// Redeem applies a redemption code for the current registered user.
func (s *Service) Redeem(ctx context.Context, userID uuid.UUID, code string) (string, error) {
code = strings.TrimSpace(code)
if code == "" {
return "", errors.New("code required")
}
return s.Reports.RedeemCode(ctx, userID, code)
}
// PayMock completes mock payment.
func (s *Service) PayMock(ctx context.Context, userID, orderID uuid.UUID) error {
return s.Reports.PayMock(ctx, userID, orderID)