mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-25 11:06:43 +08:00
Refactor code
This commit is contained in:
parent
d132e53c06
commit
28d9304ec6
@ -115,13 +115,12 @@ func GetSelfUserInfo(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if len(RpcResp.UserInfoList) == 1 {
|
if len(RpcResp.UserInfoList) == 1 {
|
||||||
resp := api.GetSelfUserInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, UserInfoList: RpcResp.UserInfoList[0]}
|
resp := api.GetSelfUserInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, UserInfo: RpcResp.UserInfoList[0]}
|
||||||
resp.Data = jsonData.JsonDataList(resp.UserInfoList)
|
resp.Data = jsonData.JsonDataOne(resp.UserInfo)
|
||||||
log.NewInfo(req.OperationID, "GetUserInfo api return ", resp)
|
log.NewInfo(req.OperationID, "GetUserInfo api return ", resp)
|
||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
} else {
|
} else {
|
||||||
resp := api.GetSelfUserInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}}
|
resp := api.GetSelfUserInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}}
|
||||||
resp.Data = jsonData.JsonDataList(resp.UserInfoList)
|
|
||||||
log.NewInfo(req.OperationID, "GetUserInfo api return ", resp)
|
log.NewInfo(req.OperationID, "GetUserInfo api return ", resp)
|
||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,6 @@ type GetSelfUserInfoReq struct {
|
|||||||
}
|
}
|
||||||
type GetSelfUserInfoResp struct {
|
type GetSelfUserInfoResp struct {
|
||||||
CommResp
|
CommResp
|
||||||
UserInfoList *open_im_sdk.UserInfo `json:"-"`
|
UserInfo *open_im_sdk.UserInfo `json:"-"`
|
||||||
Data []map[string]interface{} `json:"data"`
|
Data map[string]interface{} `json:"data"`
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user