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

This commit is contained in:
wangxinyu 2024-12-12 11:33:10 +08:00
commit 99e38d1251
5 changed files with 3 additions and 34 deletions

View File

@ -1402,20 +1402,6 @@ func (m *Mongo) UpdateAccount(ctx *gin.Context, account *dbstruct.Account) error
return err
}
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,
}
filter := qmgo.M{
"_id": util.DerefInt64(account.Mid),
}
err := col.UpdateOne(ctx, filter, up)
return err
}
func (m *Mongo) UpdateAccountByMidAndStatus(ctx *gin.Context, account *dbstruct.Account, status int64) error {
col := m.getColAccount()
set := util.EntityToM(account)

View File

@ -388,21 +388,15 @@ func (s *Service) ApiUpdateAccount(ctx *gin.Context, req *accountproto.ApiUpdate
// 主播昵称需要先过审核
if oldAccount.GetRole() == consts.Streamer && oldAccount.GetName() != req.Account.GetName() {
// TODO:wxy, 测试日志
logger.Info("ApiUpdateAccount test log, NewName: %v, auditStatus: %v", oldAccount.GetNewName(), oldAccount.GetAuditStatus())
opUpdateReq.NewName = goproto.String(req.Account.GetName())
auditStatus := s.SetAuditStatusBitMap(oldAccount.GetAuditStatus(), consts.StreamNikeAudit, consts.StreamerNikeNameAuditing)
opUpdateReq.AuditStatus = goproto.Int64(auditStatus)
logger.Info("ApiUpdateAccount test log, NewName: %v, auditStatus: %v", opUpdateReq.GetNewName(), opUpdateReq.GetAuditStatus())
} else {
opUpdateReq.Name = goproto.String(req.Account.GetName())
}
// TODO:wxy, 测试日志
logger.Info("ApiUpdateAccount test log,req: %v", util.ToJson(req))
// 用户只允许修改昵称和头像
if err := _DefaultAccount.OpUpdateOne(ctx, opUpdateReq); err != nil {
if err := _DefaultAccount.OpUpdate(ctx, opUpdateReq); err != nil {
logger.Error("OpUpdateOne fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeAccountSrvFail
return

View File

@ -66,15 +66,6 @@ func (p *Account) OpUpdate(ctx *gin.Context, req *accountproto.OpUpdateReq) erro
return nil
}
func (p *Account) OpUpdateOne(ctx *gin.Context, req *accountproto.OpUpdateReq) error {
err := p.store.UpdateOneAccount(ctx, req.Account)
if err != nil {
logger.Error("UpdateOneAccount fail, err: %v", err)
return err
}
return nil
}
func (p *Account) OpUpdateByMidAndStatus(ctx *gin.Context, req *accountproto.OpUpdateReq, status int64) error {
err := p.store.UpdateAccountByMidAndStatus(ctx, req.Account, status)
if err != nil {

View File

@ -274,7 +274,5 @@ func (s *Service) SetAuditStatusBitMap(auditStatus int64, auditType int, flag in
auditStatus &^= consts.StreamerNikeNameAuditing
}
}
// TODO:wxy, 测试日志
logger.Info("SetAuditStatusBitMap, auditStatus: %v", auditStatus)
return auditStatus
}

View File

@ -8,7 +8,7 @@ const (
type Account struct {
Mid *int64 `json:"mid" bson:"_id"` // 用户表Id
Name *string `json:"name" bson:"name"` // 用户名
NewName *string `json:"new_name"` // 用户修改后的名字(主播昵称需要审核,用来更新)
NewName *string `json:"new_name" bson:"audit_status"` // 用户修改后的名字(主播昵称需要审核,用来更新)
UserId *int64 `json:"user_id" bson:"user_id"` // 业务Id
Avatar *MediaComponent `json:"avatar" bson:"avatar"` // 头像
MobilePhone *string `json:"mobile_phone" bson:"mobile_phone" jcrypto:"rsa" bcrypto:"aes_cbc|1|0"` // 手机号,数据库加密,查询不解密
@ -106,7 +106,7 @@ func (p *Account) GetStatus() int64 {
func (p *Account) GetAuditStatus() int64 {
if p == nil || p.AuditStatus == nil {
return -1
return 0
}
return *p.AuditStatus
}