feat: 迁移游戏商务绑定审核流程和列表
This commit is contained in:
@@ -153,7 +153,7 @@ func checkAccountUnique(tx *gorm.DB, a *business.Account) error {
|
||||
}
|
||||
|
||||
func (r *accountRepo) Create(ctx context.Context, a *business.Account) error {
|
||||
return r.data.DB().WithContext(ctx).Transaction(func(tx *gorm.DB) error {
|
||||
err := r.data.DB().WithContext(ctx).Transaction(func(tx *gorm.DB) error {
|
||||
if err := checkAccountUnique(tx, a); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -171,10 +171,11 @@ func (r *accountRepo) Create(ctx context.Context, a *business.Account) error {
|
||||
a.ID, a.CreatedAt, a.UpdatedAt = po.ID, po.CreatedAt, po.UpdatedAt
|
||||
return nil
|
||||
})
|
||||
return storageError(err)
|
||||
}
|
||||
|
||||
func (r *accountRepo) Update(ctx context.Context, a *business.Account) error {
|
||||
return r.data.DB().WithContext(ctx).Transaction(func(tx *gorm.DB) error {
|
||||
err := r.data.DB().WithContext(ctx).Transaction(func(tx *gorm.DB) error {
|
||||
if err := checkAccountUnique(tx, a); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -194,6 +195,7 @@ func (r *accountRepo) Update(ctx context.Context, a *business.Account) error {
|
||||
}
|
||||
return nil
|
||||
})
|
||||
return storageError(err)
|
||||
}
|
||||
|
||||
func (r *accountRepo) AuthorityForLevel(ctx context.Context, level int) (uint, error) {
|
||||
@@ -250,17 +252,10 @@ func (r *accountRepo) DirectCounts(ctx context.Context, ids []uint) (map[uint]bu
|
||||
result[b.UserID] = business.AccountCounts{PromoteCount: &zero, BindCount: b.Total}
|
||||
}
|
||||
// 系统数据演练库尚未包含渠道表时,基础资料与已通过绑定数仍可使用。
|
||||
tables, err := db.Migrator().GetTables()
|
||||
available, err := businessTableAvailable(db, "tab_promote")
|
||||
if err != nil {
|
||||
return nil, business.ErrStorage
|
||||
}
|
||||
available := false
|
||||
for _, table := range tables {
|
||||
if table == "tab_promote" {
|
||||
available = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !available {
|
||||
for _, b := range binds {
|
||||
value := result[b.UserID]
|
||||
|
||||
Reference in New Issue
Block a user