diff --git a/cmd/open_im_api/main.go b/cmd/open_im_api/main.go index edb44e5dd..6135ee3f0 100644 --- a/cmd/open_im_api/main.go +++ b/cmd/open_im_api/main.go @@ -40,7 +40,7 @@ func main() { friendRouterGroup.POST("/remove_blacklist", friend.RemoveBlacklist) friendRouterGroup.POST("/delete_friend", friend.DeleteFriend) 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("/import_friend", friend.ImportFriend) } diff --git a/internal/api/friend/friend.go b/internal/api/friend/friend.go index 9728eeb2b..1a27effb9 100644 --- a/internal/api/friend/friend.go +++ b/internal/api/friend/friend.go @@ -305,7 +305,9 @@ func IsFriend(c *gin.Context) { c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add friend rpc server failed"}) 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) c.JSON(http.StatusOK, resp) } diff --git a/pkg/base_info/friend_api_struct.go b/pkg/base_info/friend_api_struct.go index 361d54bd6..5d7f33d27 100644 --- a/pkg/base_info/friend_api_struct.go +++ b/pkg/base_info/friend_api_struct.go @@ -89,9 +89,12 @@ type RemoveBlackListResp struct { type IsFriendReq struct { ParamsCommFriend } +type Response struct { + Friend bool `json:"isFriend"` +} type IsFriendResp struct { CommResp - Response bool `json:"response"` + Response Response `json:"data"` } type GetFriendsInfoReq struct {