feat: integrate OA activation workflows and business migration
This commit is contained in:
@@ -12,10 +12,13 @@ type ActivationUsecase interface {
|
||||
List(context.Context, business.ActivationFilter, ...business.ListOption) (*business.ActivationPage, error)
|
||||
SpendDetail(context.Context, uint64) (*business.ActivationSpendDetail, error)
|
||||
}
|
||||
type ActivationService struct{ uc ActivationUsecase }
|
||||
type ActivationService struct {
|
||||
uc ActivationUsecase
|
||||
pool *business.ActivationPoolUsecase
|
||||
}
|
||||
|
||||
func NewActivationService(uc *business.ActivationUsecase) *ActivationService {
|
||||
return &ActivationService{uc: uc}
|
||||
func NewActivationService(uc *business.ActivationUsecase, pool *business.ActivationPoolUsecase) *ActivationService {
|
||||
return &ActivationService{uc: uc, pool: pool}
|
||||
}
|
||||
|
||||
func splitQueryValues(values []string) []string {
|
||||
@@ -57,7 +60,7 @@ func (s *ActivationService) List(ctx context.Context, req *dto.ActivationQuery)
|
||||
}
|
||||
out := &dto.ActivationPage{Rows: []*dto.ActivationResponse{}, Total: result.Total, Available: result.Available}
|
||||
for _, r := range result.Rows {
|
||||
out.Rows = append(out.Rows, &dto.ActivationResponse{ID: r.ID, PromoteAccount: r.PromoteAccount, PlatformName: r.PlatformName, PlatformTitle: business.PlatformName(r.PlatformName), BusierAccount: r.BusierAccount, ApplicantOA: r.ApplicantOA, BindAt: localTime(r.BindAt), UnbindAt: localTime(r.UnbindAt), ReachAt: localTime(r.ReachAt), EndAt: localTime(r.EndAt()), AccumAmount: r.AccumAmount, Status: r.Status, StatusText: business.ActivationStatusLabel(r.Status)})
|
||||
out.Rows = append(out.Rows, &dto.ActivationResponse{CreatedAt: localTime(r.CreatedAt), RegisteredPlayers: r.RegisteredPlayers, MetricsAvailable: r.MetricsAvailable, ID: r.ID, PromoteAccount: r.PromoteAccount, PlatformName: r.PlatformName, PlatformTitle: business.PlatformName(r.PlatformName), BusierAccount: r.BusierAccount, ApplicantOA: r.ApplicantOA, BindAt: localTime(r.BindAt), UnbindAt: localTime(r.UnbindAt), ReachAt: localTime(r.ReachAt), EndAt: localTime(r.EndAt()), AccumAmount: r.AccumAmount, Status: r.Status, StatusText: business.ActivationStatusLabel(r.Status)})
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
@@ -72,7 +75,12 @@ func (s *ActivationService) SpendDetail(ctx context.Context, id uint64) (*dto.Ac
|
||||
a := result.Activation
|
||||
out := &dto.ActivationSpendDetail{PromoteAccount: a.PromoteAccount, BindAt: localTime(a.BindAt), EndAt: localTime(a.EndAt()), List: []*dto.ActivationSpendItem{}, TotalAmount: result.TotalAmount}
|
||||
for _, item := range result.Items {
|
||||
out.List = append(out.List, &dto.ActivationSpendItem{PlatformTitle: business.PlatformName(a.PlatformName), GameName: item.GameName, TotalAmount: item.Amount})
|
||||
out.List = append(out.List, &dto.ActivationSpendItem{PlatformTitle: business.PlatformName(func() string {
|
||||
if item.PlatformName != "" {
|
||||
return item.PlatformName
|
||||
}
|
||||
return a.PlatformName
|
||||
}()), GameName: item.GameName, TotalAmount: item.Amount})
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user