feat: 完善小组绩效与有效端统计并修复审查问题
This commit is contained in:
@@ -41,6 +41,7 @@ type Channel struct {
|
||||
GameCount, PlayerCount *int64
|
||||
TotalPayAmount *string
|
||||
CreatedUnix, LastLoginUnix *int64
|
||||
QualifiedAt *int64
|
||||
}
|
||||
|
||||
func (c *Channel) BusinessDisplayName() string {
|
||||
@@ -70,6 +71,7 @@ func (c *Channel) IncludesStat(other *Channel, includeSub bool) bool {
|
||||
}
|
||||
|
||||
type ChannelFilter struct {
|
||||
Effective *bool
|
||||
Sources []string
|
||||
BusierUserID *uint
|
||||
BusierAccount, Keyword string
|
||||
@@ -133,16 +135,17 @@ type ChannelWriteRepo interface {
|
||||
}
|
||||
type PlatformPasswordEncoder interface{ Encode(string) (string, error) }
|
||||
type ChannelUsecase struct {
|
||||
repo ChannelRepo
|
||||
writer ChannelWriteRepo
|
||||
accounts *AccountUsecase
|
||||
preferences *UserPreferenceUsecase
|
||||
passwords PlatformPasswordEncoder
|
||||
now func() time.Time
|
||||
repo ChannelRepo
|
||||
writer ChannelWriteRepo
|
||||
accounts *AccountUsecase
|
||||
preferences *UserPreferenceUsecase
|
||||
passwords PlatformPasswordEncoder
|
||||
effectiveness *EffectivenessUsecase
|
||||
now func() time.Time
|
||||
}
|
||||
|
||||
func NewChannelUsecase(repo ChannelRepo, writer ChannelWriteRepo, accounts *AccountUsecase, preferences *UserPreferenceUsecase, passwords PlatformPasswordEncoder) *ChannelUsecase {
|
||||
return &ChannelUsecase{repo: repo, writer: writer, accounts: accounts, preferences: preferences, passwords: passwords, now: time.Now}
|
||||
func NewChannelUsecase(repo ChannelRepo, writer ChannelWriteRepo, accounts *AccountUsecase, preferences *UserPreferenceUsecase, passwords PlatformPasswordEncoder, effectiveness *EffectivenessUsecase) *ChannelUsecase {
|
||||
return &ChannelUsecase{repo: repo, writer: writer, accounts: accounts, preferences: preferences, passwords: passwords, now: time.Now, effectiveness: effectiveness}
|
||||
}
|
||||
func (uc *ChannelUsecase) scope(ctx context.Context) (UserScope, error) {
|
||||
actor, a, err := uc.accounts.actor(ctx)
|
||||
@@ -170,6 +173,11 @@ func (uc *ChannelUsecase) List(ctx context.Context, filter ChannelFilter, option
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if uc.effectiveness != nil {
|
||||
if err := uc.effectiveness.Ensure(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
page, err := uc.repo.List(ctx, scope, filter, options...)
|
||||
if err != nil || len(page.Rows) == 0 {
|
||||
return page, err
|
||||
|
||||
Reference in New Issue
Block a user