From 7b41ce1f24dd6c75c2c50575802dd822e53671b2 Mon Sep 17 00:00:00 2001 From: wenxu12345 <44203734@qq.com> Date: Thu, 30 Dec 2021 18:33:01 +0800 Subject: [PATCH] Refactor code --- internal/api/group/group.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/internal/api/group/group.go b/internal/api/group/group.go index cde682e31..f446d93a1 100644 --- a/internal/api/group/group.go +++ b/internal/api/group/group.go @@ -171,12 +171,15 @@ func GetGroupAllMemberList(c *gin.Context) { } if len(memberListResp.MemberList) > 0 { - s, err := jsm.MarshalToString(memberListResp.MemberList[0]) - //{"GroupID":"7836e478bc43ce1d3b8889cac983f59b","UserID":"openIM001","roleLevel":1,"JoinTime":"0","NickName":"","FaceUrl":"https://oss.com.cn/head","AppMangerLevel":0,"JoinSource":0,"OperatorUserID":"","Ex":"xxx"} - log.NewDebug(req.OperationID, "MarshalToString ", s, err) - m := ProtoToMap(memberListResp.MemberList[0], false) - log.NewDebug(req.OperationID, "mmm ", m) - memberListResp.Test = append(memberListResp.Test, m) + for _, v := range memberListResp.MemberList { + s, err := jsm.MarshalToString(v) + //{"GroupID":"7836e478bc43ce1d3b8889cac983f59b","UserID":"openIM001","roleLevel":1,"JoinTime":"0","NickName":"","FaceUrl":"https://oss.com.cn/head","AppMangerLevel":0,"JoinSource":0,"OperatorUserID":"","Ex":"xxx"} + log.NewDebug(req.OperationID, "MarshalToString ", s, err) + m := ProtoToMap(memberListResp.MemberList[0], false) + log.NewDebug(req.OperationID, "mmm ", m) + memberListResp.Test = append(memberListResp.Test, m) + } + } log.NewInfo(req.OperationID, "GetGroupAllMember api return ", memberListResp)