From 7301bc30b15864668541429cf5ca120c3bcffcce Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Thu, 30 Dec 2021 16:53:06 +0800 Subject: [PATCH 1/5] add null value handle --- cmd/open_im_api/main.go | 14 +++++++------- internal/api/group/group.go | 4 +++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cmd/open_im_api/main.go b/cmd/open_im_api/main.go index 510d8cf55..b55486522 100644 --- a/cmd/open_im_api/main.go +++ b/cmd/open_im_api/main.go @@ -84,18 +84,18 @@ func main() { //Manager managementGroup := r.Group("/manager") { - managementGroup.POST("/delete_user", manage.DeleteUser) + managementGroup.POST("/delete_user", manage.DeleteUser) //1 managementGroup.POST("/send_msg", manage.ManagementSendMsg) - managementGroup.POST("/get_all_users_uid", manage.GetAllUsersUid) - managementGroup.POST("/account_check", manage.AccountCheck) - managementGroup.POST("/get_users_online_status", manage.GetUsersOnlineStatus) + managementGroup.POST("/get_all_users_uid", manage.GetAllUsersUid) //1 + managementGroup.POST("/account_check", manage.AccountCheck) //1 + managementGroup.POST("/get_users_online_status", manage.GetUsersOnlineStatus) //1 } //Conversation conversationGroup := r.Group("/conversation") { - conversationGroup.POST("/set_receive_message_opt", conversation.SetReceiveMessageOpt) - conversationGroup.POST("/get_receive_message_opt", conversation.GetReceiveMessageOpt) - conversationGroup.POST("/get_all_conversation_message_opt", conversation.GetAllConversationMessageOpt) + conversationGroup.POST("/set_receive_message_opt", conversation.SetReceiveMessageOpt) //1 + conversationGroup.POST("/get_receive_message_opt", conversation.GetReceiveMessageOpt) //1 + conversationGroup.POST("/get_all_conversation_message_opt", conversation.GetAllConversationMessageOpt) //1 } log.NewPrivateLog("api") diff --git a/internal/api/group/group.go b/internal/api/group/group.go index c7297e083..6f39e0223 100644 --- a/internal/api/group/group.go +++ b/internal/api/group/group.go @@ -181,6 +181,9 @@ func GetJoinedGroupList(c *gin.Context) { } GroupListResp := api.GetJoinedGroupListResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, Data: RpcResp.GroupList} + if len(RpcResp.GroupList) == 0 { + GroupListResp.Data = []*open_im_sdk.GroupInfo{} + } c.JSON(http.StatusOK, GroupListResp) log.NewInfo(req.OperationID, "GetJoinedGroupList api return ", GroupListResp) } @@ -482,7 +485,6 @@ func TransferGroupOwner(c *gin.Context) { c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) return } - resp := api.CommResp{ErrCode: reply.CommonResp.ErrCode, ErrMsg: reply.CommonResp.ErrMsg} c.JSON(http.StatusOK, resp) log.NewInfo(req.OperationID, "TransferGroupOwner api return ", resp) From e4989d8b9ffdd8c9de0d6198d74fdae3e8bb194c Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Thu, 30 Dec 2021 17:46:29 +0800 Subject: [PATCH 2/5] add null value handle --- internal/api/group/group.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/api/group/group.go b/internal/api/group/group.go index 6f39e0223..c0998e0e4 100644 --- a/internal/api/group/group.go +++ b/internal/api/group/group.go @@ -84,6 +84,9 @@ func GetGroupMembersInfo(c *gin.Context) { } memberListResp := api.GetGroupMembersInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, Data: RpcResp.MemberList} + if len(RpcResp.MemberList) == 0 { + memberListResp.Data = []*open_im_sdk.GroupMemberFullInfo{} + } log.NewInfo(req.OperationID, "GetGroupMembersInfo api return ", memberListResp) c.JSON(http.StatusOK, memberListResp) } From fdf1c0448be87c50eef250a8c2060fb4bde0734c Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Thu, 30 Dec 2021 17:48:20 +0800 Subject: [PATCH 3/5] add null value handle --- cmd/open_im_api/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/open_im_api/main.go b/cmd/open_im_api/main.go index b55486522..8b6b70b81 100644 --- a/cmd/open_im_api/main.go +++ b/cmd/open_im_api/main.go @@ -58,9 +58,9 @@ func main() { groupRouterGroup.POST("/kick_group", group.KickGroupMember) groupRouterGroup.POST("/get_group_member_list", group.GetGroupMemberList) groupRouterGroup.POST("/get_group_all_member_list", group.GetGroupAllMember) - groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo) + groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo) //1 groupRouterGroup.POST("/invite_user_to_group", group.InviteUserToGroup) - groupRouterGroup.POST("/get_joined_group_list", group.GetJoinedGroupList) + groupRouterGroup.POST("/get_joined_group_list", group.GetJoinedGroupList) //1 } //certificate authRouterGroup := r.Group("/auth") From 627419aa5f7523e0889e646bfc6177f2fae4024f Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Thu, 30 Dec 2021 17:56:12 +0800 Subject: [PATCH 4/5] add null value handle --- cmd/open_im_api/main.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/cmd/open_im_api/main.go b/cmd/open_im_api/main.go index bb592de31..46c79536e 100644 --- a/cmd/open_im_api/main.go +++ b/cmd/open_im_api/main.go @@ -57,13 +57,10 @@ func main() { groupRouterGroup.POST("/get_groups_info", group.GetGroupsInfo) //1 groupRouterGroup.POST("/kick_group", group.KickGroupMember) //1 groupRouterGroup.POST("/get_group_member_list", group.GetGroupMemberList) //no use - groupRouterGroup.POST("/get_group_all_member_list", group.GetGroupAllMember) - groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo) - groupRouterGroup.POST("/invite_user_to_group", group.InviteUserToGroup) //1 - groupRouterGroup.POST("/get_joined_group_list", group.GetJoinedGroupList) - groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo) //1 - groupRouterGroup.POST("/invite_user_to_group", group.InviteUserToGroup) - groupRouterGroup.POST("/get_joined_group_list", group.GetJoinedGroupList) //1 + groupRouterGroup.POST("/get_group_all_member_list", group.GetGroupAllMember) //1 + groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo) //1 + groupRouterGroup.POST("/invite_user_to_group", group.InviteUserToGroup) //1 + groupRouterGroup.POST("/get_joined_group_list", group.GetJoinedGroupList) //1 } //certificate authRouterGroup := r.Group("/auth") From 7a3bb59d3e705cddb933823b5e6e7680426f065b Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Thu, 30 Dec 2021 19:12:50 +0800 Subject: [PATCH 5/5] add null value handle --- internal/api/group/group.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/api/group/group.go b/internal/api/group/group.go index 66af1501d..c5132b769 100644 --- a/internal/api/group/group.go +++ b/internal/api/group/group.go @@ -234,9 +234,9 @@ func GetJoinedGroupList(c *gin.Context) { return } - GroupListResp := api.GetJoinedGroupListResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, Data: RpcResp.GroupList} + GroupListResp := api.GetJoinedGroupListResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, GroupInfoList: RpcResp.GroupList} if len(RpcResp.GroupList) == 0 { - GroupListResp.Data = []*open_im_sdk.GroupInfo{} + GroupListResp.GroupInfoList = []*open_im_sdk.GroupInfo{} } c.JSON(http.StatusOK, GroupListResp) log.NewInfo(req.OperationID, "GetJoinedGroupList api return ", GroupListResp)