From f8a282401a87bb944b587cfd907eb3fd9510a01c Mon Sep 17 00:00:00 2001 From: chenweijian <820961417@qq.com> Date: Tue, 25 Jul 2023 18:16:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cv/billboard_cv/billboard.go | 15 +++++++++++---- cv/group_cv/group.go | 12 ------------ cv/user_cv/user.go | 11 +++++++++++ 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/cv/billboard_cv/billboard.go b/cv/billboard_cv/billboard.go index 8685ec7..9ce2a46 100644 --- a/cv/billboard_cv/billboard.go +++ b/cv/billboard_cv/billboard.go @@ -8,7 +8,6 @@ import ( "hilo-group/_const/enum/gift_e" "hilo-group/_const/redis_key" "hilo-group/cv/gift_cv" - "hilo-group/cv/group_cv" "hilo-group/cv/user_cv" "sort" "strconv" @@ -26,7 +25,7 @@ type BillboardUserInfo struct { //榜单中用户信息 type GroupTop3ConsumeUser struct { //用户基本信息 - UserBase group_cv.TopConsumersUser `json:"userBase"` + UserBase user_cv.TopConsumersUser `json:"userBase"` //数值 Num uint64 `json:"num"` } @@ -68,7 +67,15 @@ func GetGroupTop3Consume(model *domain.Model, groupId string, myUserId uint64) ( ret, err := saveGroupTop3Consume(period, groupId, diamonds) model.Log.Infof("GetGroupTop3Consume SAVE ret = %d, err: %v", ret, err) - return result, nil + + list := make([]GroupTop3ConsumeUser, 0, len(result)) + for _, v := range result { + list = append(list, GroupTop3ConsumeUser{ + UserBase: user_cv.TopConsumersUser{Id: v.UserBase.Id, Avatar: v.UserBase.Avatar, ExternalId: v.UserBase.ExternalId, Nick: v.UserBase.Nick}, + }) + } + + return list, nil } userIds := make([]uint64, 0) @@ -99,7 +106,7 @@ func GetGroupTop3Consume(model *domain.Model, groupId string, myUserId uint64) ( list := make([]GroupTop3ConsumeUser, 0, len(result)) for _, v := range result { list = append(list, GroupTop3ConsumeUser{ - UserBase: group_cv.TopConsumersUser{Id: v.UserBase.Id, Avatar: v.UserBase.Avatar, ExternalId: v.UserBase.ExternalId, Nick: v.UserBase.Nick}, + UserBase: user_cv.TopConsumersUser{Id: v.UserBase.Id, Avatar: v.UserBase.Avatar, ExternalId: v.UserBase.ExternalId, Nick: v.UserBase.Nick}, }) } diff --git a/cv/group_cv/group.go b/cv/group_cv/group.go index dbeb9ef..81d12e1 100644 --- a/cv/group_cv/group.go +++ b/cv/group_cv/group.go @@ -2,7 +2,6 @@ package group_cv import ( "git.hilo.cn/hilo-common/domain" - "git.hilo.cn/hilo-common/resource/mysql" "git.hilo.cn/hilo-common/utils" "hilo-group/_const/enum/game_e" "hilo-group/_const/enum/groupPower_e" @@ -147,17 +146,6 @@ type GroupDetail struct { Owner *user_cv.CvUserDetail `json:"owner"` // 群主信息 } -type TopConsumersUser struct { - //不会有返回值 - Id *mysql.ID `json:"id,omitempty"` - //头像,不存在为nil - Avatar *string `json:"avatar"` - //用户对外ID - ExternalId *string `json:"externalId"` - //昵称,不存在为nil - Nick *string `json:"nick"` -} - type SimpleRoleInfo struct { ExternalId string `json:"externalId"` Role group_e.GroupRoleType `json:"role"` diff --git a/cv/user_cv/user.go b/cv/user_cv/user.go index a5ea933..c23dce6 100644 --- a/cv/user_cv/user.go +++ b/cv/user_cv/user.go @@ -1324,3 +1324,14 @@ func UserDetailToRoomInfoOwner(user *CvUserDetail) *RoomInfoOwner { GroupPower: user.GroupPower, } } + +type TopConsumersUser struct { + //不会有返回值 + Id *mysql.ID `json:"id,omitempty"` + //头像,不存在为nil + Avatar *string `json:"avatar"` + //用户对外ID + ExternalId *string `json:"externalId"` + //昵称,不存在为nil + Nick *string `json:"nick"` +} -- 2.22.0