Merge branch 'feature-streamer_nick_audit-wxy-20241209' into test
This commit is contained in:
commit
d338364cc1
|
@ -1402,15 +1402,17 @@ func (m *Mongo) UpdateAccount(ctx *gin.Context, account *dbstruct.Account) error
|
|||
return err
|
||||
}
|
||||
|
||||
func (m *Mongo) UpsertOneAccount(ctx *gin.Context, account *dbstruct.Account) error {
|
||||
func (m *Mongo) UpdateOneAccount(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.Bulk().UpsertOne(util.DerefInt64(account.Mid), up).Run(ctx)
|
||||
|
||||
filter := qmgo.M{
|
||||
"_id": util.DerefInt64(account.Mid),
|
||||
}
|
||||
err := col.UpdateOne(ctx, filter, up)
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -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.OpUpsertOne(ctx, opUpdateReq); err != nil {
|
||||
logger.Error("OpUpsertOne fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
if err := _DefaultAccount.OpUpdateOne(ctx, opUpdateReq); err != nil {
|
||||
logger.Error("OpUpdateOne fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
ec = errcode.ErrCodeAccountSrvFail
|
||||
return
|
||||
}
|
||||
|
|
|
@ -66,10 +66,10 @@ func (p *Account) OpUpdate(ctx *gin.Context, req *accountproto.OpUpdateReq) erro
|
|||
return nil
|
||||
}
|
||||
|
||||
func (p *Account) OpUpsertOne(ctx *gin.Context, req *accountproto.OpUpdateReq) error {
|
||||
err := p.store.UpsertOneAccount(ctx, req.Account)
|
||||
func (p *Account) OpUpdateOne(ctx *gin.Context, req *accountproto.OpUpdateReq) error {
|
||||
err := p.store.UpdateOneAccount(ctx, req.Account)
|
||||
if err != nil {
|
||||
logger.Error("UpdateAccount fail, err: %v", err)
|
||||
logger.Error("UpdateOneAccount fail, err: %v", err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue