feat(ops): ECR-007 行为分析与 ECR-008 内容运营后台
落地埋点 ingest/数据看板、首页宫格 CMS 与测评上下架;含账号引导、问答流式与免责声明去重,以及 review P1 审计同事务修复。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -23,19 +23,29 @@ type CreateOrderInput struct {
|
||||
ReportID *uuid.UUID
|
||||
}
|
||||
|
||||
// CreateOrder starts membership or deep_access order.
|
||||
// CreateOrder starts membership, deep_access, or ask_pack order.
|
||||
func (s *Service) CreateOrder(ctx context.Context, userID uuid.UUID, in CreateOrderInput) (uuid.UUID, error) {
|
||||
if in.Kind != "membership" && in.Kind != "deep_access" {
|
||||
if in.Kind != "membership" && in.Kind != "deep_access" && in.Kind != "ask_pack" {
|
||||
return uuid.Nil, errors.New("invalid kind")
|
||||
}
|
||||
if in.Kind == "deep_access" && in.ReportID == nil {
|
||||
return uuid.Nil, errors.New("report_id required")
|
||||
}
|
||||
amount := 990
|
||||
plan := in.Plan
|
||||
if in.Kind == "membership" {
|
||||
amount = 2500
|
||||
}
|
||||
return s.Reports.CreateOrder(ctx, userID, in.Kind, in.Plan, in.ReportID, amount)
|
||||
if in.Kind == "ask_pack" {
|
||||
if plan == "" {
|
||||
plan = "pack10"
|
||||
}
|
||||
amount = repository.AskPackAmountCents(plan)
|
||||
if amount <= 0 || repository.AskPackQuota(plan) <= 0 {
|
||||
return uuid.Nil, errors.New("invalid ask_pack plan")
|
||||
}
|
||||
}
|
||||
return s.Reports.CreateOrder(ctx, userID, in.Kind, plan, in.ReportID, amount)
|
||||
}
|
||||
|
||||
// PayMock completes mock payment.
|
||||
|
||||
Reference in New Issue
Block a user