From ac3159193fe9ea230d300abee8de9e9e3dfc63ac Mon Sep 17 00:00:00 2001 From: wenxu12345 <44203734@qq.com> Date: Thu, 30 Dec 2021 09:26:40 +0800 Subject: [PATCH] Refactor code --- internal/api/group/group.go | 2 +- internal/rpc/group/group.go | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/internal/api/group/group.go b/internal/api/group/group.go index 93e20839b..8905b641d 100644 --- a/internal/api/group/group.go +++ b/internal/api/group/group.go @@ -414,8 +414,8 @@ func QuitGroup(c *gin.Context) { return } resp := api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg} + log.NewInfo(req.OperationID, "QuitGroup api return", RpcResp.String()) c.JSON(http.StatusOK, resp) - log.NewInfo("QuitGroup api return", RpcResp.String()) } func SetGroupInfo(c *gin.Context) { diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 4bb29db9c..615e69efa 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -478,11 +478,10 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) } func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq) (*pbGroup.QuitGroupResp, error) { - log.NewError("QuitGroup args ", req.String()) - + log.NewError(req.OperationID, "QuitGroup args ", req.String()) _, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(req.GroupID, req.OpUserID) if err != nil { - log.NewError(req.OperationID, "GetGroupMemberInfoByGroupIDAndUserID failed", err.Error(), req.GroupID, req.OpUserID) + log.NewError(req.OperationID, "GetGroupMemberInfoByGroupIDAndUserID failed ", err.Error(), req.GroupID, req.OpUserID) return &pbGroup.QuitGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil } @@ -499,7 +498,7 @@ func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq) } chat.MemberLeaveNotification(req) - log.NewInfo(req.OperationID, "rpc QuitGroup return ") + log.NewInfo(req.OperationID, "rpc QuitGroup return ", pbGroup.QuitGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}) return &pbGroup.QuitGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}, nil }