From 69e94c25f4ed34966cce80601f0c0aa91c56bc89 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Thu, 12 Jan 2023 16:04:12 +0800 Subject: [PATCH] 1 --- internal/api/friend/friend1.go | 9 ++++----- internal/api/group/group.go | 8 ++++---- pkg/common/trace_log/ctx.go | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/internal/api/friend/friend1.go b/internal/api/friend/friend1.go index 88e5c56ea..0eb2ca79a 100644 --- a/internal/api/friend/friend1.go +++ b/internal/api/friend/friend1.go @@ -4,7 +4,6 @@ import ( common "Open_IM/internal/api_to_rpc" api "Open_IM/pkg/base_info" "Open_IM/pkg/common/config" - "Open_IM/pkg/common/token_verify" rpc "Open_IM/pkg/proto/friend" "Open_IM/pkg/utils" "github.com/gin-gonic/gin" @@ -13,20 +12,20 @@ import ( // 不一致 func AddBlacklist(c *gin.Context) { common.ApiToRpc(c, &api.AddBlacklistReq{}, &api.AddBlacklistResp{}, - config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName(), token_verify.ParseUserIDFromToken) + config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName()) } func ImportFriend1(c *gin.Context) { common.ApiToRpc(c, &api.ImportFriendReq{}, &api.ImportFriendResp{}, - config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName(), token_verify.ParseUserIDFromToken) + config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName()) } func AddFriend1(c *gin.Context) { common.ApiToRpc(c, &api.AddFriendReq{}, &api.AddFriendResp{}, - config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName(), token_verify.ParseUserIDFromToken) + config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName()) } func AddFriendResponse1(c *gin.Context) { common.ApiToRpc(c, &api.AddFriendResponseReq{}, &api.AddFriendResponseResp{}, - config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName(), token_verify.ParseUserIDFromToken) + config.Config.RpcRegisterName.OpenImFriendName, rpc.NewFriendClient, utils.GetSelfFuncName()) } diff --git a/internal/api/group/group.go b/internal/api/group/group.go index c1cab11e0..ce96bd3e8 100644 --- a/internal/api/group/group.go +++ b/internal/api/group/group.go @@ -445,7 +445,7 @@ func InviteUserToGroup(c *gin.Context) { func NewCreateGroup(c *gin.Context) { common.ApiToRpc(c, &api.CreateGroupReq{}, &api.CreateGroupResp{}, - config.Config.RpcRegisterName.OpenImGroupName, rpc.NewGroupClient, "CreateGroup", token_verify.ParseUserIDFromToken) + config.Config.RpcRegisterName.OpenImGroupName, rpc.NewGroupClient, "CreateGroup") } // @Summary 获取用户收到的加群信息列表 @@ -515,7 +515,7 @@ func GetRecvGroupApplicationList(c *gin.Context) { // @Router /group/get_user_req_group_applicationList [post] func GetUserReqGroupApplicationList(c *gin.Context) { common.ApiToRpc(c, &api.GetUserReqGroupApplicationListReq{}, &api.GetUserRespGroupApplicationResp{}, - config.Config.RpcRegisterName.OpenImGroupName, rpc.NewGroupClient, "GetGroupApplicationList", token_verify.ParseUserIDFromToken) + config.Config.RpcRegisterName.OpenImGroupName, rpc.NewGroupClient, "GetGroupApplicationList") } // @Summary 通过群ID列表获取群信息 @@ -803,7 +803,7 @@ func QuitGroup(c *gin.Context) { func NewSetGroupInfo(c *gin.Context) { common.ApiToRpc(c, &api.SetGroupInfoReq{}, &api.SetGroupInfoResp{}, - config.Config.RpcRegisterName.OpenImGroupName, rpc.NewGroupClient, "SetGroupInfo", token_verify.ParseUserIDFromToken) + config.Config.RpcRegisterName.OpenImGroupName, rpc.NewGroupClient, "SetGroupInfo") } func argsHandle(params *api.SetGroupInfoReq, req *rpc.SetGroupInfoReq) { @@ -1263,7 +1263,7 @@ func GetGroupAbstractInfo(c *gin.Context) { GroupMemberListHash uint64 `json:"groupMemberListHash"` } //common.ApiToRpc(c, &api.GetGroupAbstractInfoReq{}, &GetGroupAbstractInfoResp{}, config.Config.RpcRegisterName.OpenImGroupName, rpc.NewGroupClient, utils.GetSelfFuncName(), token_verify.ParseUserIDFromToken) - common.ApiToRpc(c, &api.GetGroupAbstractInfoReq{}, &GetGroupAbstractInfoResp{}, config.Config.RpcRegisterName.OpenImGroupName, rpc.NewGroupClient, utils.GetSelfFuncName(), nil) + common.ApiToRpc(c, &api.GetGroupAbstractInfoReq{}, &GetGroupAbstractInfoResp{}, config.Config.RpcRegisterName.OpenImGroupName, rpc.NewGroupClient, utils.GetSelfFuncName()) //var ( //req api.GetGroupAbstractInfoReq diff --git a/pkg/common/trace_log/ctx.go b/pkg/common/trace_log/ctx.go index db264491e..276f59b01 100644 --- a/pkg/common/trace_log/ctx.go +++ b/pkg/common/trace_log/ctx.go @@ -65,7 +65,7 @@ func WriteErrorResponse(ctx context.Context, funcName string, err error, args .. ctx.Value(TraceLogKey).(*ApiInfo).GinCtx.JSON(http.StatusOK, gin.H{"errCode": t.ErrCode, "errMsg": t.ErrMsg, "errDtl": t.DetailErrMsg}) return default: - s, ok := status.FromError(err) + s, ok := status.FromError(e) if !ok { ctx.Value(TraceLogKey).(*ApiInfo).GinCtx.JSON(http.StatusOK, gin.H{"errCode": constant.ErrDefaultOther.ErrCode, "errMsg": err.Error(), "errDtl": fmt.Sprintf("%+v", err)}) return