diff --git a/cmd/open_im_api/main.go b/cmd/open_im_api/main.go index 2622bdfdf..717f87b33 100644 --- a/cmd/open_im_api/main.go +++ b/cmd/open_im_api/main.go @@ -3,14 +3,12 @@ package main import ( _ "Open_IM/cmd/open_im_api/docs" apiAuth "Open_IM/internal/api/auth" - clientInit "Open_IM/internal/api/client_init" "Open_IM/internal/api/conversation" "Open_IM/internal/api/friend" "Open_IM/internal/api/group" "Open_IM/internal/api/manage" apiChat "Open_IM/internal/api/msg" "Open_IM/internal/api/office" - "Open_IM/internal/api/organization" apiThird "Open_IM/internal/api/third" "Open_IM/internal/api/user" "Open_IM/pkg/common/config" @@ -81,17 +79,17 @@ func main() { friendRouterGroup := r.Group("/friend") { // friendRouterGroup.POST("/get_friends_info", friend.GetFriendsInfo) - friendRouterGroup.POST("/add_friend", friend.AddFriend) //1 - friendRouterGroup.POST("/delete_friend", friend.DeleteFriend) //1 - friendRouterGroup.POST("/get_friend_apply_list", friend.GetFriendApplyList) //1 - friendRouterGroup.POST("/get_self_friend_apply_list", friend.GetSelfFriendApplyList) //1 - friendRouterGroup.POST("/get_friend_list", friend.GetFriendList) //1 - friendRouterGroup.POST("/add_friend_response", friend.AddFriendResponse) //1 - friendRouterGroup.POST("/set_friend_remark", friend.SetFriendRemark) //1 + friendRouterGroup.POST("/add_friend", friend.AddFriend) //1 + friendRouterGroup.POST("/delete_friend", friend.DeleteFriend) //1 + friendRouterGroup.POST("/get_friend_apply_list", friend.GetFriendApplyList) //1 + friendRouterGroup.POST("/get_self_friend_apply_list", friend.GetSelfApplyList) //1 + friendRouterGroup.POST("/get_friend_list", friend.GetFriendList) //1 + friendRouterGroup.POST("/add_friend_response", friend.AddFriendResponse) //1 + friendRouterGroup.POST("/set_friend_remark", friend.SetFriendRemark) //1 - friendRouterGroup.POST("/add_black", friend.AddBlack) //1 - friendRouterGroup.POST("/get_black_list", friend.GetBlacklist) //1 - friendRouterGroup.POST("/remove_black", friend.RemoveBlack) //1 + friendRouterGroup.POST("/add_black", friend.AddBlack) //1 + friendRouterGroup.POST("/get_black_list", friend.GetBlacklist) //1 + friendRouterGroup.POST("/remove_black", friend.RemoveBlacklist) //1 friendRouterGroup.POST("/import_friend", friend.ImportFriend) //1 friendRouterGroup.POST("/is_friend", friend.IsFriend) //1 diff --git a/internal/api/friend/friend.go b/internal/api/friend/friend.go index 4282fe56b..7c4ca05d6 100644 --- a/internal/api/friend/friend.go +++ b/internal/api/friend/friend.go @@ -1,678 +1,678 @@ package friend -import ( - jsonData "Open_IM/internal/utils" - api "Open_IM/pkg/base_info" - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/common/token_verify" - "Open_IM/pkg/getcdv3" - rpc "Open_IM/pkg/proto/friend" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" - "Open_IM/pkg/utils" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -// @Summary 添加黑名单 -// @Description 添加黑名单 -// @Tags 好友相关 -// @ID AddBlack -// @Accept json -// @Param token header string true "im token" -// @Param req body api.AddBlacklistReq true "fromUserID为设置的用户
toUserID为被设置的用户" -// @Produce json -// @Success 0 {object} api.AddBlacklistResp -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/add_black [post] -func AddBlack(c *gin.Context) { - params := api.AddBlacklistReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.AddBlacklistReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms) - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - log.NewInfo(params.OperationID, "AddBlacklist args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.AddBlacklist(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "AddBlacklist failed ", err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add blacklist rpc server failed"}) - return - } - resp := api.AddBlacklistResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} - log.NewInfo(req.CommID.OperationID, "AddBlacklist api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 批量加好友 -// @Description 批量加好友 -// @Tags 好友相关 -// @ID ImportFriend -// @Accept json -// @Param token header string true "im token" -// @Param req body api.ImportFriendReq true "fromUserID批量加好友的用户ID
friendUserIDList为" -// @Produce json -// @Success 0 {object} api.ImportFriendResp "data列表中对象的result-1为添加该用户失败
0为成功" -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/import_friend [post] -func ImportFriend(c *gin.Context) { - params := api.ImportFriendReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.ImportFriendReq{} - utils.CopyStructFields(req, ¶ms) - var ok bool - var errInfo string - ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID) - if !ok { - errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - log.NewInfo(req.OperationID, "ImportFriend args ", req.String()) - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.OperationID) - if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.ImportFriend(context.Background(), req) - if err != nil { - log.NewError(req.OperationID, "ImportFriend failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "ImportFriend failed "}) - return - } - resp := api.ImportFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} - if resp.ErrCode == 0 { - for _, v := range RpcResp.UserIDResultList { - resp.UserIDResultList = append(resp.UserIDResultList, api.UserIDResult{UserID: v.UserID, Result: v.Result}) - } - } - if len(resp.UserIDResultList) == 0 { - resp.UserIDResultList = []api.UserIDResult{} - } - log.NewInfo(req.OperationID, "ImportFriend api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 添加好友 -// @Description 添加好友 -// @Tags 好友相关 -// @ID AddFriend -// @Accept json -// @Param token header string true "im token" -// @Param req body api.AddFriendReq true "reqMsg为申请信息
fromUserID为申请用户
toUserID为被添加用户" -// @Produce json -// @Success 0 {object} api.AddFriendResp -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/add_friend [post] -func AddFriend(c *gin.Context) { - params := api.AddFriendReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.AddFriendReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) - req.ReqMsg = params.ReqMsg - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg}) - return - } - - log.NewInfo(req.CommID.OperationID, "AddFriend args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.AddFriend(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "AddFriend failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call AddFriend rpc server failed"}) - return - } - - resp := api.AddFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} - log.NewInfo(req.CommID.OperationID, "AddFriend api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 同意/拒绝好友请求 -// @Description 同意/拒绝好友请求 -// @Tags 好友相关 -// @ID AddFriendResponse -// @Accept json -// @Param token header string true "im token" -// @Param req body api.AddFriendResponseReq true "fromUserID同意/拒绝的用户ID
toUserID为申请用户D
handleMsg为处理信息
flag为具体操作, 1为同意, 2为拒绝" -// @Produce json -// @Success 0 {object} api.AddFriendResponseResp -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/add_friend_response [post] -func AddFriendResponse(c *gin.Context) { - params := api.AddFriendResponseReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.AddFriendResponseReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) - req.HandleMsg = params.HandleMsg - req.HandleResult = params.Flag - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg}) - return - } - - utils.CopyStructFields(req, ¶ms) - log.NewInfo(req.CommID.OperationID, "AddFriendResponse args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.AddFriendResponse(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "AddFriendResponse failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add_friend_response rpc server failed"}) - return - } - - resp := api.AddFriendResponseResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} - log.NewInfo(req.CommID.OperationID, "AddFriendResponse api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 删除好友 -// @Description 删除好友 -// @Tags 好友相关 -// @ID DeleteFriend -// @Accept json -// @Param token header string true "im token" -// @Param req body api.DeleteFriendReq true "fromUserID为操作用户
toUserID为被删除用户" -// @Produce json -// @Success 0 {object} api.DeleteFriendResp -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/delete_friend [post] -func DeleteFriend(c *gin.Context) { - params := api.DeleteFriendReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.DeleteFriendReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - log.NewInfo(req.CommID.OperationID, "DeleteFriend args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.DeleteFriend(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "DeleteFriend failed ", err, req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call delete_friend rpc server failed"}) - return - } - - resp := api.DeleteFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} - log.NewInfo(req.CommID.OperationID, "DeleteFriend api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 获取黑名单列表 -// @Description 获取黑名单列表 -// @Tags 好友相关 -// @ID GetBlacklist -// @Accept json -// @Param token header string true "im token" -// @Param req body api.GetBlackListReq true "fromUserID要获取黑名单的用户" -// @Produce json -// @Success 0 {object} api.GetBlackListResp{data=[]open_im_sdk.PublicUserInfo} -// @Failure 500 {object} api.Swagger400Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger500Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/get_black_list [post] -func GetBlacklist(c *gin.Context) { - params := api.GetBlackListReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.GetBlacklistReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms) - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - log.NewInfo(req.CommID.OperationID, "GetBlacklist args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.GetBlacklist(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "GetBlacklist failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get blacklist rpc server failed"}) - return - } - - resp := api.GetBlackListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} - for _, v := range RpcResp.BlackUserInfoList { - black := open_im_sdk.PublicUserInfo{} - utils.CopyStructFields(&black, v) - resp.BlackUserInfoList = append(resp.BlackUserInfoList, &black) - } - resp.Data = jsonData.JsonDataList(resp.BlackUserInfoList) - log.NewInfo(req.CommID.OperationID, "GetBlacklist api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 设置好友备注 -// @Description 设置好友备注 -// @Tags 好友相关 -// @ID SetFriendRemark -// @Accept json -// @Param token header string true "im token" -// @Param req body api.SetFriendRemarkReq true "fromUserID为设置的用户
toUserID为被设置的用户
remark为好友备注" -// @Produce json -// @Success 0 {object} api.SetFriendRemarkResp -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/set_friend_remark [post] -func SetFriendRemark(c *gin.Context) { - params := api.SetFriendRemarkReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.SetFriendRemarkReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) - req.Remark = params.Remark - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - log.NewInfo(req.CommID.OperationID, "SetFriendComment args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.SetFriendRemark(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "SetFriendComment failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call set friend comment rpc server failed"}) - return - } - resp := api.SetFriendRemarkResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} - - log.NewInfo(req.CommID.OperationID, "SetFriendComment api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 把用户移除黑名单 -// @Description 把用户移除黑名单 -// @Tags 好友相关 -// @ID RemoveBlack -// @Accept json -// @Param token header string true "im token" -// @Param req body api.RemoveBlackListReq true "fromUserID要获取黑名单的用户" -// @Produce json -// @Success 0 {object} api.RemoveBlackListResp -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/remove_black [post] -func RemoveBlack(c *gin.Context) { - params := api.RemoveBlackListReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.RemoveBlacklistReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - log.NewInfo(req.CommID.OperationID, "RemoveBlacklist args ", req.String()) - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.RemoveBlacklist(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "RemoveBlacklist failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call remove blacklist rpc server failed"}) - return - } - resp := api.RemoveBlackListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} - log.NewInfo(req.CommID.OperationID, "RemoveBlacklist api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 检查用户之间是否为好友 -// @Description 检查用户之间是否为好友 -// @Tags 好友相关 -// @ID IsFriend -// @Accept json -// @Param token header string true "im token" -// @Param req body api.IsFriendReq true "fromUserID为请求用户
toUserID为要检查的用户" -// @Produce json -// @Success 0 {object} api.IsFriendResp -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/is_friend [post] -func IsFriend(c *gin.Context) { - params := api.IsFriendReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.IsFriendReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg}) - return - } - - log.NewInfo(req.CommID.OperationID, "IsFriend args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.IsFriend(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "IsFriend failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add friend rpc server failed"}) - return - } - resp := api.IsFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} - resp.Response.Friend = RpcResp.Response - - log.NewInfo(req.CommID.OperationID, "IsFriend api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 获取用户的好友列表 -// @Description 获取用户的好友列表 -// @Tags 好友相关 -// @ID GetFriendList -// @Accept json -// @Param token header string true "im token" -// @Param req body api.GetFriendListReq true "fromUserID为要获取好友列表的用户ID" -// @Produce json -// @Success 0 {object} api.GetFriendListResp{data=[]open_im_sdk.FriendInfo} -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/get_friend_list [post] -func GetFriendList(c *gin.Context) { - params := api.GetFriendListReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.GetFriendListReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms) - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - log.NewInfo(req.CommID.OperationID, "GetFriendList args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.GetFriendList(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "GetFriendList failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get friend list rpc server failed"}) - return - } - - resp := api.GetFriendListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, FriendInfoList: RpcResp.FriendInfoList} - resp.Data = jsonData.JsonDataList(resp.FriendInfoList) - log.NewInfo(req.CommID.OperationID, "GetFriendList api return ", resp) - c.JSON(http.StatusOK, resp) - //c.JSON(http.StatusOK, resp) -} - -// @Summary 获取好友申请列表 -// @Description 删除好友 -// @Tags 好友相关 -// @ID GetFriendApplyList -// @Accept json -// @Param token header string true "im token" -// @Param req body api.GetFriendApplyListReq true "fromUserID为要获取申请列表的用户ID" -// @Produce json -// @Success 0 {object} api.GetFriendApplyListResp{data=[]open_im_sdk.FriendRequest} -// @Failure 500 {object} api.Swagger400Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/get_friend_apply_list [post] -func GetFriendApplyList(c *gin.Context) { - params := api.GetFriendApplyListReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.GetFriendApplyListReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms) - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - log.NewInfo(req.CommID.OperationID, "GetFriendApplyList args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - client := rpc.NewFriendClient(etcdConn) - - RpcResp, err := client.GetFriendApplyList(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "GetFriendApplyList failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get friend apply list rpc server failed"}) - return - } - - resp := api.GetFriendApplyListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, FriendRequestList: RpcResp.FriendRequestList} - resp.Data = jsonData.JsonDataList(resp.FriendRequestList) - log.NewInfo(req.CommID.OperationID, "GetFriendApplyList api return ", resp) - c.JSON(http.StatusOK, resp) -} - -// @Summary 获取自己的好友申请列表 -// @Description 获取自己的好友申请列表 -// @Tags 好友相关 -// @ID GetSelfFriendApplyList -// @Accept json -// @Param token header string true "im token" -// @Param req body api.GetSelfApplyListReq true "fromUserID为自己的用户ID" -// @Produce json -// @Success 0 {object} api.GetSelfApplyListResp{data=[]open_im_sdk.FriendRequest} -// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" -// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" -// @Router /friend/get_self_friend_apply_list [post] -func GetSelfFriendApplyList(c *gin.Context) { - params := api.GetSelfApplyListReq{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError("0", "BindJSON failed ", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &rpc.GetSelfApplyListReq{CommID: &rpc.CommID{}} - utils.CopyStructFields(req.CommID, ¶ms) - - var ok bool - var errInfo string - ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) - if !ok { - errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - - log.NewInfo(req.CommID.OperationID, "GetSelfApplyList args ", req.String()) - - etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) - if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.CommID.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) - return - } - client := rpc.NewFriendClient(etcdConn) - RpcResp, err := client.GetSelfApplyList(context.Background(), req) - if err != nil { - log.NewError(req.CommID.OperationID, "GetSelfApplyList failed ", err.Error(), req.String()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get self apply list rpc server failed"}) - return - } - resp := api.GetSelfApplyListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, FriendRequestList: RpcResp.FriendRequestList} - resp.Data = jsonData.JsonDataList(resp.FriendRequestList) - log.NewInfo(req.CommID.OperationID, "GetSelfApplyList api return ", resp) - c.JSON(http.StatusOK, resp) -} +//import ( +// jsonData "Open_IM/internal/utils" +// api "Open_IM/pkg/base_info" +// "Open_IM/pkg/common/config" +// "Open_IM/pkg/common/log" +// "Open_IM/pkg/common/token_verify" +// "Open_IM/pkg/getcdv3" +// rpc "Open_IM/pkg/proto/friend" +// open_im_sdk "Open_IM/pkg/proto/sdk_ws" +// "Open_IM/pkg/utils" +// "context" +// "github.com/gin-gonic/gin" +// "net/http" +// "strings" +//) +// +//// @Summary 添加黑名单 +//// @Description 添加黑名单 +//// @Tags 好友相关 +//// @ID AddBlack +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.AddBlacklistReq true "fromUserID为设置的用户
toUserID为被设置的用户" +//// @Produce json +//// @Success 0 {object} api.AddBlacklistResp +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/add_black [post] +//func AddBlack(c *gin.Context) { +// params := api.AddBlacklistReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.AddBlacklistReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms) +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// log.NewInfo(params.OperationID, "AddBlacklist args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.AddBlacklist(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "AddBlacklist failed ", err.Error()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add blacklist rpc server failed"}) +// return +// } +// resp := api.AddBlacklistResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} +// log.NewInfo(req.CommID.OperationID, "AddBlacklist api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 批量加好友 +//// @Description 批量加好友 +//// @Tags 好友相关 +//// @ID ImportFriend +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.ImportFriendReq true "fromUserID批量加好友的用户ID
friendUserIDList为" +//// @Produce json +//// @Success 0 {object} api.ImportFriendResp "data列表中对象的result-1为添加该用户失败
0为成功" +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/import_friend [post] +//func ImportFriend(c *gin.Context) { +// params := api.ImportFriendReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.ImportFriendReq{} +// utils.CopyStructFields(req, ¶ms) +// var ok bool +// var errInfo string +// ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID) +// if !ok { +// errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.OperationID, "ImportFriend args ", req.String()) +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.OperationID) +// if etcdConn == nil { +// errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.ImportFriend(context.Background(), req) +// if err != nil { +// log.NewError(req.OperationID, "ImportFriend failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "ImportFriend failed "}) +// return +// } +// resp := api.ImportFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} +// if resp.ErrCode == 0 { +// for _, v := range RpcResp.UserIDResultList { +// resp.UserIDResultList = append(resp.UserIDResultList, api.UserIDResult{UserID: v.UserID, Result: v.Result}) +// } +// } +// if len(resp.UserIDResultList) == 0 { +// resp.UserIDResultList = []api.UserIDResult{} +// } +// log.NewInfo(req.OperationID, "ImportFriend api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 添加好友 +//// @Description 添加好友 +//// @Tags 好友相关 +//// @ID AddFriend +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.AddFriendReq true "reqMsg为申请信息
fromUserID为申请用户
toUserID为被添加用户" +//// @Produce json +//// @Success 0 {object} api.AddFriendResp +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/add_friend [post] +//func AddFriend(c *gin.Context) { +// params := api.AddFriendReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.AddFriendReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) +// req.ReqMsg = params.ReqMsg +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.CommID.OperationID, "AddFriend args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.AddFriend(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "AddFriend failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call AddFriend rpc server failed"}) +// return +// } +// +// resp := api.AddFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} +// log.NewInfo(req.CommID.OperationID, "AddFriend api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 同意/拒绝好友请求 +//// @Description 同意/拒绝好友请求 +//// @Tags 好友相关 +//// @ID AddFriendResponse +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.AddFriendResponseReq true "fromUserID同意/拒绝的用户ID
toUserID为申请用户D
handleMsg为处理信息
flag为具体操作, 1为同意, 2为拒绝" +//// @Produce json +//// @Success 0 {object} api.AddFriendResponseResp +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/add_friend_response [post] +//func AddFriendResponse(c *gin.Context) { +// params := api.AddFriendResponseReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.AddFriendResponseReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) +// req.HandleMsg = params.HandleMsg +// req.HandleResult = params.Flag +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg}) +// return +// } +// +// utils.CopyStructFields(req, ¶ms) +// log.NewInfo(req.CommID.OperationID, "AddFriendResponse args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.AddFriendResponse(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "AddFriendResponse failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add_friend_response rpc server failed"}) +// return +// } +// +// resp := api.AddFriendResponseResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} +// log.NewInfo(req.CommID.OperationID, "AddFriendResponse api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 删除好友 +//// @Description 删除好友 +//// @Tags 好友相关 +//// @ID DeleteFriend +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.DeleteFriendReq true "fromUserID为操作用户
toUserID为被删除用户" +//// @Produce json +//// @Success 0 {object} api.DeleteFriendResp +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/delete_friend [post] +//func DeleteFriend(c *gin.Context) { +// params := api.DeleteFriendReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.DeleteFriendReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.CommID.OperationID, "DeleteFriend args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.DeleteFriend(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "DeleteFriend failed ", err, req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call delete_friend rpc server failed"}) +// return +// } +// +// resp := api.DeleteFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} +// log.NewInfo(req.CommID.OperationID, "DeleteFriend api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 获取黑名单列表 +//// @Description 获取黑名单列表 +//// @Tags 好友相关 +//// @ID GetBlacklist +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.GetBlackListReq true "fromUserID要获取黑名单的用户" +//// @Produce json +//// @Success 0 {object} api.GetBlackListResp{data=[]open_im_sdk.PublicUserInfo} +//// @Failure 500 {object} api.Swagger400Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger500Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/get_black_list [post] +//func GetBlacklist(c *gin.Context) { +// params := api.GetBlackListReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.GetBlacklistReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms) +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.CommID.OperationID, "GetBlacklist args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.GetBlacklist(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "GetBlacklist failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get blacklist rpc server failed"}) +// return +// } +// +// resp := api.GetBlackListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} +// for _, v := range RpcResp.BlackUserInfoList { +// black := open_im_sdk.PublicUserInfo{} +// utils.CopyStructFields(&black, v) +// resp.BlackUserInfoList = append(resp.BlackUserInfoList, &black) +// } +// resp.Data = jsonData.JsonDataList(resp.BlackUserInfoList) +// log.NewInfo(req.CommID.OperationID, "GetBlacklist api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 设置好友备注 +//// @Description 设置好友备注 +//// @Tags 好友相关 +//// @ID SetFriendRemark +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.SetFriendRemarkReq true "fromUserID为设置的用户
toUserID为被设置的用户
remark为好友备注" +//// @Produce json +//// @Success 0 {object} api.SetFriendRemarkResp +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/set_friend_remark [post] +//func SetFriendRemark(c *gin.Context) { +// params := api.SetFriendRemarkReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.SetFriendRemarkReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) +// req.Remark = params.Remark +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.CommID.OperationID, "SetFriendComment args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.SetFriendRemark(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "SetFriendComment failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call set friend comment rpc server failed"}) +// return +// } +// resp := api.SetFriendRemarkResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} +// +// log.NewInfo(req.CommID.OperationID, "SetFriendComment api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 把用户移除黑名单 +//// @Description 把用户移除黑名单 +//// @Tags 好友相关 +//// @ID RemoveBlacklist +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.RemoveBlackListReq true "fromUserID要获取黑名单的用户" +//// @Produce json +//// @Success 0 {object} api.RemoveBlackListResp +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/remove_black [post] +//func RemoveBlacklist(c *gin.Context) { +// params := api.RemoveBlackListReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.RemoveBlacklistReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.CommID.OperationID, "RemoveBlacklist args ", req.String()) +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.RemoveBlacklist(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "RemoveBlacklist failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call remove blacklist rpc server failed"}) +// return +// } +// resp := api.RemoveBlackListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} +// log.NewInfo(req.CommID.OperationID, "RemoveBlacklist api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 检查用户之间是否为好友 +//// @Description 检查用户之间是否为好友 +//// @Tags 好友相关 +//// @ID IsFriend +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.IsFriendReq true "fromUserID为请求用户
toUserID为要检查的用户" +//// @Produce json +//// @Success 0 {object} api.IsFriendResp +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/is_friend [post] +//func IsFriend(c *gin.Context) { +// params := api.IsFriendReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.IsFriendReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.CommID.OperationID, "IsFriend args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.IsFriend(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "IsFriend failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add friend rpc server failed"}) +// return +// } +// resp := api.IsFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} +// resp.Response.Friend = RpcResp.Response +// +// log.NewInfo(req.CommID.OperationID, "IsFriend api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 获取用户的好友列表 +//// @Description 获取用户的好友列表 +//// @Tags 好友相关 +//// @ID GetFriendList +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.GetFriendListReq true "fromUserID为要获取好友列表的用户ID" +//// @Produce json +//// @Success 0 {object} api.GetFriendListResp{data=[]open_im_sdk.FriendInfo} +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/get_friend_list [post] +//func GetFriendList(c *gin.Context) { +// params := api.GetFriendListReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.GetFriendListReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms) +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.CommID.OperationID, "GetFriendList args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.GetFriendList(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "GetFriendList failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get friend list rpc server failed"}) +// return +// } +// +// resp := api.GetFriendListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, FriendInfoList: RpcResp.FriendInfoList} +// resp.Data = jsonData.JsonDataList(resp.FriendInfoList) +// log.NewInfo(req.CommID.OperationID, "GetFriendList api return ", resp) +// c.JSON(http.StatusOK, resp) +// //c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 获取好友申请列表 +//// @Description 删除好友 +//// @Tags 好友相关 +//// @ID GetFriendApplyList +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.GetFriendApplyListReq true "fromUserID为要获取申请列表的用户ID" +//// @Produce json +//// @Success 0 {object} api.GetFriendApplyListResp{data=[]open_im_sdk.FriendRequest} +//// @Failure 500 {object} api.Swagger400Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/get_friend_apply_list [post] +//func GetFriendApplyList(c *gin.Context) { +// params := api.GetFriendApplyListReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.GetFriendApplyListReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms) +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.CommID.OperationID, "GetFriendApplyList args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// client := rpc.NewFriendClient(etcdConn) +// +// RpcResp, err := client.GetFriendApplyList(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "GetFriendApplyList failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get friend apply list rpc server failed"}) +// return +// } +// +// resp := api.GetFriendApplyListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, FriendRequestList: RpcResp.FriendRequestList} +// resp.Data = jsonData.JsonDataList(resp.FriendRequestList) +// log.NewInfo(req.CommID.OperationID, "GetFriendApplyList api return ", resp) +// c.JSON(http.StatusOK, resp) +//} +// +//// @Summary 获取自己的好友申请列表 +//// @Description 获取自己的好友申请列表 +//// @Tags 好友相关 +//// @ID GetSelfApplyList +//// @Accept json +//// @Param token header string true "im token" +//// @Param req body api.GetSelfApplyListReq true "fromUserID为自己的用户ID" +//// @Produce json +//// @Success 0 {object} api.GetSelfApplyListResp{data=[]open_im_sdk.FriendRequest} +//// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误" +//// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等" +//// @Router /friend/get_self_friend_apply_list [post] +//func GetSelfApplyList(c *gin.Context) { +// params := api.GetSelfApplyListReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.GetSelfApplyListReq{CommID: &rpc.CommID{}} +// utils.CopyStructFields(req.CommID, ¶ms) +// +// var ok bool +// var errInfo string +// ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID) +// if !ok { +// errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token") +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// +// log.NewInfo(req.CommID.OperationID, "GetSelfApplyList args ", req.String()) +// +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) +// if etcdConn == nil { +// errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" +// log.NewError(req.CommID.OperationID, errMsg) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) +// return +// } +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.GetSelfApplyList(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "GetSelfApplyList failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get self apply list rpc server failed"}) +// return +// } +// resp := api.GetSelfApplyListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, FriendRequestList: RpcResp.FriendRequestList} +// resp.Data = jsonData.JsonDataList(resp.FriendRequestList) +// log.NewInfo(req.CommID.OperationID, "GetSelfApplyList api return ", resp) +// c.JSON(http.StatusOK, resp) +//} diff --git a/internal/api/friend/friend1.go b/internal/api/friend/friend1.go index 0eb2ca79a..f4fdf9bb1 100644 --- a/internal/api/friend/friend1.go +++ b/internal/api/friend/friend1.go @@ -5,27 +5,53 @@ import ( api "Open_IM/pkg/base_info" "Open_IM/pkg/common/config" rpc "Open_IM/pkg/proto/friend" - "Open_IM/pkg/utils" "github.com/gin-gonic/gin" ) -// 不一致 -func AddBlacklist(c *gin.Context) { - common.ApiToRpc(c, &api.AddBlacklistReq{}, &api.AddBlacklistResp{}, - config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName()) +func AddBlack(c *gin.Context) { + common.ApiToRpc(c, &api.AddBlacklistReq{}, &api.AddBlacklistResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") } -func ImportFriend1(c *gin.Context) { - common.ApiToRpc(c, &api.ImportFriendReq{}, &api.ImportFriendResp{}, - config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName()) +func ImportFriend(c *gin.Context) { + common.ApiToRpc(c, &api.ImportFriendReq{}, &api.ImportFriendResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") } -func AddFriend1(c *gin.Context) { - common.ApiToRpc(c, &api.AddFriendReq{}, &api.AddFriendResp{}, - config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName()) +func AddFriend(c *gin.Context) { + common.ApiToRpc(c, &api.AddFriendReq{}, &api.AddFriendResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") } -func AddFriendResponse1(c *gin.Context) { - common.ApiToRpc(c, &api.AddFriendResponseReq{}, &api.AddFriendResponseResp{}, - config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName()) +func AddFriendResponse(c *gin.Context) { + common.ApiToRpc(c, &api.AddFriendResponseReq{}, &api.AddFriendResponseResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") +} + +func DeleteFriend(c *gin.Context) { + common.ApiToRpc(c, &api.DeleteFriendReq{}, &api.DeleteFriendResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") +} + +func GetBlacklist(c *gin.Context) { + common.ApiToRpc(c, &api.GetBlackListReq{}, &api.GetBlackListResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") +} + +func SetFriendRemark(c *gin.Context) { + common.ApiToRpc(c, &api.SetFriendRemarkReq{}, &api.SetFriendRemarkResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") +} + +func RemoveBlacklist(c *gin.Context) { + common.ApiToRpc(c, &api.RemoveBlacklistReq{}, &api.RemoveBlacklistResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") +} + +func IsFriend(c *gin.Context) { + common.ApiToRpc(c, &api.IsFriendReq{}, &api.IsFriendResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") +} + +func GetFriendList(c *gin.Context) { + common.ApiToRpc(c, &api.GetFriendListReq{}, &api.GetFriendListResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") +} + +func GetFriendApplyList(c *gin.Context) { + common.ApiToRpc(c, &api.GetFriendApplyListReq{}, &api.GetFriendApplyListResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") +} + +func GetSelfApplyList(c *gin.Context) { + common.ApiToRpc(c, &api.GetSelfApplyListReq{}, &api.GetSelfApplyListResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, "") } diff --git a/internal/api_to_rpc/api.go b/internal/api_to_rpc/api.go index f7d0fc506..c066546ab 100644 --- a/internal/api_to_rpc/api.go +++ b/internal/api_to_rpc/api.go @@ -11,11 +11,10 @@ import ( "reflect" ) -//func a(c *gin.Context) { -// ApiToRpc(c, &api.AddBlacklistReq{}, &api.AddBlacklistResp{}, config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName()) -//} - func ApiToRpc(c *gin.Context, apiReq, apiResp interface{}, rpcName string, rpcClientFunc interface{}, rpcFuncName string) { + if rpcName == "" { + rpcName = utils2.GetFuncName(1) + } logFuncName := fmt.Sprintf("[ApiToRpc: %s]%s", utils2.GetFuncName(1), rpcFuncName) ctx := trace_log.NewCtx1(c, rpcFuncName) defer log.ShowLog(ctx) @@ -58,77 +57,3 @@ func rpcString(v interface{}) string { } return fmt.Sprintf("%+v", v) } - -//func ApiToRpc(c *gin.Context, apiReq, apiResp interface{}, rpcName string, fn interface{}, rpcFuncName string, tokenFunc func(token string, operationID string) (string, error)) { -// nCtx := trace_log.NewCtx(c, rpcFuncName) -// defer trace_log.ShowLog(nCtx) -// if err := c.BindJSON(apiReq); err != nil { -// trace_log.WriteErrorResponse(nCtx, "BindJSON", err) -// return -// } -// reqValue := reflect.ValueOf(apiReq).Elem() -// operationID := reqValue.FieldByName("OperationID").String() -// trace_log.SetOperationID(nCtx, operationID) -// trace_log.SetCtxInfo(nCtx, "BindJSON", nil, "params", apiReq) -// etcdConn, err := utils2.GetConn(c, rpcName) -// if err != nil { -// trace_log.WriteErrorResponse(nCtx, "GetDefaultConn", err) -// return -// } -// rpc := reflect.ValueOf(fn).Call([]reflect.Value{ -// reflect.ValueOf(etcdConn), -// })[0].MethodByName(rpcFuncName) // rpc func -// rpcReqPtr := reflect.New(rpc.Type().In(1).Elem()) // *req参数 -// var opUserID string -// if tokenFunc != nil { -// var err error -// opUserID, err = tokenFunc(c.GetHeader("token"), operationID) -// if err != nil { -// trace_log.WriteErrorResponse(nCtx, "TokenFunc", err) -// return -// } -// } -// if opID := rpcReqPtr.Elem().FieldByName("OperationID"); opID.IsValid() { -// opID.SetString(operationID) -// if opU := rpcReqPtr.Elem().FieldByName("OpUserID"); opU.IsValid() { -// opU.SetString(opUserID) -// } -// } else { -// op := rpcReqPtr.Elem().FieldByName("Operation").Elem() -// op.FieldByName("OperationID").SetString(operationID) -// op.FieldByName("OpUserID").SetString(opUserID) -// } -// if err := utils.CopyStructFields(rpcReqPtr.Interface(), apiReq); err != nil { -// trace_log.WriteErrorResponse(nCtx, "CopyStructFields_RpcReq", err) -// return -// } -// respArr := rpc.Call([]reflect.Value{ -// reflect.ValueOf(context.Context(c)), // context.Context -// rpcReqPtr, // rpc apiReq -// }) // respArr => (apiResp, error) -// if !respArr[1].IsNil() { // rpc err != nil -// err := respArr[1].Interface().(error) -// trace_log.WriteErrorResponse(nCtx, rpcFuncName, err, "rpc req", rpcReqPtr.Interface()) -// return -// } -// rpcResp := respArr[0].Elem() -// trace_log.SetCtxInfo(nCtx, rpcFuncName, nil, "rpc req", rpcReqPtr.Interface(), "resp", rpcResp.Interface()) -// commonResp := rpcResp.FieldByName("CommonResp").Elem() -// errCodeVal := commonResp.FieldByName("ErrCode") -// errMsgVal := commonResp.FieldByName("ErrMsg").Interface().(string) -// errCode := errCodeVal.Interface().(int32) -// if errCode != 0 { -// trace_log.WriteErrorResponse(nCtx, "RpcErrCode", &constant.ErrInfo{ -// ErrCode: errCode, -// ErrMsg: errMsgVal, -// }) -// return -// } -// if apiResp != nil { -// if err := utils.CopyStructFields(apiResp, rpcResp.Interface()); err != nil { -// trace_log.WriteErrorResponse(nCtx, "CopyStructFields_RpcResp", err) -// return -// } -// } -// trace_log.SetSuccess(nCtx, rpcFuncName, apiResp) -//} diff --git a/pkg/base_info/friend_api_struct.go b/pkg/base_info/friend_api_struct.go index 21b1912e7..8c6da6b53 100644 --- a/pkg/base_info/friend_api_struct.go +++ b/pkg/base_info/friend_api_struct.go @@ -1,128 +1,267 @@ package base_info -import open_im_sdk "Open_IM/pkg/proto/sdk_ws" +//type ParamsCommFriend struct { +// OperationID string `json:"operationID" binding:"required"` +// ToUserID string `json:"toUserID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +// +//type AddBlacklistReq struct { +// ParamsCommFriend +//} +//type AddBlacklistResp struct { +// CommResp +//} +// +//type ImportFriendReq struct { +// FriendUserIDList []string `json:"friendUserIDList" binding:"required"` +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type UserIDResult struct { +// UserID string `json:"userID"` +// Result int32 `json:"result"` +//} +//type ImportFriendResp struct { +// CommResp +// UserIDResultList []UserIDResult `json:"data"` +//} +// +//type AddFriendReq struct { +// ParamsCommFriend +// ReqMsg string `json:"reqMsg"` +//} +//type AddFriendResp struct { +// CommResp +//} +// +//type AddFriendResponseReq struct { +// ParamsCommFriend +// Flag int32 `json:"flag" binding:"required,oneof=-1 0 1"` +// HandleMsg string `json:"handleMsg"` +//} +//type AddFriendResponseResp struct { +// CommResp +//} +// +//type DeleteFriendReq struct { +// ParamsCommFriend +//} +//type DeleteFriendResp struct { +// CommResp +//} +// +//type GetBlackListReq struct { +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type GetBlackListResp struct { +// CommResp +// BlackUserInfoList []*open_im_sdk.PublicUserInfo `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} +// +////type PublicUserInfo struct { +//// UserID string `json:"userID"` +//// Nickname string `json:"nickname"` +//// FaceUrl string `json:"faceUrl"` +//// Gender int32 `json:"gender"` +////} +// +//type SetFriendRemarkReq struct { +// ParamsCommFriend +// Remark string `json:"remark"` +//} +//type SetFriendRemarkResp struct { +// CommResp +//} +// +//type RemoveBlacklistReq struct { +// ParamsCommFriend +//} +//type RemoveBlacklistResp struct { +// CommResp +//} +// +//type IsFriendReq struct { +// ParamsCommFriend +//} +//type Response struct { +// Friend bool `json:"isFriend"` +//} +//type IsFriendResp struct { +// CommResp +// Response Response `json:"data"` +//} +// +//type GetFriendsInfoReq struct { +// ParamsCommFriend +//} +//type GetFriendsInfoResp struct { +// CommResp +// FriendInfoList []*open_im_sdk.FriendInfo `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} +// +//type GetFriendListReq struct { +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type GetFriendListResp struct { +// CommResp +// FriendInfoList []*open_im_sdk.FriendInfo `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} +// +//type GetFriendApplyListReq struct { +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type GetFriendApplyListResp struct { +// CommResp +// FriendRequestList []*open_im_sdk.FriendRequest `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} +// +//type GetSelfApplyListReq struct { +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type GetSelfApplyListResp struct { +// CommResp +// FriendRequestList []*open_im_sdk.FriendRequest `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} -type ParamsCommFriend struct { - OperationID string `json:"operationID" binding:"required"` - ToUserID string `json:"toUserID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` +type FriendInfo struct { + UserID string `json:"userID"` + Nickname string `json:"nickname"` + FaceURL string `json:"faceURL"` + Gender int32 `json:"gender"` + Ex string `json:"ex"` +} + +type PublicUserInfo struct { + UserID string `json:"userID"` + Nickname string `json:"nickname"` + FaceURL string `json:"faceURL"` + Gender int32 `json:"gender"` + Ex string `json:"ex"` +} + +type FriendRequest struct { + FromUserID string `json:"fromUserID"` + FromNickname string `json:"fromNickname"` + FromFaceURL string `json:"fromFaceURL"` + FromGender int32 `json:"fromGender"` + ToUserID string `json:"toUserID"` + ToNickname string `json:"toNickname"` + ToFaceURL string `json:"toFaceURL"` + ToGender int32 `json:"toGender"` + HandleResult int32 `json:"handleResult"` + ReqMsg string `json:"reqMsg"` + CreateTime uint32 `json:"createTime"` + HandlerUserID string `json:"handlerUserID"` + HandleMsg string `json:"handleMsg"` + HandleTime uint32 `json:"handleTime"` + Ex string `json:"ex"` } type AddBlacklistReq struct { - ParamsCommFriend + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` } type AddBlacklistResp struct { - CommResp } type ImportFriendReq struct { FriendUserIDList []string `json:"friendUserIDList" binding:"required"` - OperationID string `json:"operationID" binding:"required"` FromUserID string `json:"fromUserID" binding:"required"` } -type UserIDResult struct { - UserID string `json:"userID"` - Result int32 `json:"result"` -} + type ImportFriendResp struct { - CommResp - UserIDResultList []UserIDResult `json:"data"` + //CommResp } type AddFriendReq struct { - ParamsCommFriend - ReqMsg string `json:"reqMsg"` + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` + ReqMsg string `json:"reqMsg"` } type AddFriendResp struct { - CommResp + //CommResp } type AddFriendResponseReq struct { - ParamsCommFriend - Flag int32 `json:"flag" binding:"required,oneof=-1 0 1"` - HandleMsg string `json:"handleMsg"` + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` + HandleResult int32 `json:"flag" binding:"required,oneof=-1 0 1"` + HandleMsg string `json:"handleMsg"` } type AddFriendResponseResp struct { - CommResp } type DeleteFriendReq struct { - ParamsCommFriend + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` } type DeleteFriendResp struct { - CommResp } type GetBlackListReq struct { - OperationID string `json:"operationID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` } type GetBlackListResp struct { - CommResp - BlackUserInfoList []*open_im_sdk.PublicUserInfo `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` + BlackUserInfoList []PublicUserInfo `json:"blackUserInfoList"` } -//type PublicUserInfo struct { -// UserID string `json:"userID"` -// Nickname string `json:"nickname"` -// FaceUrl string `json:"faceUrl"` -// Gender int32 `json:"gender"` -//} - type SetFriendRemarkReq struct { - ParamsCommFriend - Remark string `json:"remark"` + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` + Remark string `json:"remark"` } type SetFriendRemarkResp struct { - CommResp } -type RemoveBlackListReq struct { - ParamsCommFriend +type RemoveBlacklistReq struct { + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` } -type RemoveBlackListResp struct { - CommResp +type RemoveBlacklistResp struct { } type IsFriendReq struct { - ParamsCommFriend + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` } type Response struct { Friend bool `json:"isFriend"` } type IsFriendResp struct { - CommResp Response Response `json:"data"` } -type GetFriendsInfoReq struct { - ParamsCommFriend -} -type GetFriendsInfoResp struct { - CommResp - FriendInfoList []*open_im_sdk.FriendInfo `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` -} - type GetFriendListReq struct { OperationID string `json:"operationID" binding:"required"` FromUserID string `json:"fromUserID" binding:"required"` } type GetFriendListResp struct { - CommResp - FriendInfoList []*open_im_sdk.FriendInfo `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` + OwnerUserID string `json:"ownerUserID"` + Remark string `json:"remark"` + CreateTime uint32 `json:"createTime"` + AddSource int32 `json:"addSource"` + OperatorUserID string `json:"operatorUserID"` + Ex string `json:"ex"` + //FriendUser *UserInfo // TODO } type GetFriendApplyListReq struct { OperationID string `json:"operationID" binding:"required"` FromUserID string `json:"fromUserID" binding:"required"` } + type GetFriendApplyListResp struct { - CommResp - FriendRequestList []*open_im_sdk.FriendRequest `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` + FriendRequestList []FriendRequest `json:"friendRequestList"` } type GetSelfApplyListReq struct { @@ -130,7 +269,5 @@ type GetSelfApplyListReq struct { FromUserID string `json:"fromUserID" binding:"required"` } type GetSelfApplyListResp struct { - CommResp - FriendRequestList []*open_im_sdk.FriendRequest `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` + FriendRequestList []FriendRequest `json:"friendRequestList"` } diff --git a/pkg/proto/friend/friend.pb.go b/pkg/proto/friend/friend.pb.go index c68eb3194..46a39bc7b 100644 --- a/pkg/proto/friend/friend.pb.go +++ b/pkg/proto/friend/friend.pb.go @@ -36,7 +36,7 @@ func (m *GetFriendsInfoReq) Reset() { *m = GetFriendsInfoReq{} } func (m *GetFriendsInfoReq) String() string { return proto.CompactTextString(m) } func (*GetFriendsInfoReq) ProtoMessage() {} func (*GetFriendsInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{0} + return fileDescriptor_friend_ee3ed328aecab868, []int{0} } func (m *GetFriendsInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendsInfoReq.Unmarshal(m, b) @@ -81,7 +81,7 @@ func (m *GetFriendInfoResp) Reset() { *m = GetFriendInfoResp{} } func (m *GetFriendInfoResp) String() string { return proto.CompactTextString(m) } func (*GetFriendInfoResp) ProtoMessage() {} func (*GetFriendInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{1} + return fileDescriptor_friend_ee3ed328aecab868, []int{1} } func (m *GetFriendInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendInfoResp.Unmarshal(m, b) @@ -121,7 +121,7 @@ func (m *AddFriendReq) Reset() { *m = AddFriendReq{} } func (m *AddFriendReq) String() string { return proto.CompactTextString(m) } func (*AddFriendReq) ProtoMessage() {} func (*AddFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{2} + return fileDescriptor_friend_ee3ed328aecab868, []int{2} } func (m *AddFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddFriendReq.Unmarshal(m, b) @@ -173,7 +173,7 @@ func (m *AddFriendResp) Reset() { *m = AddFriendResp{} } func (m *AddFriendResp) String() string { return proto.CompactTextString(m) } func (*AddFriendResp) ProtoMessage() {} func (*AddFriendResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{3} + return fileDescriptor_friend_ee3ed328aecab868, []int{3} } func (m *AddFriendResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddFriendResp.Unmarshal(m, b) @@ -212,7 +212,7 @@ func (m *ImportFriendReq) Reset() { *m = ImportFriendReq{} } func (m *ImportFriendReq) String() string { return proto.CompactTextString(m) } func (*ImportFriendReq) ProtoMessage() {} func (*ImportFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{4} + return fileDescriptor_friend_ee3ed328aecab868, []int{4} } func (m *ImportFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ImportFriendReq.Unmarshal(m, b) @@ -256,7 +256,7 @@ func (m *ImportFriendResp) Reset() { *m = ImportFriendResp{} } func (m *ImportFriendResp) String() string { return proto.CompactTextString(m) } func (*ImportFriendResp) ProtoMessage() {} func (*ImportFriendResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{5} + return fileDescriptor_friend_ee3ed328aecab868, []int{5} } func (m *ImportFriendResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ImportFriendResp.Unmarshal(m, b) @@ -288,7 +288,7 @@ func (m *GetFriendApplyListReq) Reset() { *m = GetFriendApplyListReq{} } func (m *GetFriendApplyListReq) String() string { return proto.CompactTextString(m) } func (*GetFriendApplyListReq) ProtoMessage() {} func (*GetFriendApplyListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{6} + return fileDescriptor_friend_ee3ed328aecab868, []int{6} } func (m *GetFriendApplyListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendApplyListReq.Unmarshal(m, b) @@ -333,7 +333,7 @@ func (m *GetFriendApplyListResp) Reset() { *m = GetFriendApplyListResp{} func (m *GetFriendApplyListResp) String() string { return proto.CompactTextString(m) } func (*GetFriendApplyListResp) ProtoMessage() {} func (*GetFriendApplyListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{7} + return fileDescriptor_friend_ee3ed328aecab868, []int{7} } func (m *GetFriendApplyListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendApplyListResp.Unmarshal(m, b) @@ -372,7 +372,7 @@ func (m *GetFriendListReq) Reset() { *m = GetFriendListReq{} } func (m *GetFriendListReq) String() string { return proto.CompactTextString(m) } func (*GetFriendListReq) ProtoMessage() {} func (*GetFriendListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{8} + return fileDescriptor_friend_ee3ed328aecab868, []int{8} } func (m *GetFriendListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendListReq.Unmarshal(m, b) @@ -417,7 +417,7 @@ func (m *GetFriendListResp) Reset() { *m = GetFriendListResp{} } func (m *GetFriendListResp) String() string { return proto.CompactTextString(m) } func (*GetFriendListResp) ProtoMessage() {} func (*GetFriendListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{9} + return fileDescriptor_friend_ee3ed328aecab868, []int{9} } func (m *GetFriendListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendListResp.Unmarshal(m, b) @@ -456,7 +456,7 @@ func (m *AddBlacklistReq) Reset() { *m = AddBlacklistReq{} } func (m *AddBlacklistReq) String() string { return proto.CompactTextString(m) } func (*AddBlacklistReq) ProtoMessage() {} func (*AddBlacklistReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{10} + return fileDescriptor_friend_ee3ed328aecab868, []int{10} } func (m *AddBlacklistReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddBlacklistReq.Unmarshal(m, b) @@ -500,7 +500,7 @@ func (m *AddBlacklistResp) Reset() { *m = AddBlacklistResp{} } func (m *AddBlacklistResp) String() string { return proto.CompactTextString(m) } func (*AddBlacklistResp) ProtoMessage() {} func (*AddBlacklistResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{11} + return fileDescriptor_friend_ee3ed328aecab868, []int{11} } func (m *AddBlacklistResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddBlacklistResp.Unmarshal(m, b) @@ -532,7 +532,7 @@ func (m *RemoveBlacklistReq) Reset() { *m = RemoveBlacklistReq{} } func (m *RemoveBlacklistReq) String() string { return proto.CompactTextString(m) } func (*RemoveBlacklistReq) ProtoMessage() {} func (*RemoveBlacklistReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{12} + return fileDescriptor_friend_ee3ed328aecab868, []int{12} } func (m *RemoveBlacklistReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RemoveBlacklistReq.Unmarshal(m, b) @@ -576,7 +576,7 @@ func (m *RemoveBlacklistResp) Reset() { *m = RemoveBlacklistResp{} } func (m *RemoveBlacklistResp) String() string { return proto.CompactTextString(m) } func (*RemoveBlacklistResp) ProtoMessage() {} func (*RemoveBlacklistResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{13} + return fileDescriptor_friend_ee3ed328aecab868, []int{13} } func (m *RemoveBlacklistResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RemoveBlacklistResp.Unmarshal(m, b) @@ -597,8 +597,7 @@ func (m *RemoveBlacklistResp) XXX_DiscardUnknown() { var xxx_messageInfo_RemoveBlacklistResp proto.InternalMessageInfo type GetBlacklistReq struct { - ToUserID string `protobuf:"bytes,1,opt,name=ToUserID" json:"ToUserID,omitempty"` - FromUserID string `protobuf:"bytes,2,opt,name=FromUserID" json:"FromUserID,omitempty"` + FromUserID string `protobuf:"bytes,1,opt,name=FromUserID" json:"FromUserID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -608,7 +607,7 @@ func (m *GetBlacklistReq) Reset() { *m = GetBlacklistReq{} } func (m *GetBlacklistReq) String() string { return proto.CompactTextString(m) } func (*GetBlacklistReq) ProtoMessage() {} func (*GetBlacklistReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{14} + return fileDescriptor_friend_ee3ed328aecab868, []int{14} } func (m *GetBlacklistReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBlacklistReq.Unmarshal(m, b) @@ -628,13 +627,6 @@ func (m *GetBlacklistReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetBlacklistReq proto.InternalMessageInfo -func (m *GetBlacklistReq) GetToUserID() string { - if m != nil { - return m.ToUserID - } - return "" -} - func (m *GetBlacklistReq) GetFromUserID() string { if m != nil { return m.FromUserID @@ -653,7 +645,7 @@ func (m *GetBlacklistResp) Reset() { *m = GetBlacklistResp{} } func (m *GetBlacklistResp) String() string { return proto.CompactTextString(m) } func (*GetBlacklistResp) ProtoMessage() {} func (*GetBlacklistResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{15} + return fileDescriptor_friend_ee3ed328aecab868, []int{15} } func (m *GetBlacklistResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBlacklistResp.Unmarshal(m, b) @@ -692,7 +684,7 @@ func (m *IsFriendReq) Reset() { *m = IsFriendReq{} } func (m *IsFriendReq) String() string { return proto.CompactTextString(m) } func (*IsFriendReq) ProtoMessage() {} func (*IsFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{16} + return fileDescriptor_friend_ee3ed328aecab868, []int{16} } func (m *IsFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsFriendReq.Unmarshal(m, b) @@ -737,7 +729,7 @@ func (m *IsFriendResp) Reset() { *m = IsFriendResp{} } func (m *IsFriendResp) String() string { return proto.CompactTextString(m) } func (*IsFriendResp) ProtoMessage() {} func (*IsFriendResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{17} + return fileDescriptor_friend_ee3ed328aecab868, []int{17} } func (m *IsFriendResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsFriendResp.Unmarshal(m, b) @@ -776,7 +768,7 @@ func (m *IsInBlackListReq) Reset() { *m = IsInBlackListReq{} } func (m *IsInBlackListReq) String() string { return proto.CompactTextString(m) } func (*IsInBlackListReq) ProtoMessage() {} func (*IsInBlackListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{18} + return fileDescriptor_friend_ee3ed328aecab868, []int{18} } func (m *IsInBlackListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsInBlackListReq.Unmarshal(m, b) @@ -821,7 +813,7 @@ func (m *IsInBlackListResp) Reset() { *m = IsInBlackListResp{} } func (m *IsInBlackListResp) String() string { return proto.CompactTextString(m) } func (*IsInBlackListResp) ProtoMessage() {} func (*IsInBlackListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{19} + return fileDescriptor_friend_ee3ed328aecab868, []int{19} } func (m *IsInBlackListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsInBlackListResp.Unmarshal(m, b) @@ -860,7 +852,7 @@ func (m *DeleteFriendReq) Reset() { *m = DeleteFriendReq{} } func (m *DeleteFriendReq) String() string { return proto.CompactTextString(m) } func (*DeleteFriendReq) ProtoMessage() {} func (*DeleteFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{20} + return fileDescriptor_friend_ee3ed328aecab868, []int{20} } func (m *DeleteFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteFriendReq.Unmarshal(m, b) @@ -904,7 +896,7 @@ func (m *DeleteFriendResp) Reset() { *m = DeleteFriendResp{} } func (m *DeleteFriendResp) String() string { return proto.CompactTextString(m) } func (*DeleteFriendResp) ProtoMessage() {} func (*DeleteFriendResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{21} + return fileDescriptor_friend_ee3ed328aecab868, []int{21} } func (m *DeleteFriendResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteFriendResp.Unmarshal(m, b) @@ -939,7 +931,7 @@ func (m *AddFriendResponseReq) Reset() { *m = AddFriendResponseReq{} } func (m *AddFriendResponseReq) String() string { return proto.CompactTextString(m) } func (*AddFriendResponseReq) ProtoMessage() {} func (*AddFriendResponseReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{22} + return fileDescriptor_friend_ee3ed328aecab868, []int{22} } func (m *AddFriendResponseReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddFriendResponseReq.Unmarshal(m, b) @@ -997,7 +989,7 @@ func (m *AddFriendResponseResp) Reset() { *m = AddFriendResponseResp{} } func (m *AddFriendResponseResp) String() string { return proto.CompactTextString(m) } func (*AddFriendResponseResp) ProtoMessage() {} func (*AddFriendResponseResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{23} + return fileDescriptor_friend_ee3ed328aecab868, []int{23} } func (m *AddFriendResponseResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddFriendResponseResp.Unmarshal(m, b) @@ -1030,7 +1022,7 @@ func (m *SetFriendRemarkReq) Reset() { *m = SetFriendRemarkReq{} } func (m *SetFriendRemarkReq) String() string { return proto.CompactTextString(m) } func (*SetFriendRemarkReq) ProtoMessage() {} func (*SetFriendRemarkReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{24} + return fileDescriptor_friend_ee3ed328aecab868, []int{24} } func (m *SetFriendRemarkReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetFriendRemarkReq.Unmarshal(m, b) @@ -1081,7 +1073,7 @@ func (m *SetFriendRemarkResp) Reset() { *m = SetFriendRemarkResp{} } func (m *SetFriendRemarkResp) String() string { return proto.CompactTextString(m) } func (*SetFriendRemarkResp) ProtoMessage() {} func (*SetFriendRemarkResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{25} + return fileDescriptor_friend_ee3ed328aecab868, []int{25} } func (m *SetFriendRemarkResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetFriendRemarkResp.Unmarshal(m, b) @@ -1113,7 +1105,7 @@ func (m *GetSelfApplyListReq) Reset() { *m = GetSelfApplyListReq{} } func (m *GetSelfApplyListReq) String() string { return proto.CompactTextString(m) } func (*GetSelfApplyListReq) ProtoMessage() {} func (*GetSelfApplyListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{26} + return fileDescriptor_friend_ee3ed328aecab868, []int{26} } func (m *GetSelfApplyListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSelfApplyListReq.Unmarshal(m, b) @@ -1158,7 +1150,7 @@ func (m *GetSelfApplyListResp) Reset() { *m = GetSelfApplyListResp{} } func (m *GetSelfApplyListResp) String() string { return proto.CompactTextString(m) } func (*GetSelfApplyListResp) ProtoMessage() {} func (*GetSelfApplyListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_268d4d8b889bd130, []int{27} + return fileDescriptor_friend_ee3ed328aecab868, []int{27} } func (m *GetSelfApplyListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSelfApplyListResp.Unmarshal(m, b) @@ -1684,57 +1676,58 @@ var _Friend_serviceDesc = grpc.ServiceDesc{ Metadata: "friend/friend.proto", } -func init() { proto.RegisterFile("friend/friend.proto", fileDescriptor_friend_268d4d8b889bd130) } - -var fileDescriptor_friend_268d4d8b889bd130 = []byte{ - // 783 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4b, 0x4f, 0xdb, 0x40, - 0x10, 0x56, 0x4a, 0x4b, 0xc9, 0x10, 0x9a, 0x64, 0x92, 0x40, 0x6a, 0x1e, 0x85, 0x3d, 0x21, 0x24, - 0x12, 0x89, 0xaa, 0x52, 0xa5, 0xaa, 0x87, 0x50, 0x0a, 0x72, 0xd5, 0x00, 0x75, 0xda, 0x0b, 0x52, - 0x15, 0x99, 0x78, 0x13, 0xa2, 0x38, 0xf1, 0xe2, 0x31, 0xa0, 0xfe, 0x8f, 0xde, 0xfb, 0x57, 0x2b, - 0x3f, 0x62, 0xaf, 0x1f, 0x81, 0x03, 0x3e, 0x59, 0xf3, 0xfa, 0x66, 0x76, 0x66, 0xfd, 0xed, 0x40, - 0x6d, 0x68, 0x8f, 0xf9, 0xcc, 0x68, 0xfb, 0x9f, 0x96, 0xb0, 0x2d, 0xc7, 0xc2, 0x65, 0x5f, 0x52, - 0xf6, 0x2f, 0x04, 0x9f, 0x1d, 0xaa, 0xdd, 0xc3, 0x1e, 0xb7, 0xef, 0xb9, 0xdd, 0x16, 0x93, 0x51, - 0xdb, 0xf3, 0x68, 0x93, 0x31, 0xe9, 0x3f, 0x50, 0xfb, 0x81, 0xfc, 0x08, 0x76, 0x01, 0xd5, 0x33, - 0xee, 0x9c, 0x7a, 0x61, 0xa4, 0xce, 0x86, 0x96, 0xc6, 0x6f, 0x51, 0x81, 0x95, 0x9f, 0xd6, 0x2f, - 0xe2, 0xb6, 0x7a, 0xd2, 0x2c, 0xec, 0x16, 0xf6, 0x8b, 0x5a, 0x28, 0xe3, 0x0e, 0xc0, 0xa9, 0x6d, - 0x4d, 0x03, 0xeb, 0x0b, 0xcf, 0x2a, 0x69, 0xd8, 0x95, 0x04, 0xe8, 0xe3, 0x91, 0xc0, 0xaf, 0xf0, - 0x26, 0xd2, 0x7c, 0x1f, 0x93, 0xd3, 0x2c, 0xec, 0x2e, 0xed, 0xaf, 0x1e, 0x6d, 0xb7, 0xc8, 0x2b, - 0xb0, 0xaf, 0x8b, 0x71, 0x5f, 0xe8, 0xb6, 0x3e, 0xa5, 0x96, 0x14, 0x9a, 0x08, 0x62, 0xd7, 0x50, - 0xea, 0x18, 0x86, 0xaf, 0x7c, 0x66, 0x9d, 0xb8, 0x0e, 0xcb, 0x1a, 0xbf, 0xed, 0xd2, 0xa8, 0xb9, - 0xe4, 0xd9, 0x02, 0x89, 0x9d, 0xc3, 0x9a, 0x94, 0x83, 0x04, 0x7e, 0x06, 0x18, 0x58, 0xd3, 0xa9, - 0x35, 0x73, 0x25, 0x2f, 0x4d, 0x76, 0xdd, 0x5f, 0x42, 0x27, 0x4d, 0x0a, 0x60, 0xbf, 0xa1, 0xac, - 0x4e, 0x85, 0x65, 0x3b, 0x51, 0xd9, 0x07, 0x50, 0xf1, 0x05, 0xbf, 0x94, 0xb0, 0x1f, 0x45, 0x2d, - 0xa5, 0x7f, 0xb2, 0xdd, 0x08, 0x95, 0x38, 0x3c, 0x09, 0xd6, 0x83, 0x46, 0x38, 0x82, 0x8e, 0x10, - 0xe6, 0x1f, 0x17, 0xe9, 0xb9, 0x73, 0xbd, 0x81, 0xf5, 0x2c, 0x50, 0x12, 0x78, 0x0e, 0xd5, 0xf0, - 0x6c, 0x77, 0x9c, 0x1c, 0x69, 0xbe, 0xbb, 0x0b, 0xe7, 0x1b, 0xf8, 0x6a, 0xe9, 0x50, 0x76, 0x0e, - 0x95, 0x30, 0x53, 0x1e, 0x95, 0xcb, 0x37, 0x32, 0x2c, 0x3a, 0xa7, 0x1b, 0xd9, 0x85, 0x72, 0xc7, - 0x30, 0x8e, 0x4d, 0x7d, 0x30, 0x31, 0x73, 0x28, 0x15, 0xa1, 0x12, 0x87, 0x23, 0xc1, 0x2e, 0x01, - 0x35, 0x3e, 0xb5, 0xee, 0x79, 0x6e, 0x59, 0x1a, 0x50, 0x4b, 0x21, 0x92, 0x70, 0xcf, 0x72, 0xc6, - 0x9d, 0xdc, 0xb2, 0x0c, 0xbc, 0x31, 0xc6, 0x52, 0xe0, 0x05, 0x54, 0x3d, 0x85, 0xe7, 0x12, 0x6f, - 0xfc, 0x5e, 0x46, 0xe3, 0x2f, 0xef, 0xae, 0xcd, 0xf1, 0x60, 0xee, 0xac, 0xa5, 0x63, 0x99, 0x0a, - 0xab, 0x2a, 0xe5, 0x42, 0x08, 0xec, 0x00, 0x4a, 0x11, 0x14, 0x09, 0x17, 0xcb, 0xfd, 0x5a, 0x33, - 0xe2, 0x1e, 0xd6, 0x8a, 0x16, 0xca, 0xee, 0x15, 0x55, 0x49, 0x9d, 0x79, 0xf5, 0xe4, 0x71, 0x45, - 0xdb, 0x50, 0x4d, 0xe0, 0x3d, 0x51, 0x40, 0x17, 0xca, 0x27, 0xdc, 0xe4, 0x0e, 0xcf, 0xe7, 0xec, - 0x08, 0x95, 0x38, 0x1c, 0x09, 0xf6, 0xb7, 0x00, 0xf5, 0x18, 0x13, 0xba, 0x89, 0x9f, 0xcb, 0xba, - 0x0c, 0x4a, 0x37, 0xfa, 0xcc, 0x30, 0xb9, 0xc6, 0xe9, 0xce, 0x74, 0x3c, 0xee, 0x7d, 0xa5, 0xc5, - 0x74, 0xb8, 0x05, 0x45, 0x5f, 0x76, 0xc9, 0xf9, 0xa5, 0x07, 0x11, 0x29, 0xd8, 0x06, 0x34, 0x32, - 0xaa, 0x22, 0xc1, 0x6e, 0x00, 0x7b, 0x3c, 0xa4, 0xc1, 0xa9, 0x6e, 0x4f, 0x72, 0x79, 0x22, 0x5c, - 0xa0, 0xe8, 0x89, 0x70, 0x25, 0xf7, 0xff, 0x49, 0x65, 0x22, 0xc1, 0x7e, 0x40, 0xed, 0x8c, 0x3b, - 0x3d, 0x6e, 0x0e, 0x73, 0x23, 0xdd, 0x21, 0xd4, 0xd3, 0x90, 0xf9, 0x53, 0xee, 0xd1, 0xbf, 0xd7, - 0x10, 0xac, 0x0e, 0xf8, 0x11, 0x8a, 0xfa, 0xbc, 0xbf, 0x58, 0x6f, 0x05, 0xeb, 0x85, 0xfc, 0xec, - 0x2a, 0x8d, 0x0c, 0x2d, 0x09, 0xec, 0x01, 0x8e, 0x52, 0x2f, 0x04, 0x6e, 0xcf, 0x9d, 0x33, 0x9f, - 0x24, 0x65, 0xe7, 0x31, 0x33, 0x09, 0xec, 0x42, 0x65, 0x94, 0xe8, 0x00, 0x6e, 0x4a, 0x31, 0xc9, - 0x76, 0x2b, 0x5b, 0x8b, 0x8d, 0x24, 0xf0, 0x04, 0xd6, 0x46, 0xf2, 0x5b, 0x80, 0xcd, 0x54, 0xfe, - 0x39, 0xd0, 0xdb, 0x05, 0x16, 0x12, 0xd8, 0x81, 0x92, 0x2e, 0xd1, 0x34, 0x6e, 0x48, 0x0d, 0x91, - 0xf9, 0x53, 0x69, 0x66, 0x1b, 0x48, 0xe0, 0x37, 0x28, 0xdb, 0x71, 0x0e, 0x46, 0x65, 0xee, 0x9c, - 0xa6, 0x7b, 0x65, 0x73, 0xa1, 0x8d, 0x04, 0x7e, 0x80, 0x95, 0x71, 0xc0, 0x5c, 0x58, 0x9b, 0x3b, - 0x4a, 0xb4, 0xa8, 0xd4, 0xd3, 0x4a, 0xbf, 0x17, 0x63, 0x99, 0x74, 0xa2, 0x5e, 0x24, 0xb9, 0x2d, - 0xea, 0x45, 0x9a, 0xa5, 0x3a, 0x50, 0x1a, 0x49, 0x34, 0x1f, 0xf5, 0x22, 0xf1, 0x96, 0x28, 0xcd, - 0x6c, 0x83, 0x0f, 0x61, 0x48, 0xec, 0x13, 0x41, 0x24, 0x28, 0x2e, 0x82, 0x48, 0x92, 0x15, 0x5e, - 0x42, 0x55, 0x4f, 0xb2, 0x02, 0x6e, 0x65, 0xde, 0xd3, 0x80, 0xc6, 0x94, 0xed, 0x47, 0xac, 0xfe, - 0x80, 0x28, 0xfe, 0x93, 0x47, 0x03, 0x4a, 0xf3, 0x4c, 0x34, 0xa0, 0x0c, 0x66, 0x70, 0x0f, 0x38, - 0x96, 0x96, 0xb4, 0xe8, 0x80, 0x89, 0xcd, 0x30, 0x3a, 0x60, 0x72, 0xa7, 0x3b, 0xde, 0xbb, 0x7a, - 0xe7, 0xee, 0xf4, 0x7d, 0xb5, 0x2b, 0x2d, 0xf3, 0xbe, 0xf3, 0x27, 0xff, 0x73, 0xbd, 0xec, 0x29, - 0xdf, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x13, 0x7c, 0xdf, 0x1a, 0x0c, 0x00, 0x00, +func init() { proto.RegisterFile("friend/friend.proto", fileDescriptor_friend_ee3ed328aecab868) } + +var fileDescriptor_friend_ee3ed328aecab868 = []byte{ + // 790 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4b, 0x4f, 0xdb, 0x4e, + 0x10, 0x57, 0xfe, 0xfc, 0x4b, 0xc9, 0x10, 0x9a, 0x64, 0x92, 0x40, 0x6a, 0x1e, 0x85, 0x3d, 0x21, + 0x24, 0x12, 0x95, 0xaa, 0x52, 0xa5, 0xaa, 0x87, 0x50, 0x0a, 0x72, 0xd5, 0x00, 0x75, 0xda, 0x0b, + 0x52, 0x15, 0x99, 0x78, 0x13, 0xa2, 0x38, 0xf1, 0xe2, 0x31, 0xa0, 0x7e, 0x8f, 0xde, 0xfb, 0x55, + 0x2b, 0x3f, 0x62, 0xaf, 0x1f, 0x81, 0x03, 0x3e, 0x59, 0xf3, 0xfa, 0xcd, 0xec, 0xcc, 0xfa, 0xb7, + 0x03, 0xb5, 0xa1, 0x3d, 0xe6, 0x33, 0xa3, 0xed, 0x7f, 0x5a, 0xc2, 0xb6, 0x1c, 0x0b, 0x97, 0x7d, + 0x49, 0xd9, 0xbf, 0x10, 0x7c, 0x76, 0xa8, 0x76, 0x0f, 0x7b, 0xdc, 0xbe, 0xe7, 0x76, 0x5b, 0x4c, + 0x46, 0x6d, 0xcf, 0xa3, 0x4d, 0xc6, 0xa4, 0xff, 0x40, 0xed, 0x07, 0xf2, 0x23, 0xd8, 0x05, 0x54, + 0xcf, 0xb8, 0x73, 0xea, 0x85, 0x91, 0x3a, 0x1b, 0x5a, 0x1a, 0xbf, 0x45, 0x05, 0x56, 0x7e, 0x58, + 0x3f, 0x89, 0xdb, 0xea, 0x49, 0xb3, 0xb0, 0x5b, 0xd8, 0x2f, 0x6a, 0xa1, 0x8c, 0x3b, 0x00, 0xa7, + 0xb6, 0x35, 0x0d, 0xac, 0xff, 0x79, 0x56, 0x49, 0xc3, 0xae, 0x24, 0x40, 0x1f, 0x8f, 0x04, 0x7e, + 0x81, 0x57, 0x91, 0xe6, 0xdb, 0x98, 0x9c, 0x66, 0x61, 0x77, 0x69, 0x7f, 0xf5, 0x68, 0xbb, 0x45, + 0x5e, 0x81, 0x7d, 0x5d, 0x8c, 0xfb, 0x42, 0xb7, 0xf5, 0x29, 0xb5, 0xa4, 0xd0, 0x44, 0x10, 0xbb, + 0x86, 0x52, 0xc7, 0x30, 0x7c, 0xe5, 0x33, 0xeb, 0xc4, 0x75, 0x58, 0xd6, 0xf8, 0x6d, 0x97, 0x46, + 0xcd, 0x25, 0xcf, 0x16, 0x48, 0xec, 0x1c, 0xd6, 0xa4, 0x1c, 0x24, 0xf0, 0x13, 0xc0, 0xc0, 0x9a, + 0x4e, 0xad, 0x99, 0x2b, 0x79, 0x69, 0xb2, 0xeb, 0xfe, 0x1c, 0x3a, 0x69, 0x52, 0x00, 0xfb, 0x05, + 0x65, 0x75, 0x2a, 0x2c, 0xdb, 0x89, 0xca, 0x3e, 0x80, 0x8a, 0x2f, 0xf8, 0xa5, 0x84, 0xfd, 0x28, + 0x6a, 0x29, 0xfd, 0x93, 0xed, 0x46, 0xa8, 0xc4, 0xe1, 0x49, 0xb0, 0x1e, 0x34, 0xc2, 0x11, 0x74, + 0x84, 0x30, 0x7f, 0xbb, 0x48, 0xcf, 0x9d, 0xeb, 0x0d, 0xac, 0x67, 0x81, 0x92, 0xc0, 0x73, 0xa8, + 0x86, 0x67, 0xbb, 0xe3, 0xe4, 0x48, 0xf3, 0xdd, 0x5d, 0x38, 0xdf, 0xc0, 0x57, 0x4b, 0x87, 0xb2, + 0x73, 0xa8, 0x84, 0x99, 0xf2, 0xa8, 0x5c, 0xbe, 0x91, 0x61, 0xd1, 0x39, 0xdd, 0xc8, 0x2e, 0x94, + 0x3b, 0x86, 0x71, 0x6c, 0xea, 0x83, 0x89, 0x99, 0x43, 0xa9, 0x08, 0x95, 0x38, 0x1c, 0x09, 0x76, + 0x09, 0xa8, 0xf1, 0xa9, 0x75, 0xcf, 0x73, 0xcb, 0xd2, 0x80, 0x5a, 0x0a, 0x91, 0x04, 0x7b, 0x0b, + 0xe5, 0x33, 0xee, 0xc4, 0xb2, 0xc4, 0x91, 0x0a, 0x29, 0xa4, 0x81, 0x37, 0xaa, 0x18, 0x0c, 0x5e, + 0x40, 0xd5, 0x53, 0x78, 0x2e, 0xf1, 0xe6, 0xee, 0x65, 0x34, 0xf7, 0xf2, 0xee, 0xda, 0x1c, 0x0f, + 0xe6, 0xce, 0x5a, 0x3a, 0x96, 0xa9, 0xb0, 0xaa, 0x52, 0x2e, 0x3f, 0x3d, 0x3b, 0x80, 0x52, 0x04, + 0x45, 0xc2, 0xc5, 0x72, 0xbf, 0xd6, 0x8c, 0xb8, 0x87, 0xb5, 0xa2, 0x85, 0xb2, 0x7b, 0x0d, 0x55, + 0x52, 0x67, 0x5e, 0x3d, 0x79, 0x5c, 0xc3, 0x36, 0x54, 0x13, 0x78, 0x4f, 0x14, 0xd0, 0x85, 0xf2, + 0x09, 0x37, 0xb9, 0xc3, 0xf3, 0x39, 0x3b, 0x42, 0x25, 0x0e, 0x47, 0x82, 0xfd, 0x29, 0x40, 0x3d, + 0xc6, 0x76, 0x6e, 0xe2, 0xe7, 0x32, 0x2b, 0x83, 0xd2, 0x8d, 0x3e, 0x33, 0x4c, 0xae, 0x71, 0xba, + 0x33, 0x1d, 0x8f, 0x5f, 0x5f, 0x68, 0x31, 0x1d, 0x6e, 0x41, 0xd1, 0x97, 0x5d, 0x02, 0xfe, 0xdf, + 0x83, 0x88, 0x14, 0x6c, 0x03, 0x1a, 0x19, 0x55, 0x91, 0x60, 0x37, 0x80, 0x3d, 0x1e, 0x52, 0xdd, + 0x54, 0xb7, 0x27, 0xb9, 0x3c, 0x03, 0x2e, 0x50, 0xf4, 0x0c, 0xb8, 0x92, 0xfb, 0x8f, 0xa4, 0x32, + 0x91, 0x60, 0xdf, 0xa1, 0x76, 0xc6, 0x9d, 0x1e, 0x37, 0x87, 0xb9, 0x11, 0xeb, 0x10, 0xea, 0x69, + 0xc8, 0xfc, 0x69, 0xf5, 0xe8, 0xef, 0x4b, 0x08, 0xd6, 0x03, 0xfc, 0x00, 0x45, 0x7d, 0xde, 0x5f, + 0xac, 0xb7, 0x82, 0x15, 0x42, 0x7e, 0x5a, 0x95, 0x46, 0x86, 0x96, 0x04, 0xf6, 0x00, 0x47, 0xa9, + 0x57, 0x00, 0xb7, 0xe7, 0xce, 0x99, 0xcf, 0x8e, 0xb2, 0xf3, 0x98, 0x99, 0x04, 0x76, 0xa1, 0x32, + 0x4a, 0x74, 0x00, 0x37, 0xa5, 0x98, 0x64, 0xbb, 0x95, 0xad, 0xc5, 0x46, 0x12, 0x78, 0x02, 0x6b, + 0x23, 0x99, 0xef, 0xb1, 0x99, 0xca, 0x3f, 0x07, 0x7a, 0xbd, 0xc0, 0x42, 0x02, 0x3b, 0x50, 0xd2, + 0x25, 0x2a, 0xc6, 0x0d, 0xa9, 0x21, 0x32, 0x47, 0x2a, 0xcd, 0x6c, 0x03, 0x09, 0xfc, 0x0a, 0x65, + 0x3b, 0xce, 0xb3, 0xa8, 0xcc, 0x9d, 0xd3, 0x94, 0xae, 0x6c, 0x2e, 0xb4, 0x91, 0xc0, 0xf7, 0xb0, + 0x32, 0x0e, 0x98, 0x0b, 0x6b, 0x73, 0x47, 0x89, 0x16, 0x95, 0x7a, 0x5a, 0xe9, 0xf7, 0x62, 0x2c, + 0x93, 0x4e, 0xd4, 0x8b, 0x24, 0xb7, 0x45, 0xbd, 0x48, 0xb3, 0x54, 0x07, 0x4a, 0x23, 0x89, 0xe6, + 0xa3, 0x5e, 0x24, 0xde, 0x0b, 0xa5, 0x99, 0x6d, 0xf0, 0x21, 0x0c, 0x89, 0x7d, 0x22, 0x88, 0x04, + 0xc5, 0x45, 0x10, 0x49, 0xb2, 0xc2, 0x4b, 0xa8, 0xea, 0x49, 0x56, 0xc0, 0xad, 0xcc, 0x7b, 0x1a, + 0xd0, 0x98, 0xb2, 0xfd, 0x88, 0xd5, 0x1f, 0x10, 0xc5, 0x7f, 0xf2, 0x68, 0x40, 0x69, 0x9e, 0x89, + 0x06, 0x94, 0xc1, 0x0c, 0xee, 0x01, 0xc7, 0xd2, 0x22, 0x16, 0x1d, 0x30, 0xb1, 0xfd, 0x45, 0x07, + 0x4c, 0xee, 0x6d, 0xc7, 0x7b, 0x57, 0x6f, 0xdc, 0xbd, 0xbd, 0xaf, 0x76, 0xa5, 0x85, 0xdd, 0x77, + 0xfe, 0xe8, 0x7f, 0xae, 0x97, 0x3d, 0xe5, 0xbb, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xab, + 0x18, 0x07, 0xfe, 0x0b, 0x00, 0x00, } diff --git a/pkg/proto/friend/friend.proto b/pkg/proto/friend/friend.proto index 10e54b956..56158cb11 100644 --- a/pkg/proto/friend/friend.proto +++ b/pkg/proto/friend/friend.proto @@ -67,8 +67,7 @@ message RemoveBlacklistResp{ } message GetBlacklistReq{ - string ToUserID = 1; - string FromUserID = 2; + string FromUserID = 1; } message GetBlacklistResp{ repeated server_api_params.PublicUserInfo BlackUserInfoList = 1;