Refactor code

pull/131/head
wenxu12345 3 years ago
parent b30cb5254e
commit 376f61e213

@ -85,7 +85,7 @@ func AddFriend(c *gin.Context) {
return return
} }
req := &rpc.AddFriendReq{CommID: &rpc.CommID{}} req := &rpc.AddFriendReq{CommID: &rpc.CommID{}}
utils.CopyStructFields(req.CommID, &params) utils.CopyStructFields(req.CommID, &params.ParamsCommFriend)
var ok bool var ok bool
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token")) ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
if !ok { if !ok {
@ -93,7 +93,7 @@ func AddFriend(c *gin.Context) {
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"}) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
return return
} }
log.NewInfo("AddFriend args ", req.String()) log.NewInfo(req.CommID.OperationID, "AddFriend args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
client := rpc.NewFriendClient(etcdConn) client := rpc.NewFriendClient(etcdConn)

@ -2,14 +2,14 @@ package base_info
import open_im_sdk "Open_IM/pkg/proto/sdk_ws" import open_im_sdk "Open_IM/pkg/proto/sdk_ws"
type paramsCommFriend struct { type ParamsCommFriend struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
ToUserID string `json:"toUserID" binding:"required"` ToUserID string `json:"toUserID" binding:"required"`
FromUserID string `json:"fromUserID" binding:"required"` FromUserID string `json:"fromUserID" binding:"required"`
} }
type AddBlacklistReq struct { type AddBlacklistReq struct {
paramsCommFriend ParamsCommFriend
} }
type AddBlacklistResp struct { type AddBlacklistResp struct {
CommResp CommResp
@ -26,7 +26,7 @@ type ImportFriendResp struct {
} }
type AddFriendReq struct { type AddFriendReq struct {
paramsCommFriend ParamsCommFriend
ReqMsg string `json:"reqMsg"` ReqMsg string `json:"reqMsg"`
} }
type AddFriendResp struct { type AddFriendResp struct {
@ -34,7 +34,7 @@ type AddFriendResp struct {
} }
type AddFriendResponseReq struct { type AddFriendResponseReq struct {
paramsCommFriend ParamsCommFriend
Flag int32 `json:"flag" binding:"required"` Flag int32 `json:"flag" binding:"required"`
HandleMsg string `json:"handleMsg"` HandleMsg string `json:"handleMsg"`
} }
@ -43,14 +43,14 @@ type AddFriendResponseResp struct {
} }
type DeleteFriendReq struct { type DeleteFriendReq struct {
paramsCommFriend ParamsCommFriend
} }
type DeleteFriendResp struct { type DeleteFriendResp struct {
CommResp CommResp
} }
type GetBlackListReq struct { type GetBlackListReq struct {
paramsCommFriend ParamsCommFriend
} }
type GetBlackListResp struct { type GetBlackListResp struct {
CommResp CommResp
@ -69,7 +69,7 @@ type BlackUserInfo struct {
} }
type SetFriendCommentReq struct { type SetFriendCommentReq struct {
paramsCommFriend ParamsCommFriend
Remark string `json:"remark" binding:"required"` Remark string `json:"remark" binding:"required"`
} }
type SetFriendCommentResp struct { type SetFriendCommentResp struct {
@ -77,14 +77,14 @@ type SetFriendCommentResp struct {
} }
type RemoveBlackListReq struct { type RemoveBlackListReq struct {
paramsCommFriend ParamsCommFriend
} }
type RemoveBlackListResp struct { type RemoveBlackListResp struct {
CommResp CommResp
} }
type IsFriendReq struct { type IsFriendReq struct {
paramsCommFriend ParamsCommFriend
} }
type IsFriendResp struct { type IsFriendResp struct {
CommResp CommResp
@ -92,7 +92,7 @@ type IsFriendResp struct {
} }
type GetFriendsInfoReq struct { type GetFriendsInfoReq struct {
paramsCommFriend ParamsCommFriend
} }
type GetFriendsInfoResp struct { type GetFriendsInfoResp struct {
CommResp CommResp
@ -100,7 +100,7 @@ type GetFriendsInfoResp struct {
} }
type GetFriendListReq struct { type GetFriendListReq struct {
paramsCommFriend ParamsCommFriend
} }
type GetFriendListResp struct { type GetFriendListResp struct {
CommResp CommResp
@ -108,7 +108,7 @@ type GetFriendListResp struct {
} }
type GetFriendApplyListReq struct { type GetFriendApplyListReq struct {
paramsCommFriend ParamsCommFriend
} }
type GetFriendApplyListResp struct { type GetFriendApplyListResp struct {
CommResp CommResp
@ -116,7 +116,7 @@ type GetFriendApplyListResp struct {
} }
type GetSelfApplyListReq struct { type GetSelfApplyListReq struct {
paramsCommFriend ParamsCommFriend
} }
type GetSelfApplyListResp struct { type GetSelfApplyListResp struct {
CommResp CommResp

Loading…
Cancel
Save