diff --git a/app/mix/service/utilservice.go b/app/mix/service/utilservice.go index 926f6b76..0f6cd02a 100644 --- a/app/mix/service/utilservice.go +++ b/app/mix/service/utilservice.go @@ -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)