feat: 迁移商务旗下渠道查询和抽屉
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package business
|
||||
|
||||
import "context"
|
||||
|
||||
type BusinessPromote struct {
|
||||
ID uint64
|
||||
Account, SourceDB string
|
||||
BusierID uint64
|
||||
}
|
||||
type BusinessPromoteFilter struct {
|
||||
UserID uint
|
||||
SourceDB string
|
||||
BusierID uint64
|
||||
}
|
||||
type BusinessPromotePage struct {
|
||||
Rows []*BusinessPromote
|
||||
Total int64
|
||||
Available bool
|
||||
}
|
||||
type BusinessPromoteRepo interface {
|
||||
ListDirect(context.Context, BusinessPromoteFilter, ...ListOption) (*BusinessPromotePage, error)
|
||||
}
|
||||
type BusinessPromoteUsecase struct {
|
||||
repo BusinessPromoteRepo
|
||||
accounts *AccountUsecase
|
||||
}
|
||||
|
||||
func NewBusinessPromoteUsecase(repo BusinessPromoteRepo, accounts *AccountUsecase) *BusinessPromoteUsecase {
|
||||
return &BusinessPromoteUsecase{repo: repo, accounts: accounts}
|
||||
}
|
||||
func (uc *BusinessPromoteUsecase) List(ctx context.Context, filter BusinessPromoteFilter, options ...ListOption) (*BusinessPromotePage, error) {
|
||||
if _, err := uc.accounts.Find(ctx, filter.UserID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return uc.repo.ListDirect(ctx, filter, options...)
|
||||
}
|
||||
Reference in New Issue
Block a user