From c3c313dfa6bbabd25d953babba1f4201a88e9054 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Fri, 10 May 2024 18:13:57 +0800 Subject: [PATCH 1/2] by Robin at 20240510 --- app/mix/service/utilservice.go | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/app/mix/service/utilservice.go b/app/mix/service/utilservice.go index 2f5e5f63..1b46090a 100644 --- a/app/mix/service/utilservice.go +++ b/app/mix/service/utilservice.go @@ -670,21 +670,24 @@ func (s *Service) utilCancelAccountByMids(ctx *gin.Context, midList []int64) err imageIds := make([]int64, 0) imageIds = append(imageIds, cfg.AvatarImageId) - err = _DefaultAccount.OpUpdateByIds(ctx, &accountproto.OpUpdateByIdsReq{ - Account: &dbstruct.Account{ - Name: goproto.String(cfg.Name), - PhoneHash: goproto.String(cfg.PhoneHash), - MobilePhone: goproto.String(cfg.MobilePhone), - Avatar: &dbstruct.MediaComponent{ - ImageIds: &imageIds, + + for _, account := range accounts { + phoneHash := strings.ToLower(util.DerefString(account.PhoneHash)) + err = _DefaultAccount.OpUpdate(ctx, &accountproto.OpUpdateReq{ + Account: &dbstruct.Account{ + 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), - }, - Ids: midList, - }) - if err != nil { - logger.Error("_DefaultAccount OpUpdateByIds fail, err: %v", err) - return err + }) + if err != nil { + logger.Error("_DefaultAccount OpUpdate fail, err: %v", err) + return err + } } return nil From 828447ed3f30471652170713cd7a839f7ddfcae3 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Fri, 10 May 2024 18:46:52 +0800 Subject: [PATCH 2/2] by Robin at 20240510 --- app/mix/service/utilservice.go | 1 + 1 file changed, 1 insertion(+) diff --git a/app/mix/service/utilservice.go b/app/mix/service/utilservice.go index 1b46090a..36dd6d3b 100644 --- a/app/mix/service/utilservice.go +++ b/app/mix/service/utilservice.go @@ -675,6 +675,7 @@ func (s *Service) utilCancelAccountByMids(ctx *gin.Context, midList []int64) err phoneHash := strings.ToLower(util.DerefString(account.PhoneHash)) err = _DefaultAccount.OpUpdate(ctx, &accountproto.OpUpdateReq{ Account: &dbstruct.Account{ + Mid: account.Mid, Name: goproto.String(cfg.Name), PhoneHash: goproto.String(phoneHash), MobilePhone: goproto.String(cfg.MobilePhone),