Refactor code

pull/131/head
wenxu12345 3 years ago
parent 0c02afa54e
commit 79a39b39d9

@ -146,7 +146,7 @@ func GetGroupAllMember(c *gin.Context) {
return
}
req := &rpc.GetGroupAllMemberReq{}
utils.CopyStructFields(req, params)
utils.CopyStructFields(req, &params)
var ok bool
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
if !ok {
@ -165,9 +165,12 @@ func GetGroupAllMember(c *gin.Context) {
return
}
memberListResp := api.GetGroupAllMemberResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, Data: RpcResp.MemberList}
c.JSON(http.StatusOK, memberListResp)
memberListResp := api.GetGroupAllMemberResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, MemberList: RpcResp.MemberList}
if len(memberListResp.MemberList) == 0 {
memberListResp.MemberList = []*open_im_sdk.GroupMemberFullInfo{}
}
log.NewInfo(req.OperationID, "GetGroupAllMember api return ", memberListResp)
c.JSON(http.StatusOK, memberListResp)
}
func GetJoinedGroupList(c *gin.Context) {

@ -261,7 +261,7 @@ func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGro
for _, v := range memberList {
var node open_im_sdk.GroupMemberFullInfo
utils.CopyStructFields(node, v)
utils.CopyStructFields(&node, &v)
resp.MemberList = append(resp.MemberList, &node)
}
log.NewInfo(req.OperationID, "GetGroupAllMember rpc return ", resp.String())

@ -69,7 +69,7 @@ type GetGroupAllMemberReq struct {
}
type GetGroupAllMemberResp struct {
CommResp
Data []*open_im_sdk.GroupMemberFullInfo `json:"data"`
MemberList []*open_im_sdk.GroupMemberFullInfo `json:"data"`
}
type CreateGroupReq struct {

Loading…
Cancel
Save