Merge branch 'feature-streamer_nick_audit-wxy-20241209' into test

This commit is contained in:
wangxinyu 2024-12-12 10:56:52 +08:00
commit 7ea1302274
3 changed files with 7 additions and 6 deletions

View File

@ -1402,14 +1402,15 @@ func (m *Mongo) UpdateAccount(ctx *gin.Context, account *dbstruct.Account) error
return err
}
func (m *Mongo) UpsertAccount(ctx *gin.Context, account *dbstruct.Account) error {
func (m *Mongo) UpsertOneAccount(ctx *gin.Context, account *dbstruct.Account) error {
col := m.getColAccount()
set := util.EntityToM(account)
set["ut"] = time.Now().Unix()
up := qmgo.M{
"$set": set,
}
_, err := col.UpsertId(ctx, util.DerefInt64(account.Mid), up)
_, err := col.Bulk().UpsertOne(util.DerefInt64(account.Mid), up).Run(ctx)
return err
}

View File

@ -402,8 +402,8 @@ func (s *Service) ApiUpdateAccount(ctx *gin.Context, req *accountproto.ApiUpdate
logger.Info("ApiUpdateAccount test log,req: %v", util.ToJson(req))
// 用户只允许修改昵称和头像
if err := _DefaultAccount.OpUpsert(ctx, opUpdateReq); err != nil {
logger.Error("OpUpsert fail, req: %v, err: %v", util.ToJson(req), err)
if err := _DefaultAccount.OpUpsertOne(ctx, opUpdateReq); err != nil {
logger.Error("OpUpsertOne fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeAccountSrvFail
return
}

View File

@ -66,8 +66,8 @@ func (p *Account) OpUpdate(ctx *gin.Context, req *accountproto.OpUpdateReq) erro
return nil
}
func (p *Account) OpUpsert(ctx *gin.Context, req *accountproto.OpUpdateReq) error {
err := p.store.UpsertAccount(ctx, req.Account)
func (p *Account) OpUpsertOne(ctx *gin.Context, req *accountproto.OpUpdateReq) error {
err := p.store.UpsertOneAccount(ctx, req.Account)
if err != nil {
logger.Error("UpdateAccount fail, err: %v", err)
return err