mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-25 14:39:20 +08:00
Refactor code
This commit is contained in:
parent
c8d803b559
commit
aab6ad96eb
@ -91,10 +91,8 @@ func GetGroupMembersInfo(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
memberListResp := api.GetGroupMembersInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, Data: RpcResp.MemberList}
|
memberListResp := api.GetGroupMembersInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, MemberList: RpcResp.MemberList}
|
||||||
if len(RpcResp.MemberList) == 0 {
|
memberListResp.Data = jsonData.JsonDataList(RpcResp.MemberList)
|
||||||
memberListResp.Data = []*open_im_sdk.GroupMemberFullInfo{}
|
|
||||||
}
|
|
||||||
log.NewInfo(req.OperationID, "GetGroupMembersInfo api return ", memberListResp)
|
log.NewInfo(req.OperationID, "GetGroupMembersInfo api return ", memberListResp)
|
||||||
c.JSON(http.StatusOK, memberListResp)
|
c.JSON(http.StatusOK, memberListResp)
|
||||||
}
|
}
|
||||||
@ -128,9 +126,7 @@ func GetGroupMemberList(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
memberListResp := api.GetGroupMemberListResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, MemberList: RpcResp.MemberList, NextSeq: RpcResp.NextSeq}
|
memberListResp := api.GetGroupMemberListResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, MemberList: RpcResp.MemberList, NextSeq: RpcResp.NextSeq}
|
||||||
if len(memberListResp.MemberList) == 0 {
|
memberListResp.Data = jsonData.JsonDataList(memberListResp.MemberList)
|
||||||
memberListResp.MemberList = []*open_im_sdk.GroupMemberFullInfo{}
|
|
||||||
}
|
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "GetGroupMemberList api return ", memberListResp)
|
log.NewInfo(req.OperationID, "GetGroupMemberList api return ", memberListResp)
|
||||||
c.JSON(http.StatusOK, memberListResp)
|
c.JSON(http.StatusOK, memberListResp)
|
||||||
@ -164,12 +160,7 @@ func GetGroupAllMemberList(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
memberListResp := api.GetGroupAllMemberResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, MemberList: RpcResp.MemberList}
|
memberListResp := api.GetGroupAllMemberResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, MemberList: RpcResp.MemberList}
|
||||||
if len(memberListResp.MemberList) == 0 {
|
memberListResp.Data = jsonData.JsonDataList(memberListResp.MemberList)
|
||||||
memberListResp.MemberList = []*open_im_sdk.GroupMemberFullInfo{}
|
|
||||||
}
|
|
||||||
|
|
||||||
memberListResp.Test = jsonData.JsonDataList(memberListResp.MemberList)
|
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "GetGroupAllMember api return ", memberListResp)
|
log.NewInfo(req.OperationID, "GetGroupAllMember api return ", memberListResp)
|
||||||
c.JSON(http.StatusOK, memberListResp)
|
c.JSON(http.StatusOK, memberListResp)
|
||||||
}
|
}
|
||||||
@ -202,11 +193,9 @@ func GetJoinedGroupList(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GroupListResp := api.GetJoinedGroupListResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, GroupInfoList: RpcResp.GroupList}
|
GroupListResp := api.GetJoinedGroupListResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, GroupInfoList: RpcResp.GroupList}
|
||||||
if len(RpcResp.GroupList) == 0 {
|
GroupListResp.Data = jsonData.JsonDataList(GroupListResp.GroupInfoList)
|
||||||
GroupListResp.GroupInfoList = []*open_im_sdk.GroupInfo{}
|
|
||||||
}
|
|
||||||
c.JSON(http.StatusOK, GroupListResp)
|
|
||||||
log.NewInfo(req.OperationID, "GetJoinedGroupList api return ", GroupListResp)
|
log.NewInfo(req.OperationID, "GetJoinedGroupList api return ", GroupListResp)
|
||||||
|
c.JSON(http.StatusOK, GroupListResp)
|
||||||
}
|
}
|
||||||
|
|
||||||
func InviteUserToGroup(c *gin.Context) {
|
func InviteUserToGroup(c *gin.Context) {
|
||||||
@ -240,8 +229,13 @@ func InviteUserToGroup(c *gin.Context) {
|
|||||||
for _, v := range RpcResp.Id2ResultList {
|
for _, v := range RpcResp.Id2ResultList {
|
||||||
resp.UserIDResultList = append(resp.UserIDResultList, api.UserIDResult{UserID: v.UserID, Result: v.Result})
|
resp.UserIDResultList = append(resp.UserIDResultList, api.UserIDResult{UserID: v.UserID, Result: v.Result})
|
||||||
}
|
}
|
||||||
c.JSON(http.StatusOK, resp)
|
|
||||||
|
if len(resp.UserIDResultList) == 0 {
|
||||||
|
resp.UserIDResultList = []api.UserIDResult{}
|
||||||
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "InviteUserToGroup api return ", resp)
|
log.NewInfo(req.OperationID, "InviteUserToGroup api return ", resp)
|
||||||
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateGroup(c *gin.Context) {
|
func CreateGroup(c *gin.Context) {
|
||||||
|
@ -28,7 +28,8 @@ type GetGroupMembersInfoReq struct {
|
|||||||
}
|
}
|
||||||
type GetGroupMembersInfoResp struct {
|
type GetGroupMembersInfoResp struct {
|
||||||
CommResp
|
CommResp
|
||||||
Data []*open_im_sdk.GroupMemberFullInfo `json:"data"`
|
MemberList []*open_im_sdk.GroupMemberFullInfo
|
||||||
|
Data []map[string]interface{} `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type InviteUserToGroupReq struct {
|
type InviteUserToGroupReq struct {
|
||||||
@ -48,7 +49,8 @@ type GetJoinedGroupListReq struct {
|
|||||||
}
|
}
|
||||||
type GetJoinedGroupListResp struct {
|
type GetJoinedGroupListResp struct {
|
||||||
CommResp
|
CommResp
|
||||||
GroupInfoList []*open_im_sdk.GroupInfo `json:"data"`
|
GroupInfoList []*open_im_sdk.GroupInfo
|
||||||
|
Data []map[string]interface{} `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetGroupMemberListReq struct {
|
type GetGroupMemberListReq struct {
|
||||||
@ -59,8 +61,9 @@ type GetGroupMemberListReq struct {
|
|||||||
}
|
}
|
||||||
type GetGroupMemberListResp struct {
|
type GetGroupMemberListResp struct {
|
||||||
CommResp
|
CommResp
|
||||||
NextSeq int32 `json:"nextSeq"`
|
NextSeq int32 `json:"nextSeq"`
|
||||||
MemberList []*open_im_sdk.GroupMemberFullInfo `json:"data"`
|
MemberList []*open_im_sdk.GroupMemberFullInfo
|
||||||
|
Data []map[string]interface{} `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetGroupAllMemberReq struct {
|
type GetGroupAllMemberReq struct {
|
||||||
@ -71,7 +74,7 @@ type GetGroupAllMemberResp struct {
|
|||||||
CommResp
|
CommResp
|
||||||
MemberList []*open_im_sdk.GroupMemberFullInfo
|
MemberList []*open_im_sdk.GroupMemberFullInfo
|
||||||
|
|
||||||
Test []map[string]interface{} `json:"data"`
|
Data []map[string]interface{} `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateGroupReq struct {
|
type CreateGroupReq struct {
|
||||||
@ -93,7 +96,8 @@ type GetGroupApplicationListReq struct {
|
|||||||
}
|
}
|
||||||
type GetGroupApplicationListResp struct {
|
type GetGroupApplicationListResp struct {
|
||||||
CommResp
|
CommResp
|
||||||
GroupRequestList []*open_im_sdk.GroupRequest `json:"data"`
|
GroupRequestList []*open_im_sdk.GroupRequest
|
||||||
|
Data []map[string]interface{} `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetGroupInfoReq struct {
|
type GetGroupInfoReq struct {
|
||||||
@ -102,7 +106,8 @@ type GetGroupInfoReq struct {
|
|||||||
}
|
}
|
||||||
type GetGroupInfoResp struct {
|
type GetGroupInfoResp struct {
|
||||||
CommResp
|
CommResp
|
||||||
GroupInfoList []*open_im_sdk.GroupInfo `json:"data"`
|
GroupInfoList []*open_im_sdk.GroupInfo
|
||||||
|
Data []map[string]interface{} `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ApplicationGroupResponseReq struct {
|
type ApplicationGroupResponseReq struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user