Refactor code

This commit is contained in:
wenxu12345 2021-12-29 14:57:36 +08:00
parent 669ea69357
commit fb7c4114c1
3 changed files with 8 additions and 3 deletions

View File

@ -40,7 +40,7 @@ func main() {
friendRouterGroup.POST("/remove_blacklist", friend.RemoveBlacklist) friendRouterGroup.POST("/remove_blacklist", friend.RemoveBlacklist)
friendRouterGroup.POST("/delete_friend", friend.DeleteFriend) friendRouterGroup.POST("/delete_friend", friend.DeleteFriend)
friendRouterGroup.POST("/add_friend_response", friend.AddFriendResponse) //1 friendRouterGroup.POST("/add_friend_response", friend.AddFriendResponse) //1
friendRouterGroup.POST("/set_friend_remark", friend.SetFriendRemark) friendRouterGroup.POST("/set_friend_remark", friend.SetFriendRemark) //1
friendRouterGroup.POST("/is_friend", friend.IsFriend) friendRouterGroup.POST("/is_friend", friend.IsFriend)
friendRouterGroup.POST("/import_friend", friend.ImportFriend) friendRouterGroup.POST("/import_friend", friend.ImportFriend)
} }

View File

@ -305,7 +305,9 @@ func IsFriend(c *gin.Context) {
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add friend rpc server failed"}) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add friend rpc server failed"})
return return
} }
resp := api.IsFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, Response: RpcResp.Response} resp := api.IsFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
resp.Response.Friend = RpcResp.Response
log.NewInfo(req.CommID.OperationID, "IsFriend api return ", resp) log.NewInfo(req.CommID.OperationID, "IsFriend api return ", resp)
c.JSON(http.StatusOK, resp) c.JSON(http.StatusOK, resp)
} }

View File

@ -89,9 +89,12 @@ type RemoveBlackListResp struct {
type IsFriendReq struct { type IsFriendReq struct {
ParamsCommFriend ParamsCommFriend
} }
type Response struct {
Friend bool `json:"isFriend"`
}
type IsFriendResp struct { type IsFriendResp struct {
CommResp CommResp
Response bool `json:"response"` Response Response `json:"data"`
} }
type GetFriendsInfoReq struct { type GetFriendsInfoReq struct {