Merge remote-tracking branch 'origin/feat-IRONFANS-220-Robin' into test

This commit is contained in:
Leufolium 2024-09-27 15:10:42 +08:00
commit c5676a3356
1 changed files with 21 additions and 14 deletions

View File

@ -594,31 +594,38 @@ func (s *Service) utilCancelAccountByMids(ctx *gin.Context, midList []int64) err
for _, account := range accounts {
phoneHash := strings.ToLower(util.DerefString(account.PhoneHash))
err = _DefaultAccount.OpUpdate(ctx, &accountproto.OpUpdateReq{
updateReq := &accountproto.OpUpdateReq{
Account: &dbstruct.Account{
Mid: account.Mid,
Name: goproto.String(cfg.Name),
PhoneHash: goproto.String(phoneHash),
MobilePhone: goproto.String(cfg.MobilePhone),
Avatar: &dbstruct.MediaComponent{
ImageIds: &imageIds,
},
Status: goproto.Int64(consts.AccountStatus_Cancelled),
Status: goproto.Int64(consts.AccountStatus_Cancelled),
},
})
}
// 非主播才修改名字和头像
if account.GetRole() != consts.Streamer {
updateReq.Account.Name = goproto.String(cfg.Name)
updateReq.Account.Avatar = &dbstruct.MediaComponent{
ImageIds: &imageIds,
}
}
err = _DefaultAccount.OpUpdate(ctx, updateReq)
if qmgo.IsDup(err) {
err = _DefaultAccount.OpUpdate(ctx, &accountproto.OpUpdateReq{
updateReq := &accountproto.OpUpdateReq{
Account: &dbstruct.Account{
Mid: account.Mid,
Name: goproto.String(cfg.Name),
PhoneHash: goproto.String(phoneHash + qmgo.NewObjectID().Hex()),
MobilePhone: goproto.String(cfg.MobilePhone),
Avatar: &dbstruct.MediaComponent{
ImageIds: &imageIds,
},
Status: goproto.Int64(consts.AccountStatus_Cancelled),
Status: goproto.Int64(consts.AccountStatus_Cancelled),
},
})
}
if account.GetRole() != consts.Streamer {
updateReq.Account.Name = goproto.String(cfg.Name)
updateReq.Account.Avatar = &dbstruct.MediaComponent{
ImageIds: &imageIds,
}
}
err = _DefaultAccount.OpUpdate(ctx, updateReq)
}
if err != nil {
logger.Error("_DefaultAccount OpUpdate fail, err: %v", err)