mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-06-03 22:39:28 +08:00
friend
This commit is contained in:
parent
4ab18f191f
commit
53c278234d
@ -6,6 +6,7 @@ import (
|
||||
"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"
|
||||
@ -336,7 +337,7 @@ func GetBlacklist(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
resp := api.GetBlackListResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
|
||||
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)
|
||||
@ -503,7 +504,7 @@ func IsFriend(c *gin.Context) {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add friend rpc server failed"})
|
||||
return
|
||||
}
|
||||
resp := api.IsFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
|
||||
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)
|
||||
@ -559,7 +560,7 @@ func GetFriendList(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
resp := api.GetFriendListResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, FriendInfoList: RpcResp.FriendInfoList}
|
||||
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)
|
||||
@ -616,7 +617,7 @@ func GetFriendApplyList(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
resp := api.GetFriendApplyListResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, FriendRequestList: RpcResp.FriendRequestList}
|
||||
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)
|
||||
@ -670,7 +671,7 @@ func GetSelfFriendApplyList(c *gin.Context) {
|
||||
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.ErrCode, ErrMsg: RpcResp.ErrMsg}, FriendRequestList: RpcResp.FriendRequestList}
|
||||
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)
|
||||
|
@ -31,7 +31,7 @@ func SetAppBadge(c *gin.Context) {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
if !token_verify.CheckAccess(opUserID, req.FromUserID) {
|
||||
if !token_verify.CheckAccess(c, opUserID, req.FromUserID) {
|
||||
log.NewError(req.OperationID, "CheckAccess false ", opUserID, req.FromUserID)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "no permission"})
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package common
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/trace_log"
|
||||
utils2 "Open_IM/pkg/utils"
|
||||
"Open_IM/pkg/getcdv3"
|
||||
utils "github.com/OpenIMSDK/open_utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"google.golang.org/grpc/metadata"
|
||||
@ -19,7 +19,7 @@ func ApiToRpc(c *gin.Context, apiReq, apiResp interface{}, rpcName string, fn in
|
||||
}
|
||||
trace_log.SetOperationID(nCtx, operationID)
|
||||
trace_log.SetContextInfo(nCtx, "BindJSON", nil, "params", apiReq)
|
||||
etcdConn, err := utils2.GetConn(c, rpcName)
|
||||
etcdConn, err := getcdv3.GetConn(c, rpcName)
|
||||
if err != nil {
|
||||
trace_log.WriteErrorResponse(nCtx, "GetDefaultConn", err)
|
||||
return
|
||||
|
@ -214,3 +214,10 @@ const (
|
||||
const (
|
||||
MessageHasReadDisable = 96001
|
||||
)
|
||||
|
||||
// temp
|
||||
|
||||
var (
|
||||
ErrServer = ErrInfo{500, "server error", ""}
|
||||
ErrTencentCredential = ErrInfo{400, "ErrTencentCredential", ""}
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user