From 9f55418bfb5bb53ac4a7da17d11ddf60ab80fa9b Mon Sep 17 00:00:00 2001 From: wenxu12345 <44203734@qq.com> Date: Wed, 29 Dec 2021 17:52:01 +0800 Subject: [PATCH] Refactor code --- internal/api/group/group.go | 2 +- internal/rpc/group/group.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/api/group/group.go b/internal/api/group/group.go index 952962f59..688686112 100644 --- a/internal/api/group/group.go +++ b/internal/api/group/group.go @@ -253,7 +253,7 @@ func CreateGroup(c *gin.Context) { if RpcResp.ErrCode == 0 { utils.CopyStructFields(&resp.GroupInfo, RpcResp.GroupInfo) } - log.NewInfo(req.OperationID, "InviteUserToGroup api return ", resp) + log.NewInfo(req.OperationID, "CreateGroup api return ", resp) c.JSON(http.StatusOK, resp) } diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 01192c049..287d172aa 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -111,7 +111,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR for _, user := range req.InitMemberList { us, err := im_mysql_model.GetUserByUserID(user.UserID) if err != nil { - log.NewError(req.OperationID, "FindUserByUID failed ", err.Error(), user.UserID) + log.NewError(req.OperationID, "GetUserByUserID failed ", err.Error(), user.UserID) continue } if user.RoleLevel == constant.GroupOwner { @@ -133,7 +133,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR } } - resp := &pbGroup.CreateGroupResp{} + resp := &pbGroup.CreateGroupResp{GroupInfo: &open_im_sdk.GroupInfo{}} group, err := im_mysql_model.GetGroupInfoByGroupID(groupId) if err != nil { log.NewError(req.OperationID, "GetGroupInfoByGroupID failed ", err.Error(), groupId) @@ -143,7 +143,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR } chat.GroupCreatedNotification(req.OperationID, req.OpUserID, req.OwnerUserID, groupId, okUserIDList) utils.CopyStructFields(resp.GroupInfo, group) - resp.GroupInfo.MemberCount = uint32(imdb.GetGroupMemberNumByGroupID(groupId)) + resp.GroupInfo.MemberCount = imdb.GetGroupMemberNumByGroupID(groupId) resp.GroupInfo.OwnerUserID = req.OwnerUserID log.NewInfo(req.OperationID, "rpc CreateGroup return ", resp.String())