Merge pull request 'by Robin at 20240509' (#420) from feat-IRONFANS-114-Robin into test

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/420
This commit is contained in:
chenhao 2024-05-09 18:07:29 +08:00
commit 66ccd3aa64
5 changed files with 57 additions and 2 deletions

View File

@ -1448,13 +1448,25 @@ func (m *Mongo) CreateAccountHis(ctx *gin.Context, accounts []*dbstruct.Account)
return err return err
} }
// account相关 // streamer_acct相关
func (m *Mongo) CreateStreamerAcct(ctx *gin.Context, accounts []*dbstruct.StreamerAcct) error { func (m *Mongo) CreateStreamerAcct(ctx *gin.Context, accounts []*dbstruct.StreamerAcct) error {
col := m.getColStreamerAcct() col := m.getColStreamerAcct()
_, err := col.InsertMany(ctx, accounts) _, err := col.InsertMany(ctx, accounts)
return err return err
} }
func (m *Mongo) UpdateStreamerAcctName(ctx *gin.Context, id int64, name string) error {
col := m.getColStreamerAcct()
up := qmgo.M{
"$set": qmgo.M{
"ut": time.Now().Unix(),
"name": name,
},
}
err := col.UpdateId(ctx, id, up)
return err
}
// vericode相关 // vericode相关
func (m *Mongo) CreateVeriCode(ctx *gin.Context, vericode *dbstruct.VeriCode) error { func (m *Mongo) CreateVeriCode(ctx *gin.Context, vericode *dbstruct.VeriCode) error {
col := m.getColVeriCode() col := m.getColVeriCode()

View File

@ -364,6 +364,14 @@ func (s *Service) ApiUpdateAccount(ctx *gin.Context, req *accountproto.ApiUpdate
return return
} }
if oldAccount.GetRole() == consts.Streamer {
if err := _DefaultAccount.OpUpdateStreamerAcctName(ctx, util.DerefInt64(req.Account.Mid), util.DerefString(req.Account.Name)); err != nil {
logger.Error("OpUpdateStreamerAcctName fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeAccountSrvFail
return
}
}
// 审核任务加入队列 // 审核任务加入队列
imageaudit.AddTasks(imageaudittasks) imageaudit.AddTasks(imageaudittasks)
textaudit.AddTasks(textaudittasks) textaudit.AddTasks(textaudittasks)

View File

@ -292,3 +292,12 @@ func (p *Account) OpCreateStreamerAcct(ctx *gin.Context, accounts []*dbstruct.St
} }
return nil return nil
} }
func (p *Account) OpUpdateStreamerAcctName(ctx *gin.Context, mid int64, name string) error {
err := p.store.UpdateStreamerAcctName(ctx, mid, name)
if err != nil {
logger.Error("UpdateAccount fail, err: %v", err)
return err
}
return nil
}

View File

@ -810,6 +810,14 @@ func (s *Service) OpUpdateAccount(ctx *gin.Context, req *accountproto.OpUpdateRe
return return
} }
if oldAccount.GetRole() == consts.Streamer {
if err := _DefaultAccount.OpUpdateStreamerAcctName(ctx, util.DerefInt64(req.Account.Mid), util.DerefString(req.Account.Name)); err != nil {
logger.Error("OpUpdateStreamerAcctName fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeAccountSrvFail
return
}
}
// 审核任务加入队列 // 审核任务加入队列
textaudit.AddTasks(textaudittasks) textaudit.AddTasks(textaudittasks)
return return

View File

@ -72,12 +72,30 @@ func (handler *TextAuditTaskResultHandler) generateAccountNameUpdateFunc() {
} else { } else {
name = task.OldText name = task.OldText
} }
return _DefaultAccount.OpUpdate(ctx, &accountproto.OpUpdateReq{
err := _DefaultAccount.OpUpdate(ctx, &accountproto.OpUpdateReq{
Account: &dbstruct.Account{ Account: &dbstruct.Account{
Mid: mid, Mid: mid,
Name: name, Name: name,
}, },
}) })
if err != nil {
return err
}
acct, err := _DefaultAccount.OpListByMid(ctx, &accountproto.OpListByMidReq{
Mid: mid,
})
if err != nil {
return err
}
if acct.GetRole() == consts.Streamer {
return _DefaultAccount.OpUpdateStreamerAcctName(ctx, util.DerefInt64(mid), util.DerefString(name))
}
return nil
} }
} }
} }