From 26e130122cb905655db7353df66b886661e30b61 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Wed, 1 Feb 2023 12:00:29 +0800 Subject: [PATCH 01/10] 1 --- internal/rpc/group/group.go | 321 +++++++++++-------------- pkg/common/db/controller/group.go | 51 +++- pkg/proto/group/group.pb.go | 374 +++++++++++++++--------------- 3 files changed, 372 insertions(+), 374 deletions(-) diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index ea23d068f..2445258b1 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -14,8 +14,8 @@ import ( promePkg "Open_IM/pkg/common/prometheus" "Open_IM/pkg/common/token_verify" "Open_IM/pkg/common/tracelog" + "fmt" - cp "Open_IM/internal/utils" "Open_IM/pkg/getcdv3" pbConversation "Open_IM/pkg/proto/conversation" pbGroup "Open_IM/pkg/proto/group" @@ -144,7 +144,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR return nil, constant.ErrArgs.Wrap("no group owner") } var userIDs []string - for _, userID := range req.InitMemberList { + for _, userID := range req.InitMembers { userIDs = append(userIDs, userID) } for _, userID := range req.AdminUserIDs { @@ -179,12 +179,11 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR return nil, err } } else { - opUserID := utils.OpUserID(ctx) joinGroup := func(userID string, roleLevel int32) error { user := userMap[userID] - groupMember := &relation.GroupMember{GroupID: group.GroupID, RoleLevel: roleLevel, OperatorUserID: opUserID, JoinSource: constant.JoinByInvitation, InviterUserID: opUserID} + groupMember := &relation.GroupMember{GroupID: group.GroupID, RoleLevel: roleLevel, OperatorUserID: tracelog.GetOpUserID(ctx), JoinSource: constant.JoinByInvitation, InviterUserID: tracelog.GetOpUserID(ctx)} utils.CopyStructFields(&groupMember, user) - if err := CallbackBeforeMemberJoinGroup(ctx, utils.OperationID(ctx), groupMember, group.Ex); err != nil { + if err := CallbackBeforeMemberJoinGroup(ctx, tracelog.GetOperationID(ctx), groupMember, group.Ex); err != nil { return err } groupMembers = append(groupMembers, groupMember) @@ -198,7 +197,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR return nil, err } } - for _, userID := range req.InitMemberList { + for _, userID := range req.InitMembers { if err := joinGroup(userID, constant.GroupOrdinaryUsers); err != nil { return nil, err } @@ -212,11 +211,11 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR if req.GroupInfo.GroupType == constant.SuperGroup { go func() { for _, userID := range userIDs { - chat.SuperGroupNotification(utils.OperationID(ctx), userID, userID) + chat.SuperGroupNotification(tracelog.GetOperationID(ctx), userID, userID) } }() } else { - chat.GroupCreatedNotification(utils.OperationID(ctx), utils.OpUserID(ctx), group.GroupID, userIDs) + chat.GroupCreatedNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), group.GroupID, userIDs) } return resp, nil } @@ -255,18 +254,18 @@ func (s *groupServer) GetJoinedGroupList(ctx context.Context, req *pbGroup.GetJo groupNode.OwnerUserID = groupOwnerUserID[group.GroupID] groupNode.CreateTime = group.CreateTime.UnixMilli() groupNode.NotificationUpdateTime = group.NotificationUpdateTime.UnixMilli() - resp.GroupList = append(resp.GroupList, &groupNode) + resp.Groups = append(resp.Groups, &groupNode) } - resp.Total = int32(len(resp.GroupList)) + resp.Total = int32(len(resp.Groups)) return resp, nil } func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.InviteUserToGroupReq) (*pbGroup.InviteUserToGroupResp, error) { resp := &pbGroup.InviteUserToGroupResp{} - if len(req.InvitedUserIDList) == 0 { + if len(req.InvitedUserIDs) == 0 { return nil, constant.ErrArgs.Wrap("user empty") } - if utils.IsDuplicateID(req.InvitedUserIDList) { + if utils.IsDuplicateID(req.InvitedUserIDs) { return nil, constant.ErrArgs.Wrap("userID duplicate") } group, err := s.GroupInterface.TakeGroupByID(ctx, req.GroupID) @@ -284,30 +283,30 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite for i, member := range members { memberMap[member.GroupID] = members[i] } - for _, userID := range req.InvitedUserIDList { + for _, userID := range req.InvitedUserIDs { if _, ok := memberMap[userID]; ok { return nil, constant.ErrArgs.Wrap("user in group " + userID) } } - userMap, err := getUserMap(ctx, req.InvitedUserIDList) + userMap, err := getUserMap(ctx, req.InvitedUserIDs) if err != nil { return nil, err } - for _, userID := range req.InvitedUserIDList { + for _, userID := range req.InvitedUserIDs { if _, ok := userMap[userID]; !ok { return nil, constant.ErrUserIDNotFound.Wrap(userID) } } if group.NeedVerification == constant.AllNeedVerification { if !token_verify.IsAppManagerUid(ctx) { - opUserID := utils.OpUserID(ctx) + opUserID := tracelog.GetOpUserID(ctx) member, ok := memberMap[opUserID] if ok { return nil, constant.ErrNoPermission.Wrap("not in group") } if !(member.RoleLevel == constant.GroupOwner || member.RoleLevel == constant.GroupAdmin) { var requests []*relation.GroupRequest - for _, userID := range req.InvitedUserIDList { + for _, userID := range req.InvitedUserIDs { requests = append(requests, &relation.GroupRequest{ UserID: userID, GroupID: req.GroupID, @@ -331,24 +330,25 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite } } if group.GroupType == constant.SuperGroup { - if err := s.GroupInterface.AddUserToSuperGroup(ctx, req.GroupID, req.InvitedUserIDList); err != nil { + if err := s.GroupInterface.AddUserToSuperGroup(ctx, req.GroupID, req.InvitedUserIDs); err != nil { return nil, err } - for _, userID := range req.InvitedUserIDList { - chat.SuperGroupNotification(utils.OperationID(ctx), userID, userID) + for _, userID := range req.InvitedUserIDs { + chat.SuperGroupNotification(tracelog.GetOperationID(ctx), userID, userID) } } else { + opUserID := tracelog.GetOpUserID(ctx) var groupMembers []*relation.GroupMember - for _, userID := range req.InvitedUserIDList { + for _, userID := range req.InvitedUserIDs { user := userMap[userID] var member relation.GroupMember utils.CopyStructFields(&member, user) member.GroupID = req.GroupID member.RoleLevel = constant.GroupOrdinaryUsers - member.OperatorUserID = utils.OpUserID(ctx) - member.InviterUserID = utils.OpUserID(ctx) + member.OperatorUserID = opUserID + member.InviterUserID = opUserID member.JoinSource = constant.JoinByInvitation - if err := CallbackBeforeMemberJoinGroup(ctx, utils.OperationID(ctx), &member, group.Ex); err != nil { + if err := CallbackBeforeMemberJoinGroup(ctx, tracelog.GetOperationID(ctx), &member, group.Ex); err != nil { return nil, err } groupMembers = append(groupMembers, &member) @@ -356,7 +356,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite if err := s.GroupInterface.CreateGroupMember(ctx, groupMembers); err != nil { return nil, err } - chat.MemberInvitedNotification(utils.OperationID(ctx), req.GroupID, utils.OpUserID(ctx), req.Reason, req.InvitedUserIDList) + chat.MemberInvitedNotification(tracelog.GetOperationID(ctx), req.GroupID, tracelog.GetOpUserID(ctx), req.Reason, req.InvitedUserIDs) } return resp, nil } @@ -379,7 +379,7 @@ func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGro for _, member := range members { var node open_im_sdk.GroupMemberFullInfo utils.CopyStructFields(&node, member) - resp.MemberList = append(resp.MemberList, &node) + resp.Members = append(resp.Members, &node) } } return resp, nil @@ -387,20 +387,14 @@ func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGro func (s *groupServer) GetGroupMemberList(ctx context.Context, req *pbGroup.GetGroupMemberListReq) (*pbGroup.GetGroupMemberListResp, error) { resp := &pbGroup.GetGroupMemberListResp{} - memberList, err := s.GroupInterface.GetGroupMemberFilterList(ctx, req.GroupID, req.Filter, req.NextSeq, 30) + members, err := s.GroupInterface.GetGroupMemberFilterList(ctx, req.GroupID, req.Filter, req.Pagination.PageNumber, req.Pagination.ShowNumber) if err != nil { return nil, err } - for _, v := range memberList { - var node open_im_sdk.GroupMemberFullInfo - utils.CopyStructFields(&node, &v) - resp.MemberList = append(resp.MemberList, &node) - } - //db operate get db sorted by join time - if int32(len(memberList)) < 30 { - resp.NextSeq = 0 - } else { - resp.NextSeq = req.NextSeq + int32(len(memberList)) + for _, member := range members { + var info open_im_sdk.GroupMemberFullInfo + utils.CopyStructFields(&info, &member) + resp.Members = append(resp.Members, &info) } return resp, nil } @@ -415,132 +409,86 @@ func (s *groupServer) getGroupUserLevel(groupID, userID string) (int, error) { if opInfo.RoleLevel == constant.GroupOrdinaryUsers { opFlag = 0 } else if opInfo.RoleLevel == constant.GroupOwner { - opFlag = 2 //owner + opFlag = 2 // owner } else { - opFlag = 3 //admin + opFlag = 3 // admin } } else { - opFlag = 1 //app manager + opFlag = 1 // app manager } return opFlag, nil } func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGroupMemberReq) (*pbGroup.KickGroupMemberResp, error) { resp := &pbGroup.KickGroupMemberResp{} - - groupInfo, err := rocksCache.GetGroupInfoFromCache(ctx, req.GroupID) + group, err := s.GroupInterface.TakeGroupByID(ctx, req.GroupID) if err != nil { return nil, err } - var okUserIDList []string - if groupInfo.GroupType != constant.SuperGroup { - opFlag := 0 - if !token_verify.IsManagerUserID(utils.OpUserID(ctx)) { - opInfo, err := rocksCache.GetGroupMemberInfoFromCache(ctx, req.GroupID, utils.OpUserID(ctx)) - if err != nil { - return nil, err - } - if opInfo.RoleLevel == constant.GroupOrdinaryUsers { - return nil, utils.Wrap(constant.ErrNoPermission, "") - } else if opInfo.RoleLevel == constant.GroupOwner { - opFlag = 2 //owner - } else { - opFlag = 3 //admin - } - } else { - opFlag = 1 //app manager - } - - //op is group owner? - if len(req.KickedUserIDList) == 0 { - //log.NewError(req.OperationID, "failed, kick list 0") - //return &pbGroup.KickGroupMemberResp{ErrCode: constant.ErrArgs.ErrCode, ErrMsg: constant.ErrArgs.ErrMsg}, nil - return nil, utils.Wrap(constant.ErrArgs, "") - } - if err := s.DelGroupAndUserCache(ctx, req.GroupID, req.KickedUserIDList); err != nil { - return nil, err - } - //remove - for _, v := range req.KickedUserIDList { - kickedInfo, err := rocksCache.GetGroupMemberInfoFromCache(ctx, req.GroupID, v) - if err != nil { - resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: -1}) - tracelog.SetCtxInfo(ctx, "GetGroupMemberInfoFromCache", err, "groupID", req.GroupID, "userID", v) - continue - } - - if kickedInfo.RoleLevel == constant.GroupAdmin && opFlag == 3 { - resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: -1}) - tracelog.SetCtxInfo(ctx, "", nil, "msg", "is constant.GroupAdmin, can't kicked", "groupID", req.GroupID, "userID", v) - continue - } - if kickedInfo.RoleLevel == constant.GroupOwner && opFlag != 1 { - resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: -1}) - tracelog.SetCtxInfo(ctx, "", nil, "msg", "is constant.GroupOwner, can't kicked", "groupID", req.GroupID, "userID", v) - continue - } - - err = relation.DeleteGroupMemberByGroupIDAndUserID(req.GroupID, v) - tracelog.SetCtxInfo(ctx, "RemoveGroupMember", err, "groupID", req.GroupID, "userID", v) - if err != nil { - log.NewError(utils.OperationID(ctx), "RemoveGroupMember failed ", err.Error(), req.GroupID, v) - resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: -1}) - } else { - resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: 0}) - okUserIDList = append(okUserIDList, v) - } - } - var reqPb pbUser.SetConversationReq - var c pbConversation.Conversation - for _, v := range okUserIDList { - reqPb.OperationID = utils.OperationID(ctx) - c.OwnerUserID = v - c.ConversationID = utils.GetConversationIDBySessionType(req.GroupID, constant.GroupChatType) - c.ConversationType = constant.GroupChatType - c.GroupID = req.GroupID - c.IsNotInGroup = true - reqPb.Conversation = &c - etcdConn, err := getcdv3.GetConn(ctx, config.Config.RpcRegisterName.OpenImUserName) - if err != nil { - return nil, err - } - client := pbUser.NewUserClient(etcdConn) - respPb, err := client.SetConversation(context.Background(), &reqPb) - tracelog.SetCtxInfo(ctx, "SetConversation", err, "req", &reqPb, "resp", respPb) - } - } else { - okUserIDList = req.KickedUserIDList - if err := db.DB.RemoverUserFromSuperGroup(req.GroupID, okUserIDList); err != nil { - return nil, err - } + if len(req.KickedUserIDs) == 0 { + return nil, constant.ErrArgs.Wrap("KickedUserIDs empty") } - - if groupInfo.GroupType != constant.SuperGroup { - for _, userID := range okUserIDList { - if err := rocksCache.DelGroupMemberInfoFromCache(ctx, req.GroupID, userID); err != nil { - tracelog.SetCtxInfo(ctx, "DelGroupMemberInfoFromCache", err, "groupID", req.GroupID, "userID", userID) - } - } - chat.MemberKickedNotification(req, okUserIDList) - } else { - for _, userID := range okUserIDList { - if err = rocksCache.DelJoinedSuperGroupIDListFromCache(ctx, userID); err != nil { - tracelog.SetCtxInfo(ctx, "DelGroupMemberInfoFromCache", err, "userID", userID) - } + if utils.IsDuplicateStringSlice(req.KickedUserIDs) { + return nil, constant.ErrArgs.Wrap("KickedUserIDs duplicate") + } + opUserID := tracelog.GetOpUserID(ctx) + if utils.IsContain(opUserID, req.KickedUserIDs) { + return nil, constant.ErrArgs.Wrap("opUserID in KickedUserIDs") + } + if group.GroupType == constant.SuperGroup { + if err := s.GroupInterface.DelSuperGroupMember(ctx, req.GroupID, req.KickedUserIDs); err != nil { + return nil, err } go func() { - for _, v := range req.KickedUserIDList { - chat.SuperGroupNotification(utils.OperationID(ctx), v, v) + for _, userID := range req.KickedUserIDs { + chat.SuperGroupNotification(tracelog.GetOperationID(ctx), userID, userID) } }() - + } else { + members, err := s.GroupInterface.FindGroupMembersByID(ctx, req.GroupID, append(req.KickedUserIDs, opUserID)) + if err != nil { + return nil, err + } + memberMap := make(map[string]*relation.GroupMember) + for i, member := range members { + memberMap[member.UserID] = members[i] + } + for _, userID := range req.KickedUserIDs { + if _, ok := memberMap[userID]; !ok { + return nil, constant.ErrUserIDNotFound.Wrap(userID) + } + } + if !token_verify.IsAppManagerUid(ctx) { + member := memberMap[opUserID] + if member == nil { + return nil, constant.ErrNoPermission.Wrap(fmt.Sprintf("opUserID %s no in group", opUserID)) + } + switch member.RoleLevel { + case constant.GroupOwner: + case constant.GroupAdmin: + for _, member := range members { + if member.UserID == opUserID { + continue + } + if member.RoleLevel == constant.GroupOwner || member.RoleLevel == constant.GroupAdmin { + return nil, constant.ErrNoPermission.Wrap("userID:" + member.UserID) + } + } + default: + return nil, constant.ErrNoPermission.Wrap("opUserID is OrdinaryUser") + } + } + if err := s.GroupInterface.DelGroupMember(ctx, group.GroupID, req.KickedUserIDs); err != nil { + return nil, err + } + chat.MemberKickedNotification(req, req.KickedUserIDs) } return resp, nil } func (s *groupServer) GetGroupMembersInfo(ctx context.Context, req *pbGroup.GetGroupMembersInfoReq) (*pbGroup.GetGroupMembersInfoResp, error) { resp := &pbGroup.GetGroupMembersInfoResp{} - members, err := s.GroupInterface.GetGroupMemberListByUserID(ctx, req.GroupID, req.MemberList) + members, err := s.GroupInterface.GetGroupMemberListByUserID(ctx, req.GroupID, req.Members) if err != nil { return nil, err } @@ -548,7 +496,7 @@ func (s *groupServer) GetGroupMembersInfo(ctx context.Context, req *pbGroup.GetG var memberNode open_im_sdk.GroupMemberFullInfo utils.CopyStructFields(&memberNode, member) memberNode.JoinTime = member.JoinTime.UnixMilli() - resp.MemberList = append(resp.MemberList, &memberNode) + resp.Members = append(resp.Members, &memberNode) } return resp, nil } @@ -578,15 +526,16 @@ func FillPublicUserInfoByUserID(operationID, userID string, userInfo *open_im_sd func (s *groupServer) GetGroupApplicationList(ctx context.Context, req *pbGroup.GetGroupApplicationListReq) (*pbGroup.GetGroupApplicationListResp, error) { resp := &pbGroup.GetGroupApplicationListResp{} - reply, err := relation.GetRecvGroupApplicationList(req.FromUserID) + reply, err := s.GroupInterface.GetGroupRecvApplicationList(ctx, req.FromUserID) if err != nil { return nil, err } + var errResult error tracelog.SetCtxInfo(ctx, "GetRecvGroupApplicationList", nil, " FromUserID: ", req.FromUserID, "GroupApplicationList: ", reply) for _, v := range reply { node := open_im_sdk.GroupRequest{UserInfo: &open_im_sdk.PublicUserInfo{}, GroupInfo: &open_im_sdk.GroupInfo{}} - err := FillGroupInfoByGroupID(utils.OperationID(ctx), v.GroupID, node.GroupInfo) + err := FillGroupInfoByGroupID(tracelog.GetOperationID(ctx), v.GroupID, node.GroupInfo) if err != nil { if !errors.Is(errors.Unwrap(err), constant.ErrDismissedAlready) { errResult = err @@ -594,7 +543,7 @@ func (s *groupServer) GetGroupApplicationList(ctx context.Context, req *pbGroup. continue } tracelog.SetCtxInfo(ctx, "FillGroupInfoByGroupID ", nil, " groupID: ", v.GroupID, " groupInfo: ", node.GroupInfo) - err = FillPublicUserInfoByUserID(utils.OperationID(ctx), v.UserID, node.UserInfo) + err = FillPublicUserInfoByUserID(tracelog.GetOperationID(ctx), v.UserID, node.UserInfo) if err != nil { errResult = err continue @@ -639,7 +588,7 @@ func CheckPermission(ctx context.Context, groupID string, userID string) (err er func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) (*pbGroup.GroupApplicationResponseResp, error) { resp := &pbGroup.GroupApplicationResponseResp{} - if err := CheckPermission(ctx, req.GroupID, utils.OpUserID(ctx)); err != nil { + if err := CheckPermission(ctx, req.GroupID, tracelog.GetOpUserID(ctx)); err != nil { return nil, err } groupRequest := getDBGroupRequest(ctx, req) @@ -655,7 +604,7 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup if err != nil { return nil, err } - err = CallbackBeforeMemberJoinGroup(ctx, utils.OperationID(ctx), member, groupInfo.Ex) + err = CallbackBeforeMemberJoinGroup(ctx, tracelog.GetOperationID(ctx), member, groupInfo.Ex) if err != nil { return nil, err } @@ -663,12 +612,12 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup if err != nil { return nil, err } - etcdCacheConn, err := fault_tolerant.GetDefaultConn(config.Config.RpcRegisterName.OpenImCacheName, utils.OperationID(ctx)) + etcdCacheConn, err := fault_tolerant.GetDefaultConn(config.Config.RpcRegisterName.OpenImCacheName, tracelog.GetOperationID(ctx)) if err != nil { return nil, err } cacheClient := pbCache.NewCacheClient(etcdCacheConn) - cacheResp, err := cacheClient.DelGroupMemberIDListFromCache(context.Background(), &pbCache.DelGroupMemberIDListFromCacheReq{OperationID: utils.OperationID(ctx), GroupID: req.GroupID}) + cacheResp, err := cacheClient.DelGroupMemberIDListFromCache(context.Background(), &pbCache.DelGroupMemberIDListFromCacheReq{OperationID: tracelog.GetOperationID(ctx), GroupID: req.GroupID}) if err != nil { return nil, err } @@ -695,7 +644,7 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) (*pbGroup.JoinGroupResp, error) { resp := &pbGroup.JoinGroupResp{} - if _, err := relation.GetUserByUserID(utils.OpUserID(ctx)); err != nil { + if _, err := relation.GetUserByUserID(tracelog.GetOpUserID(ctx)); err != nil { return nil, err } groupInfo, err := rocksCache.GetGroupInfoFromCache(ctx, req.GroupID) @@ -708,17 +657,17 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) if groupInfo.NeedVerification == constant.Directly { if groupInfo.GroupType != constant.SuperGroup { - us, err := relation.GetUserByUserID(utils.OpUserID(ctx)) + us, err := relation.GetUserByUserID(tracelog.GetOpUserID(ctx)) if err != nil { return nil, err } //to group member - groupMember := relation.GroupMember{GroupID: req.GroupID, RoleLevel: constant.GroupOrdinaryUsers, OperatorUserID: utils.OpUserID(ctx)} + groupMember := relation.GroupMember{GroupID: req.GroupID, RoleLevel: constant.GroupOrdinaryUsers, OperatorUserID: tracelog.GetOpUserID(ctx)} utils.CopyStructFields(&groupMember, us) - if err := CallbackBeforeMemberJoinGroup(ctx, utils.OperationID(ctx), &groupMember, groupInfo.Ex); err != nil { + if err := CallbackBeforeMemberJoinGroup(ctx, tracelog.GetOperationID(ctx), &groupMember, groupInfo.Ex); err != nil { return nil, err } - if err := s.DelGroupAndUserCache(ctx, req.GroupID, []string{utils.OpUserID(ctx)}); err != nil { + if err := s.DelGroupAndUserCache(ctx, req.GroupID, []string{tracelog.GetOpUserID(ctx)}); err != nil { return nil, err } err = relation.InsertIntoGroupMember(groupMember) @@ -734,8 +683,8 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) } var reqPb pbUser.SetConversationReq var c pbConversation.Conversation - reqPb.OperationID = utils.OperationID(ctx) - c.OwnerUserID = utils.OpUserID(ctx) + reqPb.OperationID = tracelog.GetOperationID(ctx) + c.OwnerUserID = tracelog.GetOpUserID(ctx) c.ConversationID = utils.GetConversationIDBySessionType(req.GroupID, sessionType) c.ConversationType = int32(sessionType) c.GroupID = req.GroupID @@ -749,7 +698,7 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) client := pbUser.NewUserClient(etcdConn) respPb, err := client.SetConversation(context.Background(), &reqPb) tracelog.SetCtxInfo(ctx, "SetConversation", err, "req", reqPb, "resp", respPb) - chat.MemberEnterDirectlyNotification(req.GroupID, utils.OpUserID(ctx), utils.OperationID(ctx)) + chat.MemberEnterDirectlyNotification(req.GroupID, tracelog.GetOpUserID(ctx), tracelog.GetOperationID(ctx)) return resp, nil } else { constant.SetErrorForResp(constant.ErrGroupTypeNotSupport, resp.CommonResp) @@ -757,7 +706,7 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) } } var groupRequest relation.GroupRequest - groupRequest.UserID = utils.OpUserID(ctx) + groupRequest.UserID = tracelog.GetOpUserID(ctx) groupRequest.ReqMsg = req.ReqMessage groupRequest.GroupID = req.GroupID groupRequest.JoinSource = req.JoinSource @@ -777,31 +726,31 @@ func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq) return nil, err } if groupInfo.GroupType != constant.SuperGroup { - _, err = rocksCache.GetGroupMemberInfoFromCache(ctx, req.GroupID, utils.OpUserID(ctx)) + _, err = rocksCache.GetGroupMemberInfoFromCache(ctx, req.GroupID, tracelog.GetOpUserID(ctx)) if err != nil { return nil, err } - if err := s.DelGroupAndUserCache(ctx, req.GroupID, []string{utils.OpUserID(ctx)}); err != nil { + if err := s.DelGroupAndUserCache(ctx, req.GroupID, []string{tracelog.GetOpUserID(ctx)}); err != nil { return nil, err } - err = relation.DeleteGroupMemberByGroupIDAndUserID(req.GroupID, utils.OpUserID(ctx)) + err = relation.DeleteGroupMemberByGroupIDAndUserID(req.GroupID, tracelog.GetOpUserID(ctx)) if err != nil { return nil, err } } else { - okUserIDList := []string{utils.OpUserID(ctx)} + okUserIDList := []string{tracelog.GetOpUserID(ctx)} if err := db.DB.RemoverUserFromSuperGroup(req.GroupID, okUserIDList); err != nil { return nil, err } } if groupInfo.GroupType != constant.SuperGroup { - _ = rocksCache.DelGroupMemberInfoFromCache(ctx, req.GroupID, utils.OpUserID(ctx)) + _ = rocksCache.DelGroupMemberInfoFromCache(ctx, req.GroupID, tracelog.GetOpUserID(ctx)) chat.MemberQuitNotification(req) } else { - _ = rocksCache.DelJoinedSuperGroupIDListFromCache(ctx, utils.OpUserID(ctx)) + _ = rocksCache.DelJoinedSuperGroupIDListFromCache(ctx, tracelog.GetOpUserID(ctx)) _ = rocksCache.DelGroupMemberListHashFromCache(ctx, req.GroupID) - chat.SuperGroupNotification(utils.OperationID(ctx), utils.OpUserID(ctx), utils.OpUserID(ctx)) + chat.SuperGroupNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), tracelog.GetOpUserID(ctx)) } return resp, nil } @@ -870,7 +819,7 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf var groupInfo relation.Group utils.CopyStructFields(&groupInfo, req.GroupInfoForSet) if req.GroupInfoForSet.Notification != "" { - groupInfo.NotificationUserID = utils.OpUserID(ctx) + groupInfo.NotificationUserID = tracelog.GetOpUserID(ctx) groupInfo.NotificationUpdateTime = time.Now() } if err := rocksCache.DelGroupInfoFromCache(ctx, req.GroupInfoForSet.GroupID); err != nil { @@ -881,11 +830,11 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf return nil, err } if changedType != 0 { - chat.GroupInfoSetNotification(utils.OperationID(ctx), utils.OpUserID(ctx), req.GroupInfoForSet.GroupID, groupName, notification, introduction, faceURL, req.GroupInfoForSet.NeedVerification) + chat.GroupInfoSetNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), req.GroupInfoForSet.GroupID, groupName, notification, introduction, faceURL, req.GroupInfoForSet.NeedVerification) } if req.GroupInfoForSet.Notification != "" { //get group member user id - getGroupMemberIDListFromCacheReq := &pbCache.GetGroupMemberIDListFromCacheReq{OperationID: utils.OperationID(ctx), GroupID: req.GroupInfoForSet.GroupID} + getGroupMemberIDListFromCacheReq := &pbCache.GetGroupMemberIDListFromCacheReq{OperationID: tracelog.GetOperationID(ctx), GroupID: req.GroupInfoForSet.GroupID} etcdConn, err := getcdv3.GetConn(ctx, config.Config.RpcRegisterName.OpenImCacheName) if err != nil { return nil, err @@ -900,13 +849,13 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf } var conversationReq pbConversation.ModifyConversationFieldReq conversation := pbConversation.Conversation{ - OwnerUserID: utils.OpUserID(ctx), + OwnerUserID: tracelog.GetOpUserID(ctx), ConversationID: utils.GetConversationIDBySessionType(req.GroupInfoForSet.GroupID, constant.GroupChatType), ConversationType: constant.GroupChatType, GroupID: req.GroupInfoForSet.GroupID, } conversationReq.Conversation = &conversation - conversationReq.OperationID = utils.OperationID(ctx) + conversationReq.OperationID = tracelog.GetOperationID(ctx) conversationReq.FieldType = constant.FieldGroupAtType conversation.GroupAtType = constant.GroupNotification conversationReq.UserIDList = cacheResp.UserIDList @@ -1019,7 +968,7 @@ func (s *groupServer) GetGroupMembersCMS(ctx context.Context, req *pbGroup.GetGr if err != nil { return nil, err } - log.NewInfo(utils.OperationID(ctx), groupMembersCount) + log.NewInfo(tracelog.GetOperationID(ctx), groupMembersCount) resp.MemberNums = int32(groupMembersCount) for _, groupMember := range groupMembers { member := open_im_sdk.GroupMemberFullInfo{} @@ -1064,7 +1013,7 @@ func (s *groupServer) GetUserReqApplicationList(ctx context.Context, req *pbGrou func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGroupReq) (*pbGroup.DismissGroupResp, error) { resp := &pbGroup.DismissGroupResp{} - if !token_verify.IsManagerUserID(utils.OpUserID(ctx)) && !relation.IsGroupOwnerAdmin(req.GroupID, utils.OpUserID(ctx)) { + if !token_verify.IsManagerUserID(tracelog.GetOpUserID(ctx)) && !relation.IsGroupOwnerAdmin(req.GroupID, tracelog.GetOpUserID(ctx)) { return nil, utils.Wrap(constant.ErrIdentity, "") } @@ -1092,7 +1041,7 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou var reqPb pbUser.SetConversationReq var c pbConversation.Conversation for _, v := range memberList { - reqPb.OperationID = utils.OperationID(ctx) + reqPb.OperationID = tracelog.GetOperationID(ctx) c.OwnerUserID = v.UserID c.ConversationID = utils.GetConversationIDBySessionType(req.GroupID, constant.GroupChatType) c.ConversationType = constant.GroupChatType @@ -1121,7 +1070,7 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGroupMemberReq) (*pbGroup.MuteGroupMemberResp, error) { resp := &pbGroup.MuteGroupMemberResp{} - opFlag, err := s.getGroupUserLevel(req.GroupID, utils.OpUserID(ctx)) + opFlag, err := s.getGroupUserLevel(req.GroupID, tracelog.GetOpUserID(ctx)) if err != nil { return nil, err } @@ -1149,14 +1098,14 @@ func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGrou if err != nil { return nil, err } - chat.GroupMemberMutedNotification(utils.OperationID(ctx), utils.OpUserID(ctx), req.GroupID, req.UserID, req.MutedSeconds) + chat.GroupMemberMutedNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), req.GroupID, req.UserID, req.MutedSeconds) return resp, nil } func (s *groupServer) CancelMuteGroupMember(ctx context.Context, req *pbGroup.CancelMuteGroupMemberReq) (*pbGroup.CancelMuteGroupMemberResp, error) { resp := &pbGroup.CancelMuteGroupMemberResp{} - opFlag, err := s.getGroupUserLevel(req.GroupID, utils.OpUserID(ctx)) + opFlag, err := s.getGroupUserLevel(req.GroupID, tracelog.GetOpUserID(ctx)) if err != nil { return nil, err } @@ -1184,14 +1133,14 @@ func (s *groupServer) CancelMuteGroupMember(ctx context.Context, req *pbGroup.Ca if err != nil { return nil, err } - chat.GroupMemberCancelMutedNotification(utils.OperationID(ctx), utils.OpUserID(ctx), req.GroupID, req.UserID) + chat.GroupMemberCancelMutedNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), req.GroupID, req.UserID) return resp, nil } func (s *groupServer) MuteGroup(ctx context.Context, req *pbGroup.MuteGroupReq) (*pbGroup.MuteGroupResp, error) { resp := &pbGroup.MuteGroupResp{} - opFlag, err := s.getGroupUserLevel(req.GroupID, utils.OpUserID(ctx)) + opFlag, err := s.getGroupUserLevel(req.GroupID, tracelog.GetOpUserID(ctx)) if err != nil { return nil, err } @@ -1224,14 +1173,14 @@ func (s *groupServer) MuteGroup(ctx context.Context, req *pbGroup.MuteGroupReq) return nil, err } - chat.GroupMutedNotification(utils.OperationID(ctx), utils.OpUserID(ctx), req.GroupID) + chat.GroupMutedNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), req.GroupID) return resp, nil } func (s *groupServer) CancelMuteGroup(ctx context.Context, req *pbGroup.CancelMuteGroupReq) (*pbGroup.CancelMuteGroupResp, error) { resp := &pbGroup.CancelMuteGroupResp{} - opFlag, err := s.getGroupUserLevel(req.GroupID, utils.OpUserID(ctx)) + opFlag, err := s.getGroupUserLevel(req.GroupID, tracelog.GetOpUserID(ctx)) if err != nil { return nil, err } @@ -1251,7 +1200,7 @@ func (s *groupServer) CancelMuteGroup(ctx context.Context, req *pbGroup.CancelMu // errMsg := req.OperationID + " mutedInfo.RoleLevel == constant.GroupAdmin " + req.GroupID + req.OpUserID + err.Error() // return &pbGroup.CancelMuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil //} - log.Debug(utils.OperationID(ctx), "UpdateGroupInfoDefaultZero ", req.GroupID, map[string]interface{}{"status": constant.GroupOk}) + log.Debug(tracelog.GetOperationID(ctx), "UpdateGroupInfoDefaultZero ", req.GroupID, map[string]interface{}{"status": constant.GroupOk}) if err := rocksCache.DelGroupInfoFromCache(ctx, req.GroupID); err != nil { return nil, err } @@ -1259,13 +1208,13 @@ func (s *groupServer) CancelMuteGroup(ctx context.Context, req *pbGroup.CancelMu if err != nil { return nil, err } - chat.GroupCancelMutedNotification(utils.OperationID(ctx), utils.OpUserID(ctx), req.GroupID) + chat.GroupCancelMutedNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), req.GroupID) return resp, nil } func (s *groupServer) SetGroupMemberNickname(ctx context.Context, req *pbGroup.SetGroupMemberNicknameReq) (*pbGroup.SetGroupMemberNicknameResp, error) { resp := &pbGroup.SetGroupMemberNicknameResp{} - if utils.OpUserID(ctx) != req.UserID && !token_verify.IsManagerUserID(utils.OpUserID(ctx)) { + if tracelog.GetOpUserID(ctx) != req.UserID && !token_verify.IsManagerUserID(tracelog.GetOpUserID(ctx)) { return nil, utils.Wrap(constant.ErrIdentity, "") } cbReq := &pbGroup.SetGroupMemberInfoReq{ @@ -1297,7 +1246,7 @@ func (s *groupServer) SetGroupMemberNickname(ctx context.Context, req *pbGroup.S if err := relation.UpdateGroupMemberInfo(groupMemberInfo); err != nil { return nil, err } - chat.GroupMemberInfoSetNotification(utils.OperationID(ctx), utils.OpUserID(ctx), req.GroupID, req.UserID) + chat.GroupMemberInfoSetNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), req.GroupID, req.UserID) return resp, nil } @@ -1336,13 +1285,13 @@ func (s *groupServer) SetGroupMemberInfo(ctx context.Context, req *pbGroup.SetGr switch req.RoleLevel.Value { case constant.GroupOrdinaryUsers: //msg.GroupMemberRoleLevelChangeNotification(req.OperationID, req.OpUserID, req.GroupID, req.UserID, constant.GroupMemberSetToOrdinaryUserNotification) - chat.GroupMemberInfoSetNotification(utils.OperationID(ctx), utils.OpUserID(ctx), req.GroupID, req.UserID) + chat.GroupMemberInfoSetNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), req.GroupID, req.UserID) case constant.GroupAdmin, constant.GroupOwner: //msg.GroupMemberRoleLevelChangeNotification(req.OperationID, req.OpUserID, req.GroupID, req.UserID, constant.GroupMemberSetToAdminNotification) - chat.GroupMemberInfoSetNotification(utils.OperationID(ctx), utils.OpUserID(ctx), req.GroupID, req.UserID) + chat.GroupMemberInfoSetNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), req.GroupID, req.UserID) } } else { - chat.GroupMemberInfoSetNotification(utils.OperationID(ctx), utils.OpUserID(ctx), req.GroupID, req.UserID) + chat.GroupMemberInfoSetNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), req.GroupID, req.UserID) } return resp, nil } diff --git a/pkg/common/db/controller/group.go b/pkg/common/db/controller/group.go index 295698d93..e87cef316 100644 --- a/pkg/common/db/controller/group.go +++ b/pkg/common/db/controller/group.go @@ -17,19 +17,23 @@ type GroupInterface interface { CreateGroup(ctx context.Context, groups []*relation.Group, groupMember []*relation.GroupMember) error DeleteGroupByIDs(ctx context.Context, groupIDs []string) error TakeGroupByID(ctx context.Context, groupID string) (group *relation.Group, err error) + TakeGroupMemberByID(ctx context.Context, groupID string, userID string) (groupMember *relation.GroupMember, err error) GetJoinedGroupList(ctx context.Context, userID string) ([]*relation.Group, error) GetGroupMemberList(ctx context.Context, groupID string) ([]*relation.GroupMember, error) GetGroupMemberListByUserID(ctx context.Context, groupID string, userIDs []string) ([]*relation.GroupMember, error) GetGroupMemberFilterList(ctx context.Context, groupID string, filter int32, begin int32, maxNumber int32) ([]*relation.GroupMember, error) // relation.GetGroupMemberByGroupID(req.GroupID, req.Filter, req.NextSeq, 30) + FindGroupMembersByID(ctx context.Context, groupID string, userIDs []string) (groups []*relation.GroupMember, err error) + DelGroupMember(ctx context.Context, groupID string, userIDs []string) error GetGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]int, error) GetGroupOwnerUserID(ctx context.Context, groupIDs []string) (map[string]string, error) + GetGroupRecvApplicationList(ctx context.Context, userID string) ([]*relation.GroupRequest, error) CreateGroupMember(ctx context.Context, groupMember []*relation.GroupMember) error - CreateGroupRequest(ctx context.Context, requests []*relation.GroupRequest) error //mongo CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error + DelSuperGroupMember(ctx context.Context, groupID string, userIDs []string) error AddUserToSuperGroup(ctx context.Context, groupID string, userIDs []string) error GetSuperGroupByID(ctx context.Context, groupID string) (superGroup *unrelation.SuperGroup, err error) } @@ -40,6 +44,51 @@ type GroupController struct { database GroupDataBaseInterface } +func (g *GroupController) TakeGroupMemberByID(ctx context.Context, groupID string, userID string) (groupMember *relation.GroupMember, err error) { + //TODO implement me + panic("implement me") +} + +func (g *GroupController) FindGroupMembersByID(ctx context.Context, groupID string, userIDs []string) (groups []*relation.GroupMember, err error) { + //TODO implement me + panic("implement me") +} + +func (g *GroupController) DelGroupMember(ctx context.Context, groupID string, userIDs []string) error { + //TODO implement me + panic("implement me") +} + +func (g *GroupController) GetGroupRecvApplicationList(ctx context.Context, userID string) ([]*relation.GroupRequest, error) { + /* + var groupRequestList []db.GroupRequest + memberList, err := GetGroupMemberListByUserID(userID) + if err != nil { + return nil, err + } + for _, v := range memberList { + if v.RoleLevel > constant.GroupOrdinaryUsers { + list, err := GetGroupRequestByGroupID(v.GroupID) + if err != nil { + // fmt.Println("111 GetGroupRequestByGroupID failed ", err.Error()) + continue + } + // fmt.Println("222 GetGroupRequestByGroupID ok ", list) + groupRequestList = append(groupRequestList, list...) + // fmt.Println("333 GetGroupRequestByGroupID ok ", groupRequestList) + } + } + return groupRequestList, nil + */ + //TODO implement me + panic("implement me") +} + +func (g *GroupController) DelSuperGroupMember(ctx context.Context, groupID string, userIDs []string) error { + //TODO implement me + panic("implement me") +} + func (g *GroupController) GetJoinedGroupList(ctx context.Context, userID string) ([]*relation.Group, error) { //TODO implement me panic("implement me") diff --git a/pkg/proto/group/group.pb.go b/pkg/proto/group/group.pb.go index 129256e07..99c71e277 100644 --- a/pkg/proto/group/group.pb.go +++ b/pkg/proto/group/group.pb.go @@ -26,7 +26,7 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type CreateGroupReq struct { - InitMemberList []string `protobuf:"bytes,1,rep,name=initMemberList" json:"initMemberList,omitempty"` + InitMembers []string `protobuf:"bytes,1,rep,name=initMembers" json:"initMembers,omitempty"` GroupInfo *sdk_ws.GroupInfo `protobuf:"bytes,2,opt,name=groupInfo" json:"groupInfo,omitempty"` AdminUserIDs []string `protobuf:"bytes,3,rep,name=adminUserIDs" json:"adminUserIDs,omitempty"` OwnerUserID string `protobuf:"bytes,4,opt,name=ownerUserID" json:"ownerUserID,omitempty"` @@ -39,7 +39,7 @@ func (m *CreateGroupReq) Reset() { *m = CreateGroupReq{} } func (m *CreateGroupReq) String() string { return proto.CompactTextString(m) } func (*CreateGroupReq) ProtoMessage() {} func (*CreateGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{0} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{0} } func (m *CreateGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateGroupReq.Unmarshal(m, b) @@ -59,9 +59,9 @@ func (m *CreateGroupReq) XXX_DiscardUnknown() { var xxx_messageInfo_CreateGroupReq proto.InternalMessageInfo -func (m *CreateGroupReq) GetInitMemberList() []string { +func (m *CreateGroupReq) GetInitMembers() []string { if m != nil { - return m.InitMemberList + return m.InitMembers } return nil } @@ -98,7 +98,7 @@ func (m *CreateGroupResp) Reset() { *m = CreateGroupResp{} } func (m *CreateGroupResp) String() string { return proto.CompactTextString(m) } func (*CreateGroupResp) ProtoMessage() {} func (*CreateGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{1} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{1} } func (m *CreateGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateGroupResp.Unmarshal(m, b) @@ -136,7 +136,7 @@ func (m *GetGroupsInfoReq) Reset() { *m = GetGroupsInfoReq{} } func (m *GetGroupsInfoReq) String() string { return proto.CompactTextString(m) } func (*GetGroupsInfoReq) ProtoMessage() {} func (*GetGroupsInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{2} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{2} } func (m *GetGroupsInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupsInfoReq.Unmarshal(m, b) @@ -174,7 +174,7 @@ func (m *GetGroupsInfoResp) Reset() { *m = GetGroupsInfoResp{} } func (m *GetGroupsInfoResp) String() string { return proto.CompactTextString(m) } func (*GetGroupsInfoResp) ProtoMessage() {} func (*GetGroupsInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{3} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{3} } func (m *GetGroupsInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupsInfoResp.Unmarshal(m, b) @@ -212,7 +212,7 @@ func (m *SetGroupInfoReq) Reset() { *m = SetGroupInfoReq{} } func (m *SetGroupInfoReq) String() string { return proto.CompactTextString(m) } func (*SetGroupInfoReq) ProtoMessage() {} func (*SetGroupInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{4} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{4} } func (m *SetGroupInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGroupInfoReq.Unmarshal(m, b) @@ -249,7 +249,7 @@ func (m *SetGroupInfoResp) Reset() { *m = SetGroupInfoResp{} } func (m *SetGroupInfoResp) String() string { return proto.CompactTextString(m) } func (*SetGroupInfoResp) ProtoMessage() {} func (*SetGroupInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{5} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{5} } func (m *SetGroupInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGroupInfoResp.Unmarshal(m, b) @@ -281,7 +281,7 @@ func (m *GetGroupApplicationListReq) Reset() { *m = GetGroupApplicationL func (m *GetGroupApplicationListReq) String() string { return proto.CompactTextString(m) } func (*GetGroupApplicationListReq) ProtoMessage() {} func (*GetGroupApplicationListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{6} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{6} } func (m *GetGroupApplicationListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupApplicationListReq.Unmarshal(m, b) @@ -327,7 +327,7 @@ func (m *GetGroupApplicationListResp) Reset() { *m = GetGroupApplication func (m *GetGroupApplicationListResp) String() string { return proto.CompactTextString(m) } func (*GetGroupApplicationListResp) ProtoMessage() {} func (*GetGroupApplicationListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{7} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{7} } func (m *GetGroupApplicationListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupApplicationListResp.Unmarshal(m, b) @@ -373,7 +373,7 @@ func (m *GetUserReqApplicationListReq) Reset() { *m = GetUserReqApplicat func (m *GetUserReqApplicationListReq) String() string { return proto.CompactTextString(m) } func (*GetUserReqApplicationListReq) ProtoMessage() {} func (*GetUserReqApplicationListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{8} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{8} } func (m *GetUserReqApplicationListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserReqApplicationListReq.Unmarshal(m, b) @@ -419,7 +419,7 @@ func (m *GetUserReqApplicationListResp) Reset() { *m = GetUserReqApplica func (m *GetUserReqApplicationListResp) String() string { return proto.CompactTextString(m) } func (*GetUserReqApplicationListResp) ProtoMessage() {} func (*GetUserReqApplicationListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{9} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{9} } func (m *GetUserReqApplicationListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserReqApplicationListResp.Unmarshal(m, b) @@ -466,7 +466,7 @@ func (m *TransferGroupOwnerReq) Reset() { *m = TransferGroupOwnerReq{} } func (m *TransferGroupOwnerReq) String() string { return proto.CompactTextString(m) } func (*TransferGroupOwnerReq) ProtoMessage() {} func (*TransferGroupOwnerReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{10} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{10} } func (m *TransferGroupOwnerReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TransferGroupOwnerReq.Unmarshal(m, b) @@ -517,7 +517,7 @@ func (m *TransferGroupOwnerResp) Reset() { *m = TransferGroupOwnerResp{} func (m *TransferGroupOwnerResp) String() string { return proto.CompactTextString(m) } func (*TransferGroupOwnerResp) ProtoMessage() {} func (*TransferGroupOwnerResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{11} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{11} } func (m *TransferGroupOwnerResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TransferGroupOwnerResp.Unmarshal(m, b) @@ -551,7 +551,7 @@ func (m *JoinGroupReq) Reset() { *m = JoinGroupReq{} } func (m *JoinGroupReq) String() string { return proto.CompactTextString(m) } func (*JoinGroupReq) ProtoMessage() {} func (*JoinGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{12} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{12} } func (m *JoinGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_JoinGroupReq.Unmarshal(m, b) @@ -609,7 +609,7 @@ func (m *JoinGroupResp) Reset() { *m = JoinGroupResp{} } func (m *JoinGroupResp) String() string { return proto.CompactTextString(m) } func (*JoinGroupResp) ProtoMessage() {} func (*JoinGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{13} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{13} } func (m *JoinGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_JoinGroupResp.Unmarshal(m, b) @@ -643,7 +643,7 @@ func (m *GroupApplicationResponseReq) Reset() { *m = GroupApplicationRes func (m *GroupApplicationResponseReq) String() string { return proto.CompactTextString(m) } func (*GroupApplicationResponseReq) ProtoMessage() {} func (*GroupApplicationResponseReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{14} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{14} } func (m *GroupApplicationResponseReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupApplicationResponseReq.Unmarshal(m, b) @@ -701,7 +701,7 @@ func (m *GroupApplicationResponseResp) Reset() { *m = GroupApplicationRe func (m *GroupApplicationResponseResp) String() string { return proto.CompactTextString(m) } func (*GroupApplicationResponseResp) ProtoMessage() {} func (*GroupApplicationResponseResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{15} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{15} } func (m *GroupApplicationResponseResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupApplicationResponseResp.Unmarshal(m, b) @@ -732,7 +732,7 @@ func (m *QuitGroupReq) Reset() { *m = QuitGroupReq{} } func (m *QuitGroupReq) String() string { return proto.CompactTextString(m) } func (*QuitGroupReq) ProtoMessage() {} func (*QuitGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{16} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{16} } func (m *QuitGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_QuitGroupReq.Unmarshal(m, b) @@ -769,7 +769,7 @@ func (m *QuitGroupResp) Reset() { *m = QuitGroupResp{} } func (m *QuitGroupResp) String() string { return proto.CompactTextString(m) } func (*QuitGroupResp) ProtoMessage() {} func (*QuitGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{17} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{17} } func (m *QuitGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_QuitGroupResp.Unmarshal(m, b) @@ -802,7 +802,7 @@ func (m *GetGroupMemberListReq) Reset() { *m = GetGroupMemberListReq{} } func (m *GetGroupMemberListReq) String() string { return proto.CompactTextString(m) } func (*GetGroupMemberListReq) ProtoMessage() {} func (*GetGroupMemberListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{18} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{18} } func (m *GetGroupMemberListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMemberListReq.Unmarshal(m, b) @@ -855,7 +855,7 @@ func (m *GetGroupMemberListResp) Reset() { *m = GetGroupMemberListResp{} func (m *GetGroupMemberListResp) String() string { return proto.CompactTextString(m) } func (*GetGroupMemberListResp) ProtoMessage() {} func (*GetGroupMemberListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{19} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{19} } func (m *GetGroupMemberListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMemberListResp.Unmarshal(m, b) @@ -891,7 +891,7 @@ func (m *GetGroupMemberListResp) GetMembers() []*sdk_ws.GroupMemberFullInfo { type GetGroupMembersInfoReq struct { GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"` - MemberList []string `protobuf:"bytes,2,rep,name=memberList" json:"memberList,omitempty"` + Members []string `protobuf:"bytes,2,rep,name=members" json:"members,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -901,7 +901,7 @@ func (m *GetGroupMembersInfoReq) Reset() { *m = GetGroupMembersInfoReq{} func (m *GetGroupMembersInfoReq) String() string { return proto.CompactTextString(m) } func (*GetGroupMembersInfoReq) ProtoMessage() {} func (*GetGroupMembersInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{20} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{20} } func (m *GetGroupMembersInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMembersInfoReq.Unmarshal(m, b) @@ -928,9 +928,9 @@ func (m *GetGroupMembersInfoReq) GetGroupID() string { return "" } -func (m *GetGroupMembersInfoReq) GetMemberList() []string { +func (m *GetGroupMembersInfoReq) GetMembers() []string { if m != nil { - return m.MemberList + return m.Members } return nil } @@ -946,7 +946,7 @@ func (m *GetGroupMembersInfoResp) Reset() { *m = GetGroupMembersInfoResp func (m *GetGroupMembersInfoResp) String() string { return proto.CompactTextString(m) } func (*GetGroupMembersInfoResp) ProtoMessage() {} func (*GetGroupMembersInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{21} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{21} } func (m *GetGroupMembersInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMembersInfoResp.Unmarshal(m, b) @@ -975,7 +975,7 @@ func (m *GetGroupMembersInfoResp) GetMembers() []*sdk_ws.GroupMemberFullInfo { type KickGroupMemberReq struct { GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"` - KickedUserIDList []string `protobuf:"bytes,2,rep,name=kickedUserIDList" json:"kickedUserIDList,omitempty"` + KickedUserIDs []string `protobuf:"bytes,2,rep,name=kickedUserIDs" json:"kickedUserIDs,omitempty"` Reason string `protobuf:"bytes,3,opt,name=reason" json:"reason,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -986,7 +986,7 @@ func (m *KickGroupMemberReq) Reset() { *m = KickGroupMemberReq{} } func (m *KickGroupMemberReq) String() string { return proto.CompactTextString(m) } func (*KickGroupMemberReq) ProtoMessage() {} func (*KickGroupMemberReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{22} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{22} } func (m *KickGroupMemberReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_KickGroupMemberReq.Unmarshal(m, b) @@ -1013,9 +1013,9 @@ func (m *KickGroupMemberReq) GetGroupID() string { return "" } -func (m *KickGroupMemberReq) GetKickedUserIDList() []string { +func (m *KickGroupMemberReq) GetKickedUserIDs() []string { if m != nil { - return m.KickedUserIDList + return m.KickedUserIDs } return nil } @@ -1037,7 +1037,7 @@ func (m *KickGroupMemberResp) Reset() { *m = KickGroupMemberResp{} } func (m *KickGroupMemberResp) String() string { return proto.CompactTextString(m) } func (*KickGroupMemberResp) ProtoMessage() {} func (*KickGroupMemberResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{23} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{23} } func (m *KickGroupMemberResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_KickGroupMemberResp.Unmarshal(m, b) @@ -1069,7 +1069,7 @@ func (m *GetJoinedGroupListReq) Reset() { *m = GetJoinedGroupListReq{} } func (m *GetJoinedGroupListReq) String() string { return proto.CompactTextString(m) } func (*GetJoinedGroupListReq) ProtoMessage() {} func (*GetJoinedGroupListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{24} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{24} } func (m *GetJoinedGroupListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetJoinedGroupListReq.Unmarshal(m, b) @@ -1115,7 +1115,7 @@ func (m *GetJoinedGroupListResp) Reset() { *m = GetJoinedGroupListResp{} func (m *GetJoinedGroupListResp) String() string { return proto.CompactTextString(m) } func (*GetJoinedGroupListResp) ProtoMessage() {} func (*GetJoinedGroupListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{25} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{25} } func (m *GetJoinedGroupListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetJoinedGroupListResp.Unmarshal(m, b) @@ -1162,7 +1162,7 @@ func (m *InviteUserToGroupReq) Reset() { *m = InviteUserToGroupReq{} } func (m *InviteUserToGroupReq) String() string { return proto.CompactTextString(m) } func (*InviteUserToGroupReq) ProtoMessage() {} func (*InviteUserToGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{26} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{26} } func (m *InviteUserToGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InviteUserToGroupReq.Unmarshal(m, b) @@ -1213,7 +1213,7 @@ func (m *InviteUserToGroupResp) Reset() { *m = InviteUserToGroupResp{} } func (m *InviteUserToGroupResp) String() string { return proto.CompactTextString(m) } func (*InviteUserToGroupResp) ProtoMessage() {} func (*InviteUserToGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{27} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{27} } func (m *InviteUserToGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InviteUserToGroupResp.Unmarshal(m, b) @@ -1245,7 +1245,7 @@ func (m *GetGroupAllMemberReq) Reset() { *m = GetGroupAllMemberReq{} } func (m *GetGroupAllMemberReq) String() string { return proto.CompactTextString(m) } func (*GetGroupAllMemberReq) ProtoMessage() {} func (*GetGroupAllMemberReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{28} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{28} } func (m *GetGroupAllMemberReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupAllMemberReq.Unmarshal(m, b) @@ -1290,7 +1290,7 @@ func (m *GetGroupAllMemberResp) Reset() { *m = GetGroupAllMemberResp{} } func (m *GetGroupAllMemberResp) String() string { return proto.CompactTextString(m) } func (*GetGroupAllMemberResp) ProtoMessage() {} func (*GetGroupAllMemberResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{29} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{29} } func (m *GetGroupAllMemberResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupAllMemberResp.Unmarshal(m, b) @@ -1330,7 +1330,7 @@ func (m *CMSGroup) Reset() { *m = CMSGroup{} } func (m *CMSGroup) String() string { return proto.CompactTextString(m) } func (*CMSGroup) ProtoMessage() {} func (*CMSGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{30} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{30} } func (m *CMSGroup) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CMSGroup.Unmarshal(m, b) @@ -1384,7 +1384,7 @@ func (m *GetGroupsReq) Reset() { *m = GetGroupsReq{} } func (m *GetGroupsReq) String() string { return proto.CompactTextString(m) } func (*GetGroupsReq) ProtoMessage() {} func (*GetGroupsReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{31} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{31} } func (m *GetGroupsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupsReq.Unmarshal(m, b) @@ -1437,7 +1437,7 @@ func (m *GetGroupsResp) Reset() { *m = GetGroupsResp{} } func (m *GetGroupsResp) String() string { return proto.CompactTextString(m) } func (*GetGroupsResp) ProtoMessage() {} func (*GetGroupsResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{32} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{32} } func (m *GetGroupsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupsResp.Unmarshal(m, b) @@ -1482,7 +1482,7 @@ func (m *GetGroupMemberReq) Reset() { *m = GetGroupMemberReq{} } func (m *GetGroupMemberReq) String() string { return proto.CompactTextString(m) } func (*GetGroupMemberReq) ProtoMessage() {} func (*GetGroupMemberReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{33} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{33} } func (m *GetGroupMemberReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMemberReq.Unmarshal(m, b) @@ -1522,7 +1522,7 @@ func (m *GetGroupMembersCMSReq) Reset() { *m = GetGroupMembersCMSReq{} } func (m *GetGroupMembersCMSReq) String() string { return proto.CompactTextString(m) } func (*GetGroupMembersCMSReq) ProtoMessage() {} func (*GetGroupMembersCMSReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{34} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{34} } func (m *GetGroupMembersCMSReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMembersCMSReq.Unmarshal(m, b) @@ -1576,7 +1576,7 @@ func (m *GetGroupMembersCMSResp) Reset() { *m = GetGroupMembersCMSResp{} func (m *GetGroupMembersCMSResp) String() string { return proto.CompactTextString(m) } func (*GetGroupMembersCMSResp) ProtoMessage() {} func (*GetGroupMembersCMSResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{35} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{35} } func (m *GetGroupMembersCMSResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMembersCMSResp.Unmarshal(m, b) @@ -1628,7 +1628,7 @@ func (m *DismissGroupReq) Reset() { *m = DismissGroupReq{} } func (m *DismissGroupReq) String() string { return proto.CompactTextString(m) } func (*DismissGroupReq) ProtoMessage() {} func (*DismissGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{36} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{36} } func (m *DismissGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DismissGroupReq.Unmarshal(m, b) @@ -1665,7 +1665,7 @@ func (m *DismissGroupResp) Reset() { *m = DismissGroupResp{} } func (m *DismissGroupResp) String() string { return proto.CompactTextString(m) } func (*DismissGroupResp) ProtoMessage() {} func (*DismissGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{37} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{37} } func (m *DismissGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DismissGroupResp.Unmarshal(m, b) @@ -1698,7 +1698,7 @@ func (m *MuteGroupMemberReq) Reset() { *m = MuteGroupMemberReq{} } func (m *MuteGroupMemberReq) String() string { return proto.CompactTextString(m) } func (*MuteGroupMemberReq) ProtoMessage() {} func (*MuteGroupMemberReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{38} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{38} } func (m *MuteGroupMemberReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MuteGroupMemberReq.Unmarshal(m, b) @@ -1749,7 +1749,7 @@ func (m *MuteGroupMemberResp) Reset() { *m = MuteGroupMemberResp{} } func (m *MuteGroupMemberResp) String() string { return proto.CompactTextString(m) } func (*MuteGroupMemberResp) ProtoMessage() {} func (*MuteGroupMemberResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{39} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{39} } func (m *MuteGroupMemberResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MuteGroupMemberResp.Unmarshal(m, b) @@ -1781,7 +1781,7 @@ func (m *CancelMuteGroupMemberReq) Reset() { *m = CancelMuteGroupMemberR func (m *CancelMuteGroupMemberReq) String() string { return proto.CompactTextString(m) } func (*CancelMuteGroupMemberReq) ProtoMessage() {} func (*CancelMuteGroupMemberReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{40} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{40} } func (m *CancelMuteGroupMemberReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CancelMuteGroupMemberReq.Unmarshal(m, b) @@ -1825,7 +1825,7 @@ func (m *CancelMuteGroupMemberResp) Reset() { *m = CancelMuteGroupMember func (m *CancelMuteGroupMemberResp) String() string { return proto.CompactTextString(m) } func (*CancelMuteGroupMemberResp) ProtoMessage() {} func (*CancelMuteGroupMemberResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{41} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{41} } func (m *CancelMuteGroupMemberResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CancelMuteGroupMemberResp.Unmarshal(m, b) @@ -1856,7 +1856,7 @@ func (m *MuteGroupReq) Reset() { *m = MuteGroupReq{} } func (m *MuteGroupReq) String() string { return proto.CompactTextString(m) } func (*MuteGroupReq) ProtoMessage() {} func (*MuteGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{42} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{42} } func (m *MuteGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MuteGroupReq.Unmarshal(m, b) @@ -1893,7 +1893,7 @@ func (m *MuteGroupResp) Reset() { *m = MuteGroupResp{} } func (m *MuteGroupResp) String() string { return proto.CompactTextString(m) } func (*MuteGroupResp) ProtoMessage() {} func (*MuteGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{43} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{43} } func (m *MuteGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MuteGroupResp.Unmarshal(m, b) @@ -1924,7 +1924,7 @@ func (m *CancelMuteGroupReq) Reset() { *m = CancelMuteGroupReq{} } func (m *CancelMuteGroupReq) String() string { return proto.CompactTextString(m) } func (*CancelMuteGroupReq) ProtoMessage() {} func (*CancelMuteGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{44} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{44} } func (m *CancelMuteGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CancelMuteGroupReq.Unmarshal(m, b) @@ -1961,7 +1961,7 @@ func (m *CancelMuteGroupResp) Reset() { *m = CancelMuteGroupResp{} } func (m *CancelMuteGroupResp) String() string { return proto.CompactTextString(m) } func (*CancelMuteGroupResp) ProtoMessage() {} func (*CancelMuteGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{45} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{45} } func (m *CancelMuteGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CancelMuteGroupResp.Unmarshal(m, b) @@ -1994,7 +1994,7 @@ func (m *SetGroupMemberNicknameReq) Reset() { *m = SetGroupMemberNicknam func (m *SetGroupMemberNicknameReq) String() string { return proto.CompactTextString(m) } func (*SetGroupMemberNicknameReq) ProtoMessage() {} func (*SetGroupMemberNicknameReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{46} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{46} } func (m *SetGroupMemberNicknameReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGroupMemberNicknameReq.Unmarshal(m, b) @@ -2045,7 +2045,7 @@ func (m *SetGroupMemberNicknameResp) Reset() { *m = SetGroupMemberNickna func (m *SetGroupMemberNicknameResp) String() string { return proto.CompactTextString(m) } func (*SetGroupMemberNicknameResp) ProtoMessage() {} func (*SetGroupMemberNicknameResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{47} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{47} } func (m *SetGroupMemberNicknameResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGroupMemberNicknameResp.Unmarshal(m, b) @@ -2077,7 +2077,7 @@ func (m *GetJoinedSuperGroupListReq) Reset() { *m = GetJoinedSuperGroupL func (m *GetJoinedSuperGroupListReq) String() string { return proto.CompactTextString(m) } func (*GetJoinedSuperGroupListReq) ProtoMessage() {} func (*GetJoinedSuperGroupListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{48} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{48} } func (m *GetJoinedSuperGroupListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetJoinedSuperGroupListReq.Unmarshal(m, b) @@ -2123,7 +2123,7 @@ func (m *GetJoinedSuperGroupListResp) Reset() { *m = GetJoinedSuperGroup func (m *GetJoinedSuperGroupListResp) String() string { return proto.CompactTextString(m) } func (*GetJoinedSuperGroupListResp) ProtoMessage() {} func (*GetJoinedSuperGroupListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{49} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{49} } func (m *GetJoinedSuperGroupListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetJoinedSuperGroupListResp.Unmarshal(m, b) @@ -2168,7 +2168,7 @@ func (m *GetSuperGroupsInfoReq) Reset() { *m = GetSuperGroupsInfoReq{} } func (m *GetSuperGroupsInfoReq) String() string { return proto.CompactTextString(m) } func (*GetSuperGroupsInfoReq) ProtoMessage() {} func (*GetSuperGroupsInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{50} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{50} } func (m *GetSuperGroupsInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSuperGroupsInfoReq.Unmarshal(m, b) @@ -2206,7 +2206,7 @@ func (m *GetSuperGroupsInfoResp) Reset() { *m = GetSuperGroupsInfoResp{} func (m *GetSuperGroupsInfoResp) String() string { return proto.CompactTextString(m) } func (*GetSuperGroupsInfoResp) ProtoMessage() {} func (*GetSuperGroupsInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{51} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{51} } func (m *GetSuperGroupsInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSuperGroupsInfoResp.Unmarshal(m, b) @@ -2249,7 +2249,7 @@ func (m *SetGroupMemberInfoReq) Reset() { *m = SetGroupMemberInfoReq{} } func (m *SetGroupMemberInfoReq) String() string { return proto.CompactTextString(m) } func (*SetGroupMemberInfoReq) ProtoMessage() {} func (*SetGroupMemberInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{52} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{52} } func (m *SetGroupMemberInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGroupMemberInfoReq.Unmarshal(m, b) @@ -2321,7 +2321,7 @@ func (m *SetGroupMemberInfoResp) Reset() { *m = SetGroupMemberInfoResp{} func (m *SetGroupMemberInfoResp) String() string { return proto.CompactTextString(m) } func (*SetGroupMemberInfoResp) ProtoMessage() {} func (*SetGroupMemberInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{53} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{53} } func (m *SetGroupMemberInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGroupMemberInfoResp.Unmarshal(m, b) @@ -2352,7 +2352,7 @@ func (m *GetGroupAbstractInfoReq) Reset() { *m = GetGroupAbstractInfoReq func (m *GetGroupAbstractInfoReq) String() string { return proto.CompactTextString(m) } func (*GetGroupAbstractInfoReq) ProtoMessage() {} func (*GetGroupAbstractInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{54} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{54} } func (m *GetGroupAbstractInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupAbstractInfoReq.Unmarshal(m, b) @@ -2392,7 +2392,7 @@ func (m *GroupAbstractInfo) Reset() { *m = GroupAbstractInfo{} } func (m *GroupAbstractInfo) String() string { return proto.CompactTextString(m) } func (*GroupAbstractInfo) ProtoMessage() {} func (*GroupAbstractInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{55} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{55} } func (m *GroupAbstractInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupAbstractInfo.Unmarshal(m, b) @@ -2444,7 +2444,7 @@ func (m *GetGroupAbstractInfoResp) Reset() { *m = GetGroupAbstractInfoRe func (m *GetGroupAbstractInfoResp) String() string { return proto.CompactTextString(m) } func (*GetGroupAbstractInfoResp) ProtoMessage() {} func (*GetGroupAbstractInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{56} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{56} } func (m *GetGroupAbstractInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupAbstractInfoResp.Unmarshal(m, b) @@ -2483,7 +2483,7 @@ func (m *GetUserInGroupMembersReq) Reset() { *m = GetUserInGroupMembersR func (m *GetUserInGroupMembersReq) String() string { return proto.CompactTextString(m) } func (*GetUserInGroupMembersReq) ProtoMessage() {} func (*GetUserInGroupMembersReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{57} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{57} } func (m *GetUserInGroupMembersReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserInGroupMembersReq.Unmarshal(m, b) @@ -2528,7 +2528,7 @@ func (m *GetUserInGroupMembersResp) Reset() { *m = GetUserInGroupMembers func (m *GetUserInGroupMembersResp) String() string { return proto.CompactTextString(m) } func (*GetUserInGroupMembersResp) ProtoMessage() {} func (*GetUserInGroupMembersResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_19947c3109871c24, []int{58} + return fileDescriptor_group_5c8d3aafef0e7d21, []int{58} } func (m *GetUserInGroupMembersResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserInGroupMembersResp.Unmarshal(m, b) @@ -3597,124 +3597,124 @@ var _Group_serviceDesc = grpc.ServiceDesc{ Metadata: "group/group.proto", } -func init() { proto.RegisterFile("group/group.proto", fileDescriptor_group_19947c3109871c24) } +func init() { proto.RegisterFile("group/group.proto", fileDescriptor_group_5c8d3aafef0e7d21) } -var fileDescriptor_group_19947c3109871c24 = []byte{ - // 1848 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0x5f, 0x53, 0xdb, 0xc0, - 0x11, 0x1f, 0x99, 0x40, 0xc2, 0x06, 0x02, 0x1c, 0x18, 0x8c, 0x20, 0x40, 0x2e, 0x69, 0xca, 0xb4, - 0x89, 0xe9, 0x24, 0x6d, 0xa6, 0x7f, 0x32, 0x93, 0x26, 0x90, 0x10, 0x5a, 0x0c, 0x8d, 0x4c, 0xd2, - 0x69, 0x3a, 0x19, 0x2a, 0xec, 0x43, 0x51, 0xb0, 0xa5, 0x43, 0x27, 0x43, 0x26, 0x93, 0x3e, 0xb4, - 0xcf, 0xfd, 0xf3, 0xd0, 0xc7, 0xbe, 0x75, 0xfa, 0x29, 0xfa, 0xd6, 0xaf, 0xd2, 0x4f, 0xd2, 0xd1, - 0xe9, 0x74, 0x3e, 0x49, 0x27, 0xd9, 0x25, 0xee, 0x8b, 0x67, 0xb4, 0xb7, 0x7b, 0xb7, 0xb7, 0xff, - 0xee, 0xb7, 0x6b, 0x98, 0x73, 0x02, 0xbf, 0x47, 0xb7, 0xf8, 0x6f, 0x9d, 0x06, 0x7e, 0xe8, 0xa3, - 0x71, 0xfe, 0x61, 0x6e, 0x1e, 0x52, 0xe2, 0x3d, 0xdc, 0x6b, 0x3c, 0x6c, 0x92, 0xe0, 0x82, 0x04, - 0x5b, 0xf4, 0xcc, 0xd9, 0xe2, 0x0c, 0x5b, 0xac, 0x7d, 0x76, 0x7c, 0xc9, 0xb6, 0x2e, 0x59, 0x2c, - 0x60, 0xd6, 0x07, 0x72, 0x06, 0x36, 0xa5, 0x24, 0x10, 0xfc, 0xf8, 0x5f, 0x06, 0xdc, 0xda, 0x0e, - 0x88, 0x1d, 0x92, 0xdd, 0xe8, 0x24, 0x8b, 0x9c, 0xa3, 0xfb, 0x70, 0xcb, 0xf5, 0xdc, 0xb0, 0x41, - 0xba, 0x27, 0x24, 0xd8, 0x77, 0x59, 0x58, 0x33, 0x36, 0xc6, 0x36, 0x27, 0xad, 0x0c, 0x15, 0xfd, - 0x14, 0x26, 0xb9, 0x76, 0x7b, 0xde, 0xa9, 0x5f, 0xab, 0x6c, 0x18, 0x9b, 0x37, 0x1f, 0xad, 0xd6, - 0x19, 0x3f, 0xf6, 0xd8, 0xa6, 0xee, 0x31, 0xb5, 0x03, 0xbb, 0xcb, 0xea, 0xbb, 0x09, 0x8f, 0xd5, - 0x67, 0x47, 0x18, 0xa6, 0xec, 0x76, 0xd7, 0xf5, 0xde, 0x32, 0x12, 0xec, 0xed, 0xb0, 0xda, 0x18, - 0x3f, 0x21, 0x45, 0x43, 0x1b, 0x70, 0xd3, 0xbf, 0xf4, 0x48, 0x10, 0x7f, 0xd7, 0xae, 0x6d, 0x18, - 0x9b, 0x93, 0x96, 0x4a, 0xc2, 0x0d, 0x98, 0x49, 0xe9, 0xce, 0x68, 0x5a, 0x29, 0xe3, 0x7f, 0x52, - 0x0a, 0xd7, 0x61, 0x76, 0x97, 0x84, 0x7c, 0x89, 0xf1, 0x35, 0x72, 0x8e, 0x4c, 0xb8, 0x11, 0x33, - 0xec, 0x30, 0x61, 0x06, 0xf9, 0x8d, 0xdf, 0xc0, 0x5c, 0x86, 0x9f, 0x51, 0xf4, 0x14, 0x40, 0xee, - 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 0xcd, - 0xcf, 0xb5, 0x0d, 0xe6, 0x9d, 0x01, 0x1c, 0xb1, 0xc6, 0x2c, 0x07, 0xa9, 0xa4, 0xc6, 0x5a, 0x4c, - 0x2a, 0x35, 0xd6, 0x63, 0x31, 0xf4, 0x6b, 0x58, 0x70, 0x34, 0x20, 0x06, 0x65, 0xeb, 0x4f, 0x06, - 0xa8, 0x99, 0xeb, 0xa5, 0xeb, 0x71, 0x74, 0x6a, 0x71, 0x86, 0x8c, 0xce, 0x22, 0x54, 0x23, 0xa3, - 0xb3, 0x10, 0xa6, 0xbc, 0x58, 0x7f, 0x7f, 0xfb, 0x90, 0x12, 0xef, 0x78, 0xaf, 0xa1, 0xfc, 0x55, - 0xca, 0x85, 0x7e, 0xc6, 0x7f, 0x4f, 0x26, 0x38, 0xe9, 0xf1, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, - 0x5e, 0xb6, 0x4c, 0x79, 0x9d, 0x1d, 0x00, 0x00, +var fileDescriptor_group_5c8d3aafef0e7d21 = []byte{ + // 1851 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0x5f, 0x53, 0xe4, 0xc6, + 0x11, 0x2f, 0x2d, 0x07, 0x77, 0xf4, 0x81, 0xe1, 0x06, 0x16, 0x74, 0x82, 0x03, 0x3c, 0x26, 0x0e, + 0x95, 0xf8, 0x96, 0xd4, 0x5d, 0xe2, 0xca, 0x1f, 0x57, 0x39, 0x36, 0xd8, 0x98, 0x84, 0x85, 0x9c, + 0x16, 0x3b, 0x15, 0xa7, 0x5c, 0x44, 0xec, 0x0e, 0xb2, 0x0e, 0xad, 0x34, 0x68, 0xb4, 0xe0, 0x72, + 0x39, 0x0f, 0xc9, 0x73, 0xfe, 0x3c, 0xe4, 0x31, 0x6f, 0xa9, 0x7c, 0x84, 0x7c, 0x81, 0x7c, 0x95, + 0x7c, 0x92, 0x94, 0x66, 0x46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0x41, + 0x06, 0x9f, 0x82, 0xed, 0x8b, 0xe1, 0xc2, 0x71, 0xa4, 0x3f, 0x72, 0xa3, 0xc6, 0x1a, 0xba, 0x15, + 0x1b, 0x25, 0x2b, 0x7e, 0x01, 0x4f, 0x6b, 0xf6, 0x9b, 0xc6, 0x8b, 0xf9, 0xe2, 0x3f, 0xcb, 0x20, + 0x86, 0x9d, 0xe8, 0x3d, 0x78, 0xdc, 0x1d, 0xce, 0xf6, 0x50, 0x33, 0x47, 0x28, 0x85, 0x29, 0xa5, + 0xb3, 0x66, 0x22, 0x33, 0x8a, 0xde, 0x85, 0xf9, 0xd7, 0x79, 0x9b, 0x8e, 0x56, 0x24, 0x93, 0x3e, + 0x48, 0x70, 0x56, 0xab, 0x44, 0x21, 0x77, 0x93, 0x77, 0xb9, 0x4a, 0x4e, 0xef, 0x90, 0x95, 0x5c, + 0xa1, 0x19, 0x46, 0x1f, 0xc2, 0xa2, 0xaf, 0x8f, 0x02, 0xd1, 0x7a, 0xee, 0xa5, 0xd2, 0x40, 0xd1, + 0xb1, 0xcd, 0x0b, 0x8c, 0xa2, 0xf7, 0x61, 0x81, 0x69, 0xa3, 0x39, 0x94, 0xdf, 0xad, 0x34, 0x10, + 0x74, 0xd6, 0x8d, 0x74, 0x46, 0xd1, 0xef, 0x60, 0xdd, 0x37, 0x8f, 0xd0, 0xd0, 0x9b, 0xa5, 0x53, + 0xab, 0x43, 0x2e, 0x07, 0x8f, 0x63, 0x61, 0x14, 0x5d, 0x29, 0xef, 0x57, 0x47, 0x55, 0xe8, 0xad, + 0xe1, 0x06, 0xb5, 0xa3, 0x34, 0x67, 0x77, 0x3c, 0x13, 0xa3, 0xe8, 0x15, 0xa0, 0xb4, 0x32, 0x10, + 0x42, 0x9b, 0x52, 0xd6, 0x38, 0xae, 0x72, 0x9e, 0x8d, 0x58, 0x65, 0x14, 0x75, 0xc1, 0xf6, 0x6b, + 0x26, 0x21, 0x08, 0x17, 0x52, 0xca, 0x38, 0xc7,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, 0x16, 0x9a, 0xd0, + 0xa5, 0x5e, 0x0b, 0x6b, 0x90, 0xaf, 0x5e, 0x0b, 0x6b, 0x01, 0xaa, 0x88, 0x8e, 0x12, 0x3e, 0xd4, + 0xa3, 0xa3, 0x8a, 0x37, 0xf5, 0xe8, 0x30, 0x01, 0xcb, 0x2f, 0x60, 0x8d, 0x19, 0xc1, 0x3a, 0xda, + 0x29, 0xd5, 0xfc, 0x4a, 0xdb, 0xe0, 0xbc, 0x39, 0x86, 0x43, 0x68, 0xcc, 0x2a, 0x90, 0x4a, 0x69, + 0x6c, 0xc4, 0xa4, 0x4a, 0x63, 0x33, 0x16, 0x43, 0xbf, 0x86, 0x55, 0xdf, 0x00, 0x62, 0x50, 0xb9, + 0xfe, 0x94, 0x80, 0x9a, 0xb3, 0x3d, 0x72, 0x5d, 0x44, 0xa7, 0x11, 0x67, 0xa8, 0xe8, 0xac, 0x43, + 0x35, 0x2a, 0x3a, 0x6b, 0x61, 0xca, 0x87, 0xdb, 0x9f, 0x3f, 0x3b, 0xa3, 0x24, 0xba, 0x38, 0x6e, + 0x6b, 0x7f, 0x8c, 0x72, 0xa1, 0x9f, 0xf1, 0xdf, 0xcb, 0x39, 0x4e, 0x7a, 0xf9, 0xdf, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x4a, 0x6c, 0x49, 0xeb, 0x8b, 0x1d, 0x00, 0x00, } From 01d397776646151b24df001e5606834c3d53d1a8 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Wed, 1 Feb 2023 12:01:05 +0800 Subject: [PATCH 02/10] 1 --- internal/rpc/group/group.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 2445258b1..03c0b033a 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -301,7 +301,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite if !token_verify.IsAppManagerUid(ctx) { opUserID := tracelog.GetOpUserID(ctx) member, ok := memberMap[opUserID] - if ok { + if !ok { return nil, constant.ErrNoPermission.Wrap("not in group") } if !(member.RoleLevel == constant.GroupOwner || member.RoleLevel == constant.GroupAdmin) { From 39463e68e3fc8e1314cda296546b0a0adc85d259 Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Wed, 1 Feb 2023 12:12:51 +0800 Subject: [PATCH 03/10] Error code standardization --- .../{auth_api_struct.go => auth.go} | 9 - pkg/api_struct/aws_api_struct.go | 20 -- pkg/api_struct/conversation_api_struct.go | 130 -------- pkg/api_struct/cos_api_struct.go | 20 -- pkg/api_struct/friend_api_struct.go | 273 ---------------- pkg/api_struct/group_api_struct.go | 301 ------------------ pkg/api_struct/manage_api_struct.go | 132 -------- pkg/api_struct/office_struct.go | 88 ----- pkg/api_struct/organization_api_struct.go | 121 ------- pkg/api_struct/oss_api_struct.go | 22 -- pkg/api_struct/public_struct.go | 143 --------- pkg/api_struct/third_api_struct.go | 123 ------- pkg/api_struct/user_api_struct.go | 58 ---- pkg/api_struct/work_moments_struct.go | 138 -------- pkg/common/middleware/gin.go | 25 -- .../multi_terminal_login.go | 73 ----- 16 files changed, 1676 deletions(-) rename pkg/api_struct/{auth_api_struct.go => auth.go} (67%) delete mode 100644 pkg/api_struct/aws_api_struct.go delete mode 100644 pkg/api_struct/conversation_api_struct.go delete mode 100644 pkg/api_struct/cos_api_struct.go delete mode 100644 pkg/api_struct/friend_api_struct.go delete mode 100644 pkg/api_struct/group_api_struct.go delete mode 100644 pkg/api_struct/manage_api_struct.go delete mode 100644 pkg/api_struct/office_struct.go delete mode 100644 pkg/api_struct/organization_api_struct.go delete mode 100644 pkg/api_struct/oss_api_struct.go delete mode 100644 pkg/api_struct/public_struct.go delete mode 100644 pkg/api_struct/third_api_struct.go delete mode 100644 pkg/api_struct/user_api_struct.go delete mode 100644 pkg/api_struct/work_moments_struct.go delete mode 100644 pkg/common/multi_terminal_login/multi_terminal_login.go diff --git a/pkg/api_struct/auth_api_struct.go b/pkg/api_struct/auth.go similarity index 67% rename from pkg/api_struct/auth_api_struct.go rename to pkg/api_struct/auth.go index e5b50730c..ae80dee48 100644 --- a/pkg/api_struct/auth_api_struct.go +++ b/pkg/api_struct/auth.go @@ -1,14 +1,5 @@ package api_struct -//UserID string `protobuf:"bytes,1,opt,name=UserID" json:"UserID,omitempty"` -// Nickname string `protobuf:"bytes,2,opt,name=Nickname" json:"Nickname,omitempty"` -// FaceUrl string `protobuf:"bytes,3,opt,name=FaceUrl" json:"FaceUrl,omitempty"` -// Gender int32 `protobuf:"varint,4,opt,name=Gender" json:"Gender,omitempty"` -// PhoneNumber string `protobuf:"bytes,5,opt,name=PhoneNumber" json:"PhoneNumber,omitempty"` -// Birth string `protobuf:"bytes,6,opt,name=Birth" json:"Birth,omitempty"` -// Email string `protobuf:"bytes,7,opt,name=Email" json:"Email,omitempty"` -// Ex string `protobuf:"bytes,8,opt,name=Ex" json:"Ex,omitempty"` - type UserRegisterReq struct { Secret string `json:"secret" binding:"required,max=32"` Platform int32 `json:"platform" binding:"required,min=1,max=12"` diff --git a/pkg/api_struct/aws_api_struct.go b/pkg/api_struct/aws_api_struct.go deleted file mode 100644 index 0479080e4..000000000 --- a/pkg/api_struct/aws_api_struct.go +++ /dev/null @@ -1,20 +0,0 @@ -package api_struct - -type AwsStorageCredentialReq struct { - OperationID string `json:"operationID"` -} - -type AwsStorageCredentialRespData struct { - AccessKeyId string `json:"accessKeyID"` - SecretAccessKey string `json:"secretAccessKey"` - SessionToken string `json:"sessionToken"` - RegionID string `json:"regionId"` - Bucket string `json:"bucket"` - FinalHost string `json:"FinalHost"` -} - -type AwsStorageCredentialResp struct { - CommResp - CosData AwsStorageCredentialRespData - Data map[string]interface{} `json:"data"` -} diff --git a/pkg/api_struct/conversation_api_struct.go b/pkg/api_struct/conversation_api_struct.go deleted file mode 100644 index da4b5ced9..000000000 --- a/pkg/api_struct/conversation_api_struct.go +++ /dev/null @@ -1,130 +0,0 @@ -package api_struct - -type OptResult struct { - ConversationID string `json:"conversationID"` - Result *int32 `json:"result"` -} -type GetAllConversationMessageOptReq struct { - OperationID string `json:"operationID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` -} -type GetAllConversationMessageOptResp struct { - CommResp - ConversationOptResultList []*OptResult `json:"data"` -} -type GetReceiveMessageOptReq struct { - ConversationIDList []string `json:"conversationIDList" binding:"required"` - OperationID string `json:"operationID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` -} -type GetReceiveMessageOptResp struct { - CommResp - ConversationOptResultList []*OptResult `json:"data"` -} -type SetReceiveMessageOptReq struct { - FromUserID string `json:"fromUserID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` - Opt *int32 `json:"opt" binding:"required"` - ConversationIDList []string `json:"conversationIDList" binding:"required"` -} -type SetReceiveMessageOptResp struct { - CommResp - ConversationOptResultList []*OptResult `json:"data"` -} - -type Conversation struct { - OwnerUserID string `json:"ownerUserID" binding:"required"` - ConversationID string `json:"conversationID" binding:"required"` - ConversationType int32 `json:"conversationType" binding:"required"` - UserID string `json:"userID"` - GroupID string `json:"groupID"` - RecvMsgOpt int32 `json:"recvMsgOpt" binding:"omitempty,oneof=0 1 2"` - UnreadCount int32 `json:"unreadCount" binding:"omitempty"` - DraftTextTime int64 `json:"draftTextTime"` - IsPinned bool `json:"isPinned" binding:"omitempty"` - IsPrivateChat bool `json:"isPrivateChat"` - BurnDuration int32 `json:"burnDuration"` - GroupAtType int32 `json:"groupAtType"` - IsNotInGroup bool `json:"isNotInGroup"` - UpdateUnreadCountTime int64 `json:"updateUnreadCountTime"` - AttachedInfo string `json:"attachedInfo"` - Ex string `json:"ex"` -} - -type SetConversationReq struct { - Conversation - NotificationType int32 `json:"notificationType"` - OperationID string `json:"operationID" binding:"required"` -} - -type SetConversationResp struct { - CommResp -} -type ModifyConversationFieldReq struct { - Conversation - FieldType int32 `json:"fieldType" binding:"required"` - UserIDList []string `json:"userIDList" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} -type ModifyConversationFieldResp struct { - CommResp -} - -type BatchSetConversationsReq struct { - Conversations []Conversation `json:"conversations" binding:"required"` - NotificationType int32 `json:"notificationType"` - OwnerUserID string `json:"ownerUserID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} - -type BatchSetConversationsResp struct { - CommResp - Data struct { - Success []string `json:"success"` - Failed []string `json:"failed"` - } `json:"data"` -} - -type GetConversationReq struct { - ConversationID string `json:"conversationID" binding:"required"` - OwnerUserID string `json:"ownerUserID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} - -type GetConversationResp struct { - CommResp - Conversation Conversation `json:"data"` -} - -type GetAllConversationsReq struct { - OwnerUserID string `json:"ownerUserID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} - -type GetAllConversationsResp struct { - CommResp - Conversations []Conversation `json:"data"` -} - -type GetConversationsReq struct { - ConversationIDs []string `json:"conversationIDs" binding:"required"` - OwnerUserID string `json:"ownerUserID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} - -type GetConversationsResp struct { - CommResp - Conversations []Conversation `json:"data"` -} - -type SetRecvMsgOptReq struct { - OwnerUserID string `json:"ownerUserID" binding:"required"` - ConversationID string `json:"conversationID"` - RecvMsgOpt int32 `json:"recvMsgOpt" binding:"omitempty,oneof=0 1 2"` - OperationID string `json:"operationID" binding:"required"` - NotificationType int32 `json:"notificationType"` -} - -type SetRecvMsgOptResp struct { - CommResp -} diff --git a/pkg/api_struct/cos_api_struct.go b/pkg/api_struct/cos_api_struct.go deleted file mode 100644 index 0c9e92a5b..000000000 --- a/pkg/api_struct/cos_api_struct.go +++ /dev/null @@ -1,20 +0,0 @@ -package api_struct - -import sts "github.com/tencentyun/qcloud-cos-sts-sdk/go" - -type TencentCloudStorageCredentialReq struct { - OperationID string `json:"operationID"` -} - -type TencentCloudStorageCredentialRespData struct { - *sts.CredentialResult - Region string `json:"region"` - Bucket string `json:"bucket"` -} - -type TencentCloudStorageCredentialResp struct { - CommResp - CosData TencentCloudStorageCredentialRespData `json:"-"` - - Data map[string]interface{} `json:"data"` -} diff --git a/pkg/api_struct/friend_api_struct.go b/pkg/api_struct/friend_api_struct.go deleted file mode 100644 index b89ba3208..000000000 --- a/pkg/api_struct/friend_api_struct.go +++ /dev/null @@ -1,273 +0,0 @@ -package api_struct - -//type ParamsCommFriend struct { -// OperationID string `json:"operationID" binding:"required"` -// ToUserID string `json:"toUserID" binding:"required"` -// FromUserID string `json:"fromUserID" binding:"required"` -//} -// -//type AddBlacklistReq struct { -// ParamsCommFriend -//} -//type AddBlacklistResp struct { -// CommResp -//} -// -//type ImportFriendReq struct { -// FriendUserIDList []string `json:"friendUserIDList" binding:"required"` -// OperationID string `json:"operationID" binding:"required"` -// FromUserID string `json:"fromUserID" binding:"required"` -//} -//type UserIDResult struct { -// UserID string `json:"userID"` -// Result int32 `json:"result"` -//} -//type ImportFriendResp struct { -// CommResp -// UserIDResultList []UserIDResult `json:"data"` -//} -// -//type AddFriendReq struct { -// ParamsCommFriend -// ReqMsg string `json:"reqMsg"` -//} -//type AddFriendResp struct { -// CommResp -//} -// -//type AddFriendResponseReq struct { -// ParamsCommFriend -// Flag int32 `json:"flag" binding:"required,oneof=-1 0 1"` -// HandleMsg string `json:"handleMsg"` -//} -//type AddFriendResponseResp struct { -// CommResp -//} -// -//type DeleteFriendReq struct { -// ParamsCommFriend -//} -//type DeleteFriendResp struct { -// CommResp -//} -// -//type GetBlackListReq struct { -// OperationID string `json:"operationID" binding:"required"` -// FromUserID string `json:"fromUserID" binding:"required"` -//} -//type GetBlackListResp struct { -// CommResp -// BlackUserInfoList []*open_im_sdk.PublicUserInfo `json:"-"` -// Data []map[string]interface{} `json:"data" swaggerignore:"true"` -//} -// -////type PublicUserInfo struct { -//// UserID string `json:"userID"` -//// Nickname string `json:"nickname"` -//// FaceUrl string `json:"faceUrl"` -//// Gender int32 `json:"gender"` -////} -// -//type SetFriendRemarkReq struct { -// ParamsCommFriend -// Remark string `json:"remark"` -//} -//type SetFriendRemarkResp struct { -// CommResp -//} -// -//type RemoveBlacklistReq struct { -// ParamsCommFriend -//} -//type RemoveBlacklistResp struct { -// CommResp -//} -// -//type IsFriendReq struct { -// ParamsCommFriend -//} -//type Response struct { -// Friend bool `json:"isFriend"` -//} -//type IsFriendResp struct { -// CommResp -// Response Response `json:"data"` -//} -// -//type GetFriendsInfoReq struct { -// ParamsCommFriend -//} -//type GetFriendsInfoResp struct { -// CommResp -// FriendInfoList []*open_im_sdk.FriendInfo `json:"-"` -// Data []map[string]interface{} `json:"data" swaggerignore:"true"` -//} -// -//type GetFriendListReq struct { -// OperationID string `json:"operationID" binding:"required"` -// FromUserID string `json:"fromUserID" binding:"required"` -//} -//type GetFriendListResp struct { -// CommResp -// FriendInfoList []*open_im_sdk.FriendInfo `json:"-"` -// Data []map[string]interface{} `json:"data" swaggerignore:"true"` -//} -// -//type GetFriendApplyListReq struct { -// OperationID string `json:"operationID" binding:"required"` -// FromUserID string `json:"fromUserID" binding:"required"` -//} -//type GetFriendApplyListResp struct { -// CommResp -// FriendRequestList []*open_im_sdk.FriendRequest `json:"-"` -// Data []map[string]interface{} `json:"data" swaggerignore:"true"` -//} -// -//type GetSelfApplyListReq struct { -// OperationID string `json:"operationID" binding:"required"` -// FromUserID string `json:"fromUserID" binding:"required"` -//} -//type GetSelfApplyListResp struct { -// CommResp -// FriendRequestList []*open_im_sdk.FriendRequest `json:"-"` -// Data []map[string]interface{} `json:"data" swaggerignore:"true"` -//} - -type FriendInfo struct { - UserID string `json:"userID"` - Nickname string `json:"nickname"` - FaceURL string `json:"faceURL"` - Gender int32 `json:"gender"` - Ex string `json:"ex"` -} - -type PublicUserInfo struct { - UserID string `json:"userID"` - Nickname string `json:"nickname"` - FaceURL string `json:"faceURL"` - Gender int32 `json:"gender"` - Ex string `json:"ex"` -} - -type FriendRequest struct { - FromUserID string `json:"fromUserID"` - FromNickname string `json:"fromNickname"` - FromFaceURL string `json:"fromFaceURL"` - FromGender int32 `json:"fromGender"` - ToUserID string `json:"toUserID"` - ToNickname string `json:"toNickname"` - ToFaceURL string `json:"toFaceURL"` - ToGender int32 `json:"toGender"` - HandleResult int32 `json:"handleResult"` - ReqMsg string `json:"reqMsg"` - CreateTime uint32 `json:"createTime"` - HandlerUserID string `json:"handlerUserID"` - HandleMsg string `json:"handleMsg"` - HandleTime uint32 `json:"handleTime"` - Ex string `json:"ex"` -} - -type AddBlacklistReq struct { - ToUserID string `json:"toUserID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` -} -type AddBlacklistResp struct { -} - -type ImportFriendReq struct { - FriendUserIDList []string `json:"friendUserIDList" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` -} - -type ImportFriendResp struct { - //CommResp -} - -type AddFriendReq struct { - ToUserID string `json:"toUserID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` - ReqMsg string `json:"reqMsg"` -} -type AddFriendResp struct { - //CommResp -} - -type AddFriendResponseReq struct { - ToUserID string `json:"toUserID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` - HandleResult int32 `json:"flag" binding:"required,oneof=-1 0 1"` - HandleMsg string `json:"handleMsg"` -} -type AddFriendResponseResp struct { -} - -type DeleteFriendReq struct { - ToUserID string `json:"toUserID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` -} -type DeleteFriendResp struct { -} - -type GetBlackListReq struct { - FromUserID string `json:"fromUserID" binding:"required"` -} -type GetBlackListResp struct { - BlackUserInfoList []PublicUserInfo `json:"blackUserInfoList"` -} - -type SetFriendRemarkReq struct { - ToUserID string `json:"toUserID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` - Remark string `json:"remark"` -} -type SetFriendRemarkResp struct { -} - -type RemoveBlacklistReq struct { - ToUserID string `json:"toUserID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` -} -type RemoveBlacklistResp struct { -} - -type IsFriendReq struct { - ToUserID string `json:"toUserID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` -} -type Response struct { - Friend bool `json:"isFriend"` -} -type IsFriendResp struct { - Response Response `json:"data"` -} - -type GetFriendListReq struct { - OperationID string `json:"operationID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` -} -type GetFriendListResp struct { - OwnerUserID string `json:"ownerUserID"` - Remark string `json:"remark"` - CreateTime uint32 `json:"createTime"` - AddSource int32 `json:"addSource"` - OperatorUserID string `json:"operatorUserID"` - Ex string `json:"ex"` - //FriendUser *UserInfo // TODO -} - -type GetFriendApplyListReq struct { - OperationID string `json:"operationID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` -} - -type GetFriendApplyListResp struct { - FriendRequestList []FriendRequest `json:"friendRequestList"` -} - -type GetSelfApplyListReq struct { - OperationID string `json:"operationID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` -} -type GetSelfApplyListResp struct { - FriendRequestList []FriendRequest `json:"friendRequestList"` -} diff --git a/pkg/api_struct/group_api_struct.go b/pkg/api_struct/group_api_struct.go deleted file mode 100644 index b15458d79..000000000 --- a/pkg/api_struct/group_api_struct.go +++ /dev/null @@ -1,301 +0,0 @@ -package api_struct - -import ( - open_im_sdk "Open_IM/pkg/proto/sdk_ws" -) - -type CommResp struct { - ErrCode int32 `json:"errCode"` - ErrMsg string `json:"errMsg"` -} - -type CommDataResp struct { - CommResp - Data []map[string]interface{} `json:"data"` -} - -type KickGroupMemberReq struct { - GroupID string `json:"groupID" binding:"required"` - KickedUserIDList []string `json:"kickedUserIDList" binding:"required"` - Reason string `json:"reason"` - OperationID string `json:"operationID" binding:"required"` -} -type KickGroupMemberResp struct { - CommResp - UserIDResultList []*UserIDResult `json:"data"` -} - -type GetGroupMembersInfoReq struct { - GroupID string `json:"groupID" binding:"required"` - MemberList []string `json:"memberList" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} -type GetGroupMembersInfoResp struct { - CommResp - MemberList []*open_im_sdk.GroupMemberFullInfo `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` -} - -type InviteUserToGroupReq struct { - GroupID string `json:"groupID" binding:"required"` - InvitedUserIDList []string `json:"invitedUserIDList" binding:"required"` - Reason string `json:"reason"` - OperationID string `json:"operationID" binding:"required"` -} -type InviteUserToGroupResp struct { - CommResp - UserIDResultList []*UserIDResult `json:"data"` -} - -type GetJoinedGroupListReq struct { - OperationID string `json:"operationID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` -} -type GetJoinedGroupListResp struct { - CommResp - GroupInfoList []*open_im_sdk.GroupInfo `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` -} - -type GetGroupMemberListReq struct { - GroupID string `json:"groupID"` - Filter int32 `json:"filter"` - NextSeq int32 `json:"nextSeq"` - OperationID string `json:"operationID"` -} -type GetGroupMemberListResp struct { - CommResp - NextSeq int32 `json:"nextSeq"` - MemberList []*open_im_sdk.GroupMemberFullInfo `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` -} - -type GetGroupAllMemberReq struct { - GroupID string `json:"groupID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` - Offset int32 `json:"offset"` - Count int32 `json:"count"` -} -type GetGroupAllMemberResp struct { - CommResp - MemberList []*open_im_sdk.GroupMemberFullInfo `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` -} - -// -//type GetGroupAllMemberListBySplitReq struct { -// GroupID string `json:"groupID" binding:"required"` -// OperationID string `json:"operationID" binding:"required"` -// Offset int32 `json:"offset" binding:"required"` -// Count int32 `json:"count" binding:"required"` -//} -//type GetGroupAllMemberListBySplitResp struct { -// CommResp -// MemberList []*open_im_sdk.GroupMemberFullInfo `json:"-"` -// Data []map[string]interface{} `json:"data" swaggerignore:"true"` -//} - -type CreateGroupReq struct { - MemberList []*GroupAddMemberInfo `json:"memberList"` - OwnerUserID string `json:"ownerUserID"` - GroupType int32 `json:"groupType"` - GroupName string `json:"groupName"` - Notification string `json:"notification"` - Introduction string `json:"introduction"` - FaceURL string `json:"faceURL"` - Ex string `json:"ex"` - OperationID string `json:"operationID" binding:"required"` - GroupID string `json:"groupID"` -} -type CreateGroupResp struct { - CommResp - GroupInfo open_im_sdk.GroupInfo `json:"-"` - Data map[string]interface{} `json:"data" swaggerignore:"true"` -} - -type GetGroupApplicationListReq struct { - OperationID string `json:"operationID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` //作为管理员或群主收到的 进群申请 -} -type GetGroupApplicationListResp struct { - CommResp - GroupRequestList []*open_im_sdk.GroupRequest `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` -} - -type GetUserReqGroupApplicationListReq struct { - OperationID string `json:"operationID" binding:"required"` - UserID string `json:"userID" binding:"required"` -} - -type GetUserRespGroupApplicationResp struct { - GroupRequestList []*open_im_sdk.GroupRequest `json:"data"` -} - -type GetGroupInfoReq struct { - GroupIDList []string `json:"groupIDList" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} -type GetGroupInfoResp struct { - CommResp - GroupInfoList []*open_im_sdk.GroupInfo `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` -} - -//type GroupInfoAlias struct { -// open_im_sdk.GroupInfo -// NeedVerification int32 `protobuf:"bytes,13,opt,name=needVerification" json:"needVerification,omitempty"` -//} - -//type GroupInfoAlias struct { -// GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"` -// GroupName string `protobuf:"bytes,2,opt,name=groupName" json:"groupName,omitempty"` -// Notification string `protobuf:"bytes,3,opt,name=notification" json:"notification,omitempty"` -// Introduction string `protobuf:"bytes,4,opt,name=introduction" json:"introduction,omitempty"` -// FaceURL string `protobuf:"bytes,5,opt,name=faceURL" json:"faceURL,omitempty"` -// OwnerUserID string `protobuf:"bytes,6,opt,name=ownerUserID" json:"ownerUserID,omitempty"` -// CreateTime uint32 `protobuf:"varint,7,opt,name=createTime" json:"createTime,omitempty"` -// MemberCount uint32 `protobuf:"varint,8,opt,name=memberCount" json:"memberCount,omitempty"` -// Ex string `protobuf:"bytes,9,opt,name=ex" json:"ex,omitempty"` -// Status int32 `protobuf:"varint,10,opt,name=status" json:"status,omitempty"` -// CreatorUserID string `protobuf:"bytes,11,opt,name=creatorUserID" json:"creatorUserID,omitempty"` -// GroupType int32 `protobuf:"varint,12,opt,name=groupType" json:"groupType,omitempty"` -// NeedVerification int32 `protobuf:"bytes,13,opt,name=needVerification" json:"needVerification,omitempty"` -//} - -type ApplicationGroupResponseReq struct { - OperationID string `json:"operationID" binding:"required"` - GroupID string `json:"groupID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` //application from FromUserID - HandledMsg string `json:"handledMsg"` - HandleResult int32 `json:"handleResult" binding:"required,oneof=-1 1"` -} -type ApplicationGroupResponseResp struct { - CommResp -} - -type JoinGroupReq struct { - GroupID string `json:"groupID" binding:"required"` - ReqMessage string `json:"reqMessage"` - OperationID string `json:"operationID" binding:"required"` - JoinSource int32 `json:"joinSource"` - InviterUserID string `json:"inviterUserID"` -} - -type JoinGroupResp struct { - CommResp -} - -type QuitGroupReq struct { - GroupID string `json:"groupID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} -type QuitGroupResp struct { - CommResp -} - -type SetGroupInfoReq struct { - GroupID string `json:"groupID" binding:"required"` - GroupName string `json:"groupName"` - Notification string `json:"notification"` - Introduction string `json:"introduction"` - FaceURL string `json:"faceURL"` - Ex string `json:"ex"` - OperationID string `json:"operationID" binding:"required"` - NeedVerification *int32 `json:"needVerification"` - LookMemberInfo *int32 `json:"lookMemberInfo"` - ApplyMemberFriend *int32 `json:"applyMemberFriend"` -} - -type SetGroupInfoResp struct { - CommResp -} - -type TransferGroupOwnerReq struct { - GroupID string `json:"groupID" binding:"required"` - OldOwnerUserID string `json:"oldOwnerUserID" binding:"required"` - NewOwnerUserID string `json:"newOwnerUserID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} -type TransferGroupOwnerResp struct { - CommResp -} - -type DismissGroupReq struct { - GroupID string `json:"groupID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} -type DismissGroupResp struct { - CommResp -} - -type MuteGroupMemberReq struct { - OperationID string `json:"operationID" binding:"required"` - GroupID string `json:"groupID" binding:"required"` - UserID string `json:"userID" binding:"required"` - MutedSeconds uint32 `json:"mutedSeconds" binding:"required"` -} -type MuteGroupMemberResp struct { - CommResp -} - -type CancelMuteGroupMemberReq struct { - OperationID string `json:"operationID" binding:"required"` - GroupID string `json:"groupID" binding:"required"` - UserID string `json:"userID" binding:"required"` -} -type CancelMuteGroupMemberResp struct { - CommResp -} - -type MuteGroupReq struct { - OperationID string `json:"operationID" binding:"required"` - GroupID string `json:"groupID" binding:"required"` -} -type MuteGroupResp struct { - CommResp -} - -type CancelMuteGroupReq struct { - OperationID string `json:"operationID" binding:"required"` - GroupID string `json:"groupID" binding:"required"` -} -type CancelMuteGroupResp struct { - CommResp -} - -type SetGroupMemberNicknameReq struct { - OperationID string `json:"operationID" binding:"required"` - GroupID string `json:"groupID" binding:"required"` - UserID string `json:"userID" binding:"required"` - Nickname string `json:"nickname"` -} - -type SetGroupMemberNicknameResp struct { - CommResp -} - -type SetGroupMemberInfoReq struct { - OperationID string `json:"operationID" binding:"required"` - GroupID string `json:"groupID" binding:"required"` - UserID string `json:"userID" binding:"required"` - Nickname *string `json:"nickname"` - FaceURL *string `json:"userGroupFaceUrl"` - RoleLevel *int32 `json:"roleLevel" validate:"gte=1,lte=3"` - Ex *string `json:"ex"` -} - -type SetGroupMemberInfoResp struct { - CommResp -} - -type GetGroupAbstractInfoReq struct { - OperationID string `json:"operationID"` - GroupID string `json:"groupID"` -} - -type GetGroupAbstractInfoResp struct { - CommResp - GroupMemberNumber int32 `json:"groupMemberNumber"` - GroupMemberListHash uint64 `json:"groupMemberListHash"` -} diff --git a/pkg/api_struct/manage_api_struct.go b/pkg/api_struct/manage_api_struct.go deleted file mode 100644 index 4e6c6977b..000000000 --- a/pkg/api_struct/manage_api_struct.go +++ /dev/null @@ -1,132 +0,0 @@ -package api_struct - -import ( - pbRelay "Open_IM/pkg/proto/relay" - server_api_params "Open_IM/pkg/proto/sdk_ws" - pbUser "Open_IM/pkg/proto/user" -) - -type DeleteUsersReq struct { - OperationID string `json:"operationID" binding:"required"` - DeleteUserIDList []string `json:"deleteUserIDList" binding:"required"` -} -type DeleteUsersResp struct { - CommResp - FailedUserIDList []string `json:"data"` -} -type GetAllUsersUidReq struct { - OperationID string `json:"operationID" binding:"required"` -} -type GetAllUsersUidResp struct { - CommResp - UserIDList []string `json:"data"` -} -type GetUsersOnlineStatusReq struct { - OperationID string `json:"operationID" binding:"required"` - UserIDList []string `json:"userIDList" binding:"required,lte=200"` -} -type GetUsersOnlineStatusResp struct { - CommResp - SuccessResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult `json:"data"` -} -type AccountCheckReq struct { - OperationID string `json:"operationID" binding:"required"` - CheckUserIDList []string `json:"checkUserIDList" binding:"required,lte=100"` -} -type AccountCheckResp struct { - CommResp - ResultList []*pbUser.AccountCheckResp_SingleUserStatus `json:"data"` -} - -type ManagementSendMsg struct { - OperationID string `json:"operationID" binding:"required"` - BusinessOperationID string `json:"businessOperationID"` - SendID string `json:"sendID" binding:"required"` - GroupID string `json:"groupID" ` - SenderNickname string `json:"senderNickname" ` - SenderFaceURL string `json:"senderFaceURL" ` - SenderPlatformID int32 `json:"senderPlatformID"` - //ForceList []string `json:"forceList" ` - Content map[string]interface{} `json:"content" binding:"required" swaggerignore:"true"` - ContentType int32 `json:"contentType" binding:"required"` - SessionType int32 `json:"sessionType" binding:"required"` - IsOnlineOnly bool `json:"isOnlineOnly"` - NotOfflinePush bool `json:"notOfflinePush"` - OfflinePushInfo *server_api_params.OfflinePushInfo `json:"offlinePushInfo"` -} - -type ManagementSendMsgReq struct { - ManagementSendMsg - RecvID string `json:"recvID" ` -} - -type ManagementSendMsgResp struct { - CommResp - ResultList server_api_params.UserSendMsgResp `json:"data"` -} - -type ManagementBatchSendMsgReq struct { - ManagementSendMsg - IsSendAll bool `json:"isSendAll"` - RecvIDList []string `json:"recvIDList"` -} - -type ManagementBatchSendMsgResp struct { - CommResp - Data struct { - ResultList []*SingleReturnResult `json:"resultList"` - FailedIDList []string - } `json:"data"` -} -type SingleReturnResult struct { - ServerMsgID string `json:"serverMsgID"` - ClientMsgID string `json:"clientMsgID"` - SendTime int64 `json:"sendTime"` - RecvID string `json:"recvID" ` -} - -type CheckMsgIsSendSuccessReq struct { - OperationID string `json:"operationID"` -} - -type CheckMsgIsSendSuccessResp struct { - CommResp - Status int32 `json:"status"` -} - -type GetUsersReq struct { - OperationID string `json:"operationID" binding:"required"` - UserName string `json:"userName"` - UserID string `json:"userID"` - Content string `json:"content"` - PageNumber int32 `json:"pageNumber" binding:"required"` - ShowNumber int32 `json:"showNumber" binding:"required"` -} - -type CMSUser struct { - UserID string `json:"userID"` - Nickname string `json:"nickname"` - FaceURL string `json:"faceURL"` - Gender int32 `json:"gender"` - PhoneNumber string `json:"phoneNumber"` - Birth uint32 `json:"birth"` - Email string `json:"email"` - Ex string `json:"ex"` - CreateIp string `json:"createIp"` - CreateTime uint32 `json:"createTime"` - LastLoginIp string `json:"LastLoginIp"` - LastLoginTime uint32 `json:"LastLoginTime"` - AppMangerLevel int32 `json:"appMangerLevel"` - GlobalRecvMsgOpt int32 `json:"globalRecvMsgOpt"` - IsBlock bool `json:"isBlock"` -} - -type GetUsersResp struct { - CommResp - Data struct { - UserList []*CMSUser `json:"userList"` - TotalNum int32 `json:"totalNum"` - CurrentPage int32 `json:"currentPage"` - ShowNumber int32 `json:"showNumber"` - } `json:"data"` -} diff --git a/pkg/api_struct/office_struct.go b/pkg/api_struct/office_struct.go deleted file mode 100644 index 3eeb1ed3f..000000000 --- a/pkg/api_struct/office_struct.go +++ /dev/null @@ -1,88 +0,0 @@ -package api_struct - -import ( - pbOffice "Open_IM/pkg/proto/office" -) - -type GetUserTagsReq struct { - OperationID string `json:"operationID" binding:"required"` -} - -type GetUserTagsResp struct { - CommResp - Data struct { - Tags []*pbOffice.Tag `json:"tags"` - } `json:"data"` -} - -type CreateTagReq struct { - TagName string `json:"tagName" binding:"required"` // tag名称 - UserIDList []string `json:"userIDList" binding:"required"` // 用户ID列表 - OperationID string `json:"operationID" binding:"required"` -} - -type CreateTagResp struct { - CommResp -} - -type DeleteTagReq struct { - TagID string `json:"tagID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} - -type DeleteTagResp struct { - CommResp -} - -type SetTagReq struct { - TagID string `json:"tagID" binding:"required"` - NewName string `json:"newName"` - IncreaseUserIDList []string `json:"increaseUserIDList"` - ReduceUserIDList []string `json:"reduceUserIDList"` - OperationID string `json:"operationID" binding:"required"` -} - -type SetTagResp struct { - CommResp -} - -type SendMsg2TagReq struct { - TagList []string `json:"tagList"` - UserList []string `json:"userList"` - GroupList []string `json:"groupList"` - - SenderPlatformID int32 `json:"senderPlatformID" binding:"required"` - Content string `json:"content" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} - -type SendMsg2TagResp struct { - CommResp -} - -type GetTagSendLogsReq struct { - PageNumber int32 `json:"pageNumber" binding:"required"` - ShowNumber int32 `json:"showNumber" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} - -type GetTagSendLogsResp struct { - CommResp - Data struct { - Logs []*pbOffice.TagSendLog `json:"logs"` - CurrentPage int32 `json:"currentPage"` - ShowNumber int32 `json:"showNumber"` - } `json:"data"` -} - -type GetUserTagByIDReq struct { - TagID string `json:"tagID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} - -type GetUserTagByIDResp struct { - CommResp - Data struct { - Tag *pbOffice.Tag `json:"tag"` - } `json:"data"` -} diff --git a/pkg/api_struct/organization_api_struct.go b/pkg/api_struct/organization_api_struct.go deleted file mode 100644 index c6c1d8327..000000000 --- a/pkg/api_struct/organization_api_struct.go +++ /dev/null @@ -1,121 +0,0 @@ -package api_struct - -import open_im_sdk "Open_IM/pkg/proto/sdk_ws" - -type CreateDepartmentReq struct { - *open_im_sdk.Department - OperationID string `json:"operationID" binding:"required"` -} -type CreateDepartmentResp struct { - CommResp - Department *open_im_sdk.Department `json:"-"` - Data map[string]interface{} `json:"data" swaggerignore:"true"` -} - -type UpdateDepartmentReq struct { - *open_im_sdk.Department - DepartmentID string `json:"departmentID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} -type UpdateDepartmentResp struct { - CommResp -} - -type GetSubDepartmentReq struct { - OperationID string `json:"operationID" binding:"required"` - DepartmentID string `json:"departmentID" binding:"required"` -} -type GetSubDepartmentResp struct { - CommResp - DepartmentList []*open_im_sdk.Department `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` -} - -type DeleteDepartmentReq struct { - OperationID string `json:"operationID" binding:"required"` - DepartmentID string `json:"departmentID" binding:"required"` -} -type DeleteDepartmentResp struct { - CommResp -} - -type CreateOrganizationUserReq struct { - OperationID string `json:"operationID" binding:"required"` - *open_im_sdk.OrganizationUser -} -type CreateOrganizationUserResp struct { - CommResp -} - -type UpdateOrganizationUserReq struct { - OperationID string `json:"operationID" binding:"required"` - *open_im_sdk.OrganizationUser -} -type UpdateOrganizationUserResp struct { - CommResp -} - -type CreateDepartmentMemberReq struct { - OperationID string `json:"operationID" binding:"required"` - *open_im_sdk.DepartmentMember -} - -type CreateDepartmentMemberResp struct { - CommResp -} - -type GetUserInDepartmentReq struct { - UserID string `json:"userID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} -type GetUserInDepartmentResp struct { - CommResp - UserInDepartment *open_im_sdk.UserInDepartment `json:"-"` - Data map[string]interface{} `json:"data" swaggerignore:"true"` -} - -type UpdateUserInDepartmentReq struct { - OperationID string `json:"operationID" binding:"required"` - *open_im_sdk.DepartmentMember -} -type UpdateUserInDepartmentResp struct { - CommResp -} - -type DeleteOrganizationUserReq struct { - UserID string `json:"userID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} -type DeleteOrganizationUserResp struct { - CommResp -} - -type GetDepartmentMemberReq struct { - DepartmentID string `json:"departmentID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} -type GetDepartmentMemberResp struct { - CommResp - UserInDepartmentList []*open_im_sdk.UserDepartmentMember `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` -} - -type DeleteUserInDepartmentReq struct { - DepartmentID string `json:"departmentID" binding:"required"` - UserID string `json:"userID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} -type DeleteUserInDepartmentResp struct { - CommResp -} - -type GetUserInOrganizationReq struct { - OperationID string `json:"operationID" binding:"required"` - UserIDList []string `json:"userIDList" binding:"required"` -} - -type GetUserInOrganizationResp struct { - CommResp - OrganizationUserList []*open_im_sdk.OrganizationUser `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` -} diff --git a/pkg/api_struct/oss_api_struct.go b/pkg/api_struct/oss_api_struct.go deleted file mode 100644 index 9cbac79f8..000000000 --- a/pkg/api_struct/oss_api_struct.go +++ /dev/null @@ -1,22 +0,0 @@ -package api_struct - -type OSSCredentialReq struct { - OperationID string `json:"operationID"` - Filename string `json:"filename"` - FileType string `json:"file_type"` -} - -type OSSCredentialRespData struct { - Endpoint string `json:"endpoint"` - AccessKeyId string `json:"access_key_id"` - AccessKeySecret string `json:"access_key_secret"` - Token string `json:"token"` - Bucket string `json:"bucket"` - FinalHost string `json:"final_host"` -} - -type OSSCredentialResp struct { - CommResp - OssData OSSCredentialRespData `json:"-"` - Data map[string]interface{} `json:"data"` -} diff --git a/pkg/api_struct/public_struct.go b/pkg/api_struct/public_struct.go deleted file mode 100644 index e5e8519bd..000000000 --- a/pkg/api_struct/public_struct.go +++ /dev/null @@ -1,143 +0,0 @@ -package api_struct - -import ( - "net/http" - - "github.com/gin-gonic/gin" -) - -type ApiUserInfo struct { - UserID string `json:"userID" binding:"required,min=1,max=64" swaggo:"true,用户ID,"` - Nickname string `json:"nickname" binding:"omitempty,min=1,max=64" swaggo:"true,my id,19"` - FaceURL string `json:"faceURL" binding:"omitempty,max=1024"` - Gender int32 `json:"gender" binding:"omitempty,oneof=0 1 2"` - PhoneNumber string `json:"phoneNumber" binding:"omitempty,max=32"` - Birth uint32 `json:"birth" binding:"omitempty"` - Email string `json:"email" binding:"omitempty,max=64"` - CreateTime int64 `json:"createTime"` - LoginLimit int32 `json:"loginLimit" binding:"omitempty"` - Ex string `json:"ex" binding:"omitempty,max=1024"` - BirthStr string `json:"birthStr" binding:"omitempty"` -} - -//type Conversation struct { -// OwnerUserID string `gorm:"column:owner_user_id;primary_key;type:char(128)" json:"OwnerUserID"` -// ConversationID string `gorm:"column:conversation_id;primary_key;type:char(128)" json:"conversationID"` -// ConversationType int32 `gorm:"column:conversation_type" json:"conversationType"` -// UserID string `gorm:"column:user_id;type:char(64)" json:"userID"` -// GroupID string `gorm:"column:group_id;type:char(128)" json:"groupID"` -// RecvMsgOpt int32 `gorm:"column:recv_msg_opt" json:"recvMsgOpt"` -// UnreadCount int32 `gorm:"column:unread_count" json:"unreadCount"` -// DraftTextTime int64 `gorm:"column:draft_text_time" json:"draftTextTime"` -// IsPinned bool `gorm:"column:is_pinned" json:"isPinned"` -// AttachedInfo string `gorm:"column:attached_info;type:varchar(1024)" json:"attachedInfo"` -// Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"` -//} - -type GroupAddMemberInfo struct { - UserID string `json:"userID" binding:"required"` - RoleLevel int32 `json:"roleLevel" binding:"required,oneof= 1 3"` -} - -func SetErrCodeMsg(c *gin.Context, status int) *CommResp { - resp := CommResp{ErrCode: int32(status), ErrMsg: http.StatusText(status)} - c.JSON(status, resp) - return &resp -} - -//GroupName string `json:"groupName"` -// Introduction string `json:"introduction"` -// Notification string `json:"notification"` -// FaceUrl string `json:"faceUrl"` -// OperationID string `json:"operationID" binding:"required"` -// GroupType int32 `json:"groupType"` -// Ex string `json:"ex"` - -//type GroupInfo struct { -// GroupID string `json:"groupID"` -// GroupName string `json:"groupName"` -// Notification string `json:"notification"` -// Introduction string `json:"introduction"` -// FaceUrl string `json:"faceUrl"` -// OwnerUserID string `json:"ownerUserID"` -// Ex string `json:"ex"` -// GroupType int32 `json:"groupType"` -//} - -//type GroupMemberFullInfo struct { -// GroupID string `json:"groupID"` -// UserID string `json:"userID"` -// RoleLevel int32 `json:"roleLevel"` -// JoinTime uint64 `json:"joinTime"` -// Nickname string `json:"nickname"` -// FaceUrl string `json:"faceUrl"` -// FriendRemark string `json:"friendRemark"` -// AppMangerLevel int32 `json:"appMangerLevel"` -// JoinSource int32 `json:"joinSource"` -// OperatorUserID string `json:"operatorUserID"` -// Ex string `json:"ex"` -//} -// -//type PublicUserInfo struct { -// UserID string `json:"userID"` -// Nickname string `json:"nickname"` -// FaceUrl string `json:"faceUrl"` -// Gender int32 `json:"gender"` -//} -// -//type UserInfo struct { -// UserID string `json:"userID"` -// Nickname string `json:"nickname"` -// FaceUrl string `json:"faceUrl"` -// Gender int32 `json:"gender"` -// Mobile string `json:"mobile"` -// Birth string `json:"birth"` -// Email string `json:"email"` -// Ex string `json:"ex"` -//} -// -//type FriendInfo struct { -// OwnerUserID string `json:"ownerUserID"` -// Remark string `json:"remark"` -// CreateTime int64 `json:"createTime"` -// FriendUser UserInfo `json:"friendUser"` -// AddSource int32 `json:"addSource"` -// OperatorUserID string `json:"operatorUserID"` -// Ex string `json:"ex"` -//} -// -//type BlackInfo struct { -// OwnerUserID string `json:"ownerUserID"` -// CreateTime int64 `json:"createTime"` -// BlackUser PublicUserInfo `json:"friendUser"` -// AddSource int32 `json:"addSource"` -// OperatorUserID string `json:"operatorUserID"` -// Ex string `json:"ex"` -//} -// -//type GroupRequest struct { -// UserID string `json:"userID"` -// GroupID string `json:"groupID"` -// HandleResult string `json:"handleResult"` -// ReqMsg string `json:"reqMsg"` -// HandleMsg string `json:"handleMsg"` -// ReqTime int64 `json:"reqTime"` -// HandleUserID string `json:"handleUserID"` -// HandleTime int64 `json:"handleTime"` -// Ex string `json:"ex"` -//} -// -//type FriendRequest struct { -// FromUserID string `json:"fromUserID"` -// ToUserID string `json:"toUserID"` -// HandleResult int32 `json:"handleResult"` -// ReqMessage string `json:"reqMessage"` -// CreateTime int64 `json:"createTime"` -// HandlerUserID string `json:"handlerUserID"` -// HandleMsg string `json:"handleMsg"` -// HandleTime int64 `json:"handleTime"` -// Ex string `json:"ex"` -//} -// -// -// diff --git a/pkg/api_struct/third_api_struct.go b/pkg/api_struct/third_api_struct.go deleted file mode 100644 index 258c19a42..000000000 --- a/pkg/api_struct/third_api_struct.go +++ /dev/null @@ -1,123 +0,0 @@ -package api_struct - -import "mime/multipart" - -type MinioStorageCredentialReq struct { - OperationID string `json:"operationID"` -} - -type MiniostorageCredentialResp struct { - SecretAccessKey string `json:"secretAccessKey"` - AccessKeyID string `json:"accessKeyID"` - SessionToken string `json:"sessionToken"` - BucketName string `json:"bucketName"` - StsEndpointURL string `json:"stsEndpointURL"` - StorageTime int `json:"storageTime"` - IsDistributedMod bool `json:"isDistributedMod"` -} - -type MinioUploadFileReq struct { - OperationID string `form:"operationID" binding:"required"` - FileType int `form:"fileType" binding:"required"` -} - -type MinioUploadFile struct { - URL string `json:"URL"` - NewName string `json:"newName"` - SnapshotURL string `json:"snapshotURL,omitempty"` - SnapshotNewName string `json:"snapshotName,omitempty"` -} - -type MinioUploadFileResp struct { - CommResp - Data struct { - MinioUploadFile - } `json:"data"` -} - -type UploadUpdateAppReq struct { - OperationID string `form:"operationID" binding:"required"` - Type int `form:"type" binding:"required"` - Version string `form:"version" binding:"required"` - File *multipart.FileHeader `form:"file" binding:"required"` - Yaml *multipart.FileHeader `form:"yaml"` - ForceUpdate bool `form:"forceUpdate"` - UpdateLog string `form:"updateLog" binding:"required"` -} - -type UploadUpdateAppResp struct { - CommResp -} - -type GetDownloadURLReq struct { - OperationID string `json:"operationID" binding:"required"` - Type int `json:"type" binding:"required"` - Version string `json:"version" binding:"required"` -} - -type GetDownloadURLResp struct { - CommResp - Data struct { - HasNewVersion bool `json:"hasNewVersion"` - ForceUpdate bool `json:"forceUpdate"` - FileURL string `json:"fileURL"` - YamlURL string `json:"yamlURL"` - Version string `json:"version"` - UpdateLog string `json:"update_log"` - } `json:"data"` -} - -type GetRTCInvitationInfoReq struct { - OperationID string `json:"operationID" binding:"required"` - ClientMsgID string `json:"clientMsgID" binding:"required"` -} - -type GetRTCInvitationInfoResp struct { - CommResp - Data struct { - OpUserID string `json:"opUserID"` - Invitation struct { - InviterUserID string `json:"inviterUserID"` - InviteeUserIDList []string `json:"inviteeUserIDList"` - GroupID string `json:"groupID"` - RoomID string `json:"roomID"` - Timeout int32 `json:"timeout"` - MediaType string `json:"mediaType"` - SessionType int32 `json:"sessionType"` - InitiateTime int32 `json:"initiateTime"` - PlatformID int32 `json:"platformID"` - CustomData string `json:"customData"` - } `json:"invitation"` - OfflinePushInfo struct{} `json:"offlinePushInfo"` - } `json:"data"` -} - -type GetRTCInvitationInfoStartAppReq struct { - OperationID string `json:"operationID" binding:"required"` -} - -type GetRTCInvitationInfoStartAppResp struct { - GetRTCInvitationInfoResp -} - -/** - * FCM第三方上报Token - */ -type FcmUpdateTokenReq struct { - OperationID string `json:"operationID" binding:"required"` - Platform int `json:"platform" binding:"required,min=1,max=2"` //only for ios + android - FcmToken string `json:"fcmToken" binding:"required"` -} - -type FcmUpdateTokenResp struct { - CommResp -} -type SetAppBadgeReq struct { - OperationID string `json:"operationID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` - AppUnreadCount int32 `json:"appUnreadCount"` -} - -type SetAppBadgeResp struct { - CommResp -} diff --git a/pkg/api_struct/user_api_struct.go b/pkg/api_struct/user_api_struct.go deleted file mode 100644 index 7cd165fbb..000000000 --- a/pkg/api_struct/user_api_struct.go +++ /dev/null @@ -1,58 +0,0 @@ -package api_struct - -import ( - open_im_sdk "Open_IM/pkg/proto/sdk_ws" -) - -type GetUsersInfoReq struct { - OperationID string `json:"operationID" binding:"required"` - UserIDList []string `json:"userIDList" binding:"required"` -} -type GetUsersInfoResp struct { - CommResp - UserInfoList []*open_im_sdk.PublicUserInfo `json:"-"` - Data []map[string]interface{} `json:"data" swaggerignore:"true"` -} - -type UpdateSelfUserInfoReq struct { - ApiUserInfo - OperationID string `json:"operationID" binding:"required"` -} -type SetGlobalRecvMessageOptReq struct { - OperationID string `json:"operationID" binding:"required"` - GlobalRecvMsgOpt *int32 `json:"globalRecvMsgOpt" binding:"omitempty,oneof=0 1 2"` -} -type SetGlobalRecvMessageOptResp struct { - CommResp -} -type UpdateUserInfoResp struct { - CommResp -} - -type GetSelfUserInfoReq struct { - OperationID string `json:"operationID" binding:"required"` - UserID string `json:"userID" binding:"required"` -} -type GetSelfUserInfoResp struct { - CommResp - UserInfo *open_im_sdk.UserInfo `json:"-"` - Data map[string]interface{} `json:"data" swaggerignore:"true"` -} - -type GetFriendIDListFromCacheReq struct { - OperationID string `json:"operationID" binding:"required"` -} - -type GetFriendIDListFromCacheResp struct { - CommResp - UserIDList []string `json:"userIDList" binding:"required"` -} - -type GetBlackIDListFromCacheReq struct { - OperationID string `json:"operationID" binding:"required"` -} - -type GetBlackIDListFromCacheResp struct { - CommResp - UserIDList []string `json:"userIDList" binding:"required"` -} diff --git a/pkg/api_struct/work_moments_struct.go b/pkg/api_struct/work_moments_struct.go deleted file mode 100644 index ce7fe59a4..000000000 --- a/pkg/api_struct/work_moments_struct.go +++ /dev/null @@ -1,138 +0,0 @@ -package api_struct - -import "Open_IM/pkg/proto/office" - -type CreateOneWorkMomentReq struct { - office.CreateOneWorkMomentReq -} - -type CreateOneWorkMomentResp struct { - CommResp - Data struct{} `json:"data"` -} - -type DeleteOneWorkMomentReq struct { - WorkMomentID string `json:"workMomentID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} - -type DeleteOneWorkMomentResp struct { - CommResp - Data struct{} `json:"data"` -} - -type LikeOneWorkMomentReq struct { - WorkMomentID string `json:"workMomentID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} - -type LikeOneWorkMomentResp struct { - CommResp - Data struct{} `json:"data"` -} - -type CommentOneWorkMomentReq struct { - WorkMomentID string `json:"workMomentID" binding:"required"` - ReplyUserID string `json:"replyUserID"` - Content string `json:"content" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} - -type CommentOneWorkMomentResp struct { - CommResp - Data struct{} `json:"data"` -} - -type DeleteCommentReq struct { - WorkMomentID string `json:"workMomentID" binding:"required"` - ContentID string `json:"contentID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} - -type DeleteCommentResp struct { - CommResp - Data struct{} `json:"data"` -} - -type WorkMomentsUserCommonReq struct { - PageNumber int32 `json:"pageNumber" binding:"required"` - ShowNumber int32 `json:"showNumber" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} - -type GetWorkMomentByIDReq struct { - WorkMomentID string `json:"workMomentID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} - -type WorkMoment struct { - WorkMomentID string `json:"workMomentID"` - UserID string `json:"userID"` - Content string `json:"content"` - LikeUserList []*WorkMomentUser `json:"likeUsers"` - Comments []*Comment `json:"comments"` - FaceURL string `json:"faceURL"` - UserName string `json:"userName"` - AtUserList []*WorkMomentUser `json:"atUsers"` - PermissionUserList []*WorkMomentUser `json:"permissionUsers"` - CreateTime int32 `json:"createTime"` - Permission int32 `json:"permission"` -} - -type WorkMomentUser struct { - UserID string `json:"userID"` - UserName string `json:"userName"` -} - -type Comment struct { - UserID string `json:"userID"` - UserName string `json:"userName"` - ReplyUserID string `json:"replyUserID"` - ReplyUserName string `json:"replyUserName"` - ContentID string `json:"contentID"` - Content string `json:"content"` - CreateTime int32 `json:"createTime"` -} - -type GetWorkMomentByIDResp struct { - CommResp - Data struct { - WorkMoment *WorkMoment `json:"workMoment"` - } `json:"data"` -} - -type GetUserWorkMomentsReq struct { - WorkMomentsUserCommonReq - UserID string `json:"userID"` -} - -type GetUserWorkMomentsResp struct { - CommResp - Data struct { - WorkMoments []*WorkMoment `json:"workMoments"` - CurrentPage int32 `json:"currentPage"` - ShowNumber int32 `json:"showNumber"` - } `json:"data"` -} - -type GetUserFriendWorkMomentsReq struct { - WorkMomentsUserCommonReq -} - -type GetUserFriendWorkMomentsResp struct { - CommResp - Data struct { - WorkMoments []*WorkMoment `json:"workMoments"` - CurrentPage int32 `json:"currentPage"` - ShowNumber int32 `json:"showNumber"` - } `json:"data"` -} - -type SetUserWorkMomentsLevelReq struct { - office.SetUserWorkMomentsLevelReq -} - -type SetUserWorkMomentsLevelResp struct { - CommResp - Data struct{} `json:"data"` -} diff --git a/pkg/common/middleware/gin.go b/pkg/common/middleware/gin.go index 19baaaa78..2b1f07f8e 100644 --- a/pkg/common/middleware/gin.go +++ b/pkg/common/middleware/gin.go @@ -1,10 +1,6 @@ package middleware import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/common/token_verify" - "Open_IM/pkg/utils" "bytes" "encoding/json" "github.com/gin-gonic/gin" @@ -12,27 +8,6 @@ import ( "net/http" ) -func JWTAuth() gin.HandlerFunc { - return func(c *gin.Context) { - ok, userID, errInfo := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), "") - // log.NewInfo("0", utils.GetSelfFuncName(), "userID: ", userID) - c.Set("userID", userID) - if !ok { - log.NewError("", "GetUserIDFromToken false ", c.Request.Header.Get("token")) - c.Abort() - c.JSON(http.StatusOK, gin.H{"errCode": 400, "errMsg": errInfo}) - return - } else { - if !utils.IsContain(userID, config.Config.Manager.AppManagerUid) { - c.Abort() - c.JSON(http.StatusOK, gin.H{"errCode": 400, "errMsg": "user is not admin"}) - return - } - log.NewInfo("0", utils.GetSelfFuncName(), "failed: ", errInfo) - } - } -} - func CorsHandler() gin.HandlerFunc { return func(context *gin.Context) { context.Writer.Header().Set("Access-Control-Allow-Origin", "*") diff --git a/pkg/common/multi_terminal_login/multi_terminal_login.go b/pkg/common/multi_terminal_login/multi_terminal_login.go deleted file mode 100644 index 817ab1b9d..000000000 --- a/pkg/common/multi_terminal_login/multi_terminal_login.go +++ /dev/null @@ -1,73 +0,0 @@ -package multi_terminal_login - -// -//import ( -// "Open_IM/internal/push/content_struct" -// "Open_IM/internal/push/logic" -// "Open_IM/pkg/common/config" -// "Open_IM/pkg/common/constant" -// "Open_IM/pkg/common/db" -// pbChat "Open_IM/pkg/proto/msg" -// "Open_IM/pkg/utils" -//) -// -//const DayOfSecond = 24*60*60 -//func MultiTerminalLoginChecker(uid, token string, platformID int32) error { -// // 1.check userid and platform class 0 not exists and 1 exists -// exists, err := db.DB.ExistsUserIDAndPlatform(uid, constant.PlatformNameToClass(constant.PlatformIDToName(platformID))) -// if err != nil { -// return err -// } -// //get config multi login policy -// if config.Config.MultiLoginPolicy { -// //OnlyOneTerminalAccess policy need to check all terminal -// if constant.PlatformNameToClass(constant.PlatformIDToName(platformID)) == "PC" { -// exists, err = db.DB.ExistsUserIDAndPlatform(uid, "Mobile") -// if err != nil { -// return err -// } -// } else { -// exists, err = db.DB.ExistsUserIDAndPlatform(uid, "PC") -// if err != nil { -// return err -// } -// } -// if exists == 1 { -// err := db.DB.SetUserIDAndPlatform(uid, constant.PlatformNameToClass(constant.PlatformIDToName(platformID)), token, config.Config.TokenPolicy.AccessExpire*DayOfSecond) -// if err != nil { -// return err -// } -// PushMessageToTheTerminal(uid, platformID) -// return nil -// } -// } else if config.Config.MultiLoginPolicy.MobileAndPCTerminalAccessButOtherTerminalKickEachOther { -// // common terminal need to kick eich other -// if exists == 1 { -// err := db.DB.SetUserIDAndPlatform(uid, constant.PlatformNameToClass(constant.PlatformIDToName(platformID)), token, config.Config.TokenPolicy.AccessExpire*DayOfSecond) -// if err != nil { -// return err -// } -// PushMessageToTheTerminal(uid, platformID) -// return nil -// } -// } -// err = db.DB.SetUserIDAndPlatform(uid, constant.PlatformNameToClass(constant.PlatformIDToName(platformID)), token, config.Config.TokenPolicy.AccessExpire*DayOfSecond) -// if err != nil { -// return err -// } -// PushMessageToTheTerminal(uid, platformID) -// return nil -//} -//// -////func PushMessageToTheTerminal(uid string, platform int32) { -//// -//// logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{ -//// SendID: uid, -//// RecvID: uid, -//// Content: content_struct.NewContentStructString(1, "", "Your account is already logged on other terminal,please confirm"), -//// SendTime: utils.GetCurrentTimestampBySecond(), -//// MsgFrom: constant.SysMsgType, -//// ContentType: constant.KickOnlineTip, -//// PlatformID: platform, -//// }) -////} From abd957a45907c16dee6c0b296c73a88ec22f1cd0 Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Wed, 1 Feb 2023 12:16:14 +0800 Subject: [PATCH 04/10] Error code standardization --- pkg/api_struct/aws.go | 20 +++ pkg/api_struct/conversation.go | 130 ++++++++++++++ pkg/api_struct/cos.go | 20 +++ pkg/api_struct/friend.go | 273 ++++++++++++++++++++++++++++++ pkg/api_struct/group.go | 301 +++++++++++++++++++++++++++++++++ pkg/api_struct/manage.go | 132 +++++++++++++++ pkg/api_struct/office.go | 88 ++++++++++ pkg/api_struct/organization.go | 121 +++++++++++++ pkg/api_struct/oss.go | 22 +++ pkg/api_struct/public.go | 30 ++++ pkg/api_struct/third.go | 123 ++++++++++++++ pkg/api_struct/user.go | 58 +++++++ pkg/api_struct/work_moments.go | 138 +++++++++++++++ 13 files changed, 1456 insertions(+) create mode 100644 pkg/api_struct/aws.go create mode 100644 pkg/api_struct/conversation.go create mode 100644 pkg/api_struct/cos.go create mode 100644 pkg/api_struct/friend.go create mode 100644 pkg/api_struct/group.go create mode 100644 pkg/api_struct/manage.go create mode 100644 pkg/api_struct/office.go create mode 100644 pkg/api_struct/organization.go create mode 100644 pkg/api_struct/oss.go create mode 100644 pkg/api_struct/public.go create mode 100644 pkg/api_struct/third.go create mode 100644 pkg/api_struct/user.go create mode 100644 pkg/api_struct/work_moments.go diff --git a/pkg/api_struct/aws.go b/pkg/api_struct/aws.go new file mode 100644 index 000000000..0479080e4 --- /dev/null +++ b/pkg/api_struct/aws.go @@ -0,0 +1,20 @@ +package api_struct + +type AwsStorageCredentialReq struct { + OperationID string `json:"operationID"` +} + +type AwsStorageCredentialRespData struct { + AccessKeyId string `json:"accessKeyID"` + SecretAccessKey string `json:"secretAccessKey"` + SessionToken string `json:"sessionToken"` + RegionID string `json:"regionId"` + Bucket string `json:"bucket"` + FinalHost string `json:"FinalHost"` +} + +type AwsStorageCredentialResp struct { + CommResp + CosData AwsStorageCredentialRespData + Data map[string]interface{} `json:"data"` +} diff --git a/pkg/api_struct/conversation.go b/pkg/api_struct/conversation.go new file mode 100644 index 000000000..da4b5ced9 --- /dev/null +++ b/pkg/api_struct/conversation.go @@ -0,0 +1,130 @@ +package api_struct + +type OptResult struct { + ConversationID string `json:"conversationID"` + Result *int32 `json:"result"` +} +type GetAllConversationMessageOptReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type GetAllConversationMessageOptResp struct { + CommResp + ConversationOptResultList []*OptResult `json:"data"` +} +type GetReceiveMessageOptReq struct { + ConversationIDList []string `json:"conversationIDList" binding:"required"` + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type GetReceiveMessageOptResp struct { + CommResp + ConversationOptResultList []*OptResult `json:"data"` +} +type SetReceiveMessageOptReq struct { + FromUserID string `json:"fromUserID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` + Opt *int32 `json:"opt" binding:"required"` + ConversationIDList []string `json:"conversationIDList" binding:"required"` +} +type SetReceiveMessageOptResp struct { + CommResp + ConversationOptResultList []*OptResult `json:"data"` +} + +type Conversation struct { + OwnerUserID string `json:"ownerUserID" binding:"required"` + ConversationID string `json:"conversationID" binding:"required"` + ConversationType int32 `json:"conversationType" binding:"required"` + UserID string `json:"userID"` + GroupID string `json:"groupID"` + RecvMsgOpt int32 `json:"recvMsgOpt" binding:"omitempty,oneof=0 1 2"` + UnreadCount int32 `json:"unreadCount" binding:"omitempty"` + DraftTextTime int64 `json:"draftTextTime"` + IsPinned bool `json:"isPinned" binding:"omitempty"` + IsPrivateChat bool `json:"isPrivateChat"` + BurnDuration int32 `json:"burnDuration"` + GroupAtType int32 `json:"groupAtType"` + IsNotInGroup bool `json:"isNotInGroup"` + UpdateUnreadCountTime int64 `json:"updateUnreadCountTime"` + AttachedInfo string `json:"attachedInfo"` + Ex string `json:"ex"` +} + +type SetConversationReq struct { + Conversation + NotificationType int32 `json:"notificationType"` + OperationID string `json:"operationID" binding:"required"` +} + +type SetConversationResp struct { + CommResp +} +type ModifyConversationFieldReq struct { + Conversation + FieldType int32 `json:"fieldType" binding:"required"` + UserIDList []string `json:"userIDList" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type ModifyConversationFieldResp struct { + CommResp +} + +type BatchSetConversationsReq struct { + Conversations []Conversation `json:"conversations" binding:"required"` + NotificationType int32 `json:"notificationType"` + OwnerUserID string `json:"ownerUserID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type BatchSetConversationsResp struct { + CommResp + Data struct { + Success []string `json:"success"` + Failed []string `json:"failed"` + } `json:"data"` +} + +type GetConversationReq struct { + ConversationID string `json:"conversationID" binding:"required"` + OwnerUserID string `json:"ownerUserID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type GetConversationResp struct { + CommResp + Conversation Conversation `json:"data"` +} + +type GetAllConversationsReq struct { + OwnerUserID string `json:"ownerUserID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type GetAllConversationsResp struct { + CommResp + Conversations []Conversation `json:"data"` +} + +type GetConversationsReq struct { + ConversationIDs []string `json:"conversationIDs" binding:"required"` + OwnerUserID string `json:"ownerUserID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type GetConversationsResp struct { + CommResp + Conversations []Conversation `json:"data"` +} + +type SetRecvMsgOptReq struct { + OwnerUserID string `json:"ownerUserID" binding:"required"` + ConversationID string `json:"conversationID"` + RecvMsgOpt int32 `json:"recvMsgOpt" binding:"omitempty,oneof=0 1 2"` + OperationID string `json:"operationID" binding:"required"` + NotificationType int32 `json:"notificationType"` +} + +type SetRecvMsgOptResp struct { + CommResp +} diff --git a/pkg/api_struct/cos.go b/pkg/api_struct/cos.go new file mode 100644 index 000000000..0c9e92a5b --- /dev/null +++ b/pkg/api_struct/cos.go @@ -0,0 +1,20 @@ +package api_struct + +import sts "github.com/tencentyun/qcloud-cos-sts-sdk/go" + +type TencentCloudStorageCredentialReq struct { + OperationID string `json:"operationID"` +} + +type TencentCloudStorageCredentialRespData struct { + *sts.CredentialResult + Region string `json:"region"` + Bucket string `json:"bucket"` +} + +type TencentCloudStorageCredentialResp struct { + CommResp + CosData TencentCloudStorageCredentialRespData `json:"-"` + + Data map[string]interface{} `json:"data"` +} diff --git a/pkg/api_struct/friend.go b/pkg/api_struct/friend.go new file mode 100644 index 000000000..b89ba3208 --- /dev/null +++ b/pkg/api_struct/friend.go @@ -0,0 +1,273 @@ +package api_struct + +//type ParamsCommFriend struct { +// OperationID string `json:"operationID" binding:"required"` +// ToUserID string `json:"toUserID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +// +//type AddBlacklistReq struct { +// ParamsCommFriend +//} +//type AddBlacklistResp struct { +// CommResp +//} +// +//type ImportFriendReq struct { +// FriendUserIDList []string `json:"friendUserIDList" binding:"required"` +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type UserIDResult struct { +// UserID string `json:"userID"` +// Result int32 `json:"result"` +//} +//type ImportFriendResp struct { +// CommResp +// UserIDResultList []UserIDResult `json:"data"` +//} +// +//type AddFriendReq struct { +// ParamsCommFriend +// ReqMsg string `json:"reqMsg"` +//} +//type AddFriendResp struct { +// CommResp +//} +// +//type AddFriendResponseReq struct { +// ParamsCommFriend +// Flag int32 `json:"flag" binding:"required,oneof=-1 0 1"` +// HandleMsg string `json:"handleMsg"` +//} +//type AddFriendResponseResp struct { +// CommResp +//} +// +//type DeleteFriendReq struct { +// ParamsCommFriend +//} +//type DeleteFriendResp struct { +// CommResp +//} +// +//type GetBlackListReq struct { +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type GetBlackListResp struct { +// CommResp +// BlackUserInfoList []*open_im_sdk.PublicUserInfo `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} +// +////type PublicUserInfo struct { +//// UserID string `json:"userID"` +//// Nickname string `json:"nickname"` +//// FaceUrl string `json:"faceUrl"` +//// Gender int32 `json:"gender"` +////} +// +//type SetFriendRemarkReq struct { +// ParamsCommFriend +// Remark string `json:"remark"` +//} +//type SetFriendRemarkResp struct { +// CommResp +//} +// +//type RemoveBlacklistReq struct { +// ParamsCommFriend +//} +//type RemoveBlacklistResp struct { +// CommResp +//} +// +//type IsFriendReq struct { +// ParamsCommFriend +//} +//type Response struct { +// Friend bool `json:"isFriend"` +//} +//type IsFriendResp struct { +// CommResp +// Response Response `json:"data"` +//} +// +//type GetFriendsInfoReq struct { +// ParamsCommFriend +//} +//type GetFriendsInfoResp struct { +// CommResp +// FriendInfoList []*open_im_sdk.FriendInfo `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} +// +//type GetFriendListReq struct { +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type GetFriendListResp struct { +// CommResp +// FriendInfoList []*open_im_sdk.FriendInfo `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} +// +//type GetFriendApplyListReq struct { +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type GetFriendApplyListResp struct { +// CommResp +// FriendRequestList []*open_im_sdk.FriendRequest `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} +// +//type GetSelfApplyListReq struct { +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type GetSelfApplyListResp struct { +// CommResp +// FriendRequestList []*open_im_sdk.FriendRequest `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} + +type FriendInfo struct { + UserID string `json:"userID"` + Nickname string `json:"nickname"` + FaceURL string `json:"faceURL"` + Gender int32 `json:"gender"` + Ex string `json:"ex"` +} + +type PublicUserInfo struct { + UserID string `json:"userID"` + Nickname string `json:"nickname"` + FaceURL string `json:"faceURL"` + Gender int32 `json:"gender"` + Ex string `json:"ex"` +} + +type FriendRequest struct { + FromUserID string `json:"fromUserID"` + FromNickname string `json:"fromNickname"` + FromFaceURL string `json:"fromFaceURL"` + FromGender int32 `json:"fromGender"` + ToUserID string `json:"toUserID"` + ToNickname string `json:"toNickname"` + ToFaceURL string `json:"toFaceURL"` + ToGender int32 `json:"toGender"` + HandleResult int32 `json:"handleResult"` + ReqMsg string `json:"reqMsg"` + CreateTime uint32 `json:"createTime"` + HandlerUserID string `json:"handlerUserID"` + HandleMsg string `json:"handleMsg"` + HandleTime uint32 `json:"handleTime"` + Ex string `json:"ex"` +} + +type AddBlacklistReq struct { + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type AddBlacklistResp struct { +} + +type ImportFriendReq struct { + FriendUserIDList []string `json:"friendUserIDList" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} + +type ImportFriendResp struct { + //CommResp +} + +type AddFriendReq struct { + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` + ReqMsg string `json:"reqMsg"` +} +type AddFriendResp struct { + //CommResp +} + +type AddFriendResponseReq struct { + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` + HandleResult int32 `json:"flag" binding:"required,oneof=-1 0 1"` + HandleMsg string `json:"handleMsg"` +} +type AddFriendResponseResp struct { +} + +type DeleteFriendReq struct { + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type DeleteFriendResp struct { +} + +type GetBlackListReq struct { + FromUserID string `json:"fromUserID" binding:"required"` +} +type GetBlackListResp struct { + BlackUserInfoList []PublicUserInfo `json:"blackUserInfoList"` +} + +type SetFriendRemarkReq struct { + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` + Remark string `json:"remark"` +} +type SetFriendRemarkResp struct { +} + +type RemoveBlacklistReq struct { + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type RemoveBlacklistResp struct { +} + +type IsFriendReq struct { + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type Response struct { + Friend bool `json:"isFriend"` +} +type IsFriendResp struct { + Response Response `json:"data"` +} + +type GetFriendListReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type GetFriendListResp struct { + OwnerUserID string `json:"ownerUserID"` + Remark string `json:"remark"` + CreateTime uint32 `json:"createTime"` + AddSource int32 `json:"addSource"` + OperatorUserID string `json:"operatorUserID"` + Ex string `json:"ex"` + //FriendUser *UserInfo // TODO +} + +type GetFriendApplyListReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} + +type GetFriendApplyListResp struct { + FriendRequestList []FriendRequest `json:"friendRequestList"` +} + +type GetSelfApplyListReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type GetSelfApplyListResp struct { + FriendRequestList []FriendRequest `json:"friendRequestList"` +} diff --git a/pkg/api_struct/group.go b/pkg/api_struct/group.go new file mode 100644 index 000000000..b15458d79 --- /dev/null +++ b/pkg/api_struct/group.go @@ -0,0 +1,301 @@ +package api_struct + +import ( + open_im_sdk "Open_IM/pkg/proto/sdk_ws" +) + +type CommResp struct { + ErrCode int32 `json:"errCode"` + ErrMsg string `json:"errMsg"` +} + +type CommDataResp struct { + CommResp + Data []map[string]interface{} `json:"data"` +} + +type KickGroupMemberReq struct { + GroupID string `json:"groupID" binding:"required"` + KickedUserIDList []string `json:"kickedUserIDList" binding:"required"` + Reason string `json:"reason"` + OperationID string `json:"operationID" binding:"required"` +} +type KickGroupMemberResp struct { + CommResp + UserIDResultList []*UserIDResult `json:"data"` +} + +type GetGroupMembersInfoReq struct { + GroupID string `json:"groupID" binding:"required"` + MemberList []string `json:"memberList" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type GetGroupMembersInfoResp struct { + CommResp + MemberList []*open_im_sdk.GroupMemberFullInfo `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type InviteUserToGroupReq struct { + GroupID string `json:"groupID" binding:"required"` + InvitedUserIDList []string `json:"invitedUserIDList" binding:"required"` + Reason string `json:"reason"` + OperationID string `json:"operationID" binding:"required"` +} +type InviteUserToGroupResp struct { + CommResp + UserIDResultList []*UserIDResult `json:"data"` +} + +type GetJoinedGroupListReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type GetJoinedGroupListResp struct { + CommResp + GroupInfoList []*open_im_sdk.GroupInfo `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type GetGroupMemberListReq struct { + GroupID string `json:"groupID"` + Filter int32 `json:"filter"` + NextSeq int32 `json:"nextSeq"` + OperationID string `json:"operationID"` +} +type GetGroupMemberListResp struct { + CommResp + NextSeq int32 `json:"nextSeq"` + MemberList []*open_im_sdk.GroupMemberFullInfo `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type GetGroupAllMemberReq struct { + GroupID string `json:"groupID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` + Offset int32 `json:"offset"` + Count int32 `json:"count"` +} +type GetGroupAllMemberResp struct { + CommResp + MemberList []*open_im_sdk.GroupMemberFullInfo `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} + +// +//type GetGroupAllMemberListBySplitReq struct { +// GroupID string `json:"groupID" binding:"required"` +// OperationID string `json:"operationID" binding:"required"` +// Offset int32 `json:"offset" binding:"required"` +// Count int32 `json:"count" binding:"required"` +//} +//type GetGroupAllMemberListBySplitResp struct { +// CommResp +// MemberList []*open_im_sdk.GroupMemberFullInfo `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} + +type CreateGroupReq struct { + MemberList []*GroupAddMemberInfo `json:"memberList"` + OwnerUserID string `json:"ownerUserID"` + GroupType int32 `json:"groupType"` + GroupName string `json:"groupName"` + Notification string `json:"notification"` + Introduction string `json:"introduction"` + FaceURL string `json:"faceURL"` + Ex string `json:"ex"` + OperationID string `json:"operationID" binding:"required"` + GroupID string `json:"groupID"` +} +type CreateGroupResp struct { + CommResp + GroupInfo open_im_sdk.GroupInfo `json:"-"` + Data map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type GetGroupApplicationListReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` //作为管理员或群主收到的 进群申请 +} +type GetGroupApplicationListResp struct { + CommResp + GroupRequestList []*open_im_sdk.GroupRequest `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type GetUserReqGroupApplicationListReq struct { + OperationID string `json:"operationID" binding:"required"` + UserID string `json:"userID" binding:"required"` +} + +type GetUserRespGroupApplicationResp struct { + GroupRequestList []*open_im_sdk.GroupRequest `json:"data"` +} + +type GetGroupInfoReq struct { + GroupIDList []string `json:"groupIDList" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type GetGroupInfoResp struct { + CommResp + GroupInfoList []*open_im_sdk.GroupInfo `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} + +//type GroupInfoAlias struct { +// open_im_sdk.GroupInfo +// NeedVerification int32 `protobuf:"bytes,13,opt,name=needVerification" json:"needVerification,omitempty"` +//} + +//type GroupInfoAlias struct { +// GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"` +// GroupName string `protobuf:"bytes,2,opt,name=groupName" json:"groupName,omitempty"` +// Notification string `protobuf:"bytes,3,opt,name=notification" json:"notification,omitempty"` +// Introduction string `protobuf:"bytes,4,opt,name=introduction" json:"introduction,omitempty"` +// FaceURL string `protobuf:"bytes,5,opt,name=faceURL" json:"faceURL,omitempty"` +// OwnerUserID string `protobuf:"bytes,6,opt,name=ownerUserID" json:"ownerUserID,omitempty"` +// CreateTime uint32 `protobuf:"varint,7,opt,name=createTime" json:"createTime,omitempty"` +// MemberCount uint32 `protobuf:"varint,8,opt,name=memberCount" json:"memberCount,omitempty"` +// Ex string `protobuf:"bytes,9,opt,name=ex" json:"ex,omitempty"` +// Status int32 `protobuf:"varint,10,opt,name=status" json:"status,omitempty"` +// CreatorUserID string `protobuf:"bytes,11,opt,name=creatorUserID" json:"creatorUserID,omitempty"` +// GroupType int32 `protobuf:"varint,12,opt,name=groupType" json:"groupType,omitempty"` +// NeedVerification int32 `protobuf:"bytes,13,opt,name=needVerification" json:"needVerification,omitempty"` +//} + +type ApplicationGroupResponseReq struct { + OperationID string `json:"operationID" binding:"required"` + GroupID string `json:"groupID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` //application from FromUserID + HandledMsg string `json:"handledMsg"` + HandleResult int32 `json:"handleResult" binding:"required,oneof=-1 1"` +} +type ApplicationGroupResponseResp struct { + CommResp +} + +type JoinGroupReq struct { + GroupID string `json:"groupID" binding:"required"` + ReqMessage string `json:"reqMessage"` + OperationID string `json:"operationID" binding:"required"` + JoinSource int32 `json:"joinSource"` + InviterUserID string `json:"inviterUserID"` +} + +type JoinGroupResp struct { + CommResp +} + +type QuitGroupReq struct { + GroupID string `json:"groupID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type QuitGroupResp struct { + CommResp +} + +type SetGroupInfoReq struct { + GroupID string `json:"groupID" binding:"required"` + GroupName string `json:"groupName"` + Notification string `json:"notification"` + Introduction string `json:"introduction"` + FaceURL string `json:"faceURL"` + Ex string `json:"ex"` + OperationID string `json:"operationID" binding:"required"` + NeedVerification *int32 `json:"needVerification"` + LookMemberInfo *int32 `json:"lookMemberInfo"` + ApplyMemberFriend *int32 `json:"applyMemberFriend"` +} + +type SetGroupInfoResp struct { + CommResp +} + +type TransferGroupOwnerReq struct { + GroupID string `json:"groupID" binding:"required"` + OldOwnerUserID string `json:"oldOwnerUserID" binding:"required"` + NewOwnerUserID string `json:"newOwnerUserID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type TransferGroupOwnerResp struct { + CommResp +} + +type DismissGroupReq struct { + GroupID string `json:"groupID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type DismissGroupResp struct { + CommResp +} + +type MuteGroupMemberReq struct { + OperationID string `json:"operationID" binding:"required"` + GroupID string `json:"groupID" binding:"required"` + UserID string `json:"userID" binding:"required"` + MutedSeconds uint32 `json:"mutedSeconds" binding:"required"` +} +type MuteGroupMemberResp struct { + CommResp +} + +type CancelMuteGroupMemberReq struct { + OperationID string `json:"operationID" binding:"required"` + GroupID string `json:"groupID" binding:"required"` + UserID string `json:"userID" binding:"required"` +} +type CancelMuteGroupMemberResp struct { + CommResp +} + +type MuteGroupReq struct { + OperationID string `json:"operationID" binding:"required"` + GroupID string `json:"groupID" binding:"required"` +} +type MuteGroupResp struct { + CommResp +} + +type CancelMuteGroupReq struct { + OperationID string `json:"operationID" binding:"required"` + GroupID string `json:"groupID" binding:"required"` +} +type CancelMuteGroupResp struct { + CommResp +} + +type SetGroupMemberNicknameReq struct { + OperationID string `json:"operationID" binding:"required"` + GroupID string `json:"groupID" binding:"required"` + UserID string `json:"userID" binding:"required"` + Nickname string `json:"nickname"` +} + +type SetGroupMemberNicknameResp struct { + CommResp +} + +type SetGroupMemberInfoReq struct { + OperationID string `json:"operationID" binding:"required"` + GroupID string `json:"groupID" binding:"required"` + UserID string `json:"userID" binding:"required"` + Nickname *string `json:"nickname"` + FaceURL *string `json:"userGroupFaceUrl"` + RoleLevel *int32 `json:"roleLevel" validate:"gte=1,lte=3"` + Ex *string `json:"ex"` +} + +type SetGroupMemberInfoResp struct { + CommResp +} + +type GetGroupAbstractInfoReq struct { + OperationID string `json:"operationID"` + GroupID string `json:"groupID"` +} + +type GetGroupAbstractInfoResp struct { + CommResp + GroupMemberNumber int32 `json:"groupMemberNumber"` + GroupMemberListHash uint64 `json:"groupMemberListHash"` +} diff --git a/pkg/api_struct/manage.go b/pkg/api_struct/manage.go new file mode 100644 index 000000000..4e6c6977b --- /dev/null +++ b/pkg/api_struct/manage.go @@ -0,0 +1,132 @@ +package api_struct + +import ( + pbRelay "Open_IM/pkg/proto/relay" + server_api_params "Open_IM/pkg/proto/sdk_ws" + pbUser "Open_IM/pkg/proto/user" +) + +type DeleteUsersReq struct { + OperationID string `json:"operationID" binding:"required"` + DeleteUserIDList []string `json:"deleteUserIDList" binding:"required"` +} +type DeleteUsersResp struct { + CommResp + FailedUserIDList []string `json:"data"` +} +type GetAllUsersUidReq struct { + OperationID string `json:"operationID" binding:"required"` +} +type GetAllUsersUidResp struct { + CommResp + UserIDList []string `json:"data"` +} +type GetUsersOnlineStatusReq struct { + OperationID string `json:"operationID" binding:"required"` + UserIDList []string `json:"userIDList" binding:"required,lte=200"` +} +type GetUsersOnlineStatusResp struct { + CommResp + SuccessResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult `json:"data"` +} +type AccountCheckReq struct { + OperationID string `json:"operationID" binding:"required"` + CheckUserIDList []string `json:"checkUserIDList" binding:"required,lte=100"` +} +type AccountCheckResp struct { + CommResp + ResultList []*pbUser.AccountCheckResp_SingleUserStatus `json:"data"` +} + +type ManagementSendMsg struct { + OperationID string `json:"operationID" binding:"required"` + BusinessOperationID string `json:"businessOperationID"` + SendID string `json:"sendID" binding:"required"` + GroupID string `json:"groupID" ` + SenderNickname string `json:"senderNickname" ` + SenderFaceURL string `json:"senderFaceURL" ` + SenderPlatformID int32 `json:"senderPlatformID"` + //ForceList []string `json:"forceList" ` + Content map[string]interface{} `json:"content" binding:"required" swaggerignore:"true"` + ContentType int32 `json:"contentType" binding:"required"` + SessionType int32 `json:"sessionType" binding:"required"` + IsOnlineOnly bool `json:"isOnlineOnly"` + NotOfflinePush bool `json:"notOfflinePush"` + OfflinePushInfo *server_api_params.OfflinePushInfo `json:"offlinePushInfo"` +} + +type ManagementSendMsgReq struct { + ManagementSendMsg + RecvID string `json:"recvID" ` +} + +type ManagementSendMsgResp struct { + CommResp + ResultList server_api_params.UserSendMsgResp `json:"data"` +} + +type ManagementBatchSendMsgReq struct { + ManagementSendMsg + IsSendAll bool `json:"isSendAll"` + RecvIDList []string `json:"recvIDList"` +} + +type ManagementBatchSendMsgResp struct { + CommResp + Data struct { + ResultList []*SingleReturnResult `json:"resultList"` + FailedIDList []string + } `json:"data"` +} +type SingleReturnResult struct { + ServerMsgID string `json:"serverMsgID"` + ClientMsgID string `json:"clientMsgID"` + SendTime int64 `json:"sendTime"` + RecvID string `json:"recvID" ` +} + +type CheckMsgIsSendSuccessReq struct { + OperationID string `json:"operationID"` +} + +type CheckMsgIsSendSuccessResp struct { + CommResp + Status int32 `json:"status"` +} + +type GetUsersReq struct { + OperationID string `json:"operationID" binding:"required"` + UserName string `json:"userName"` + UserID string `json:"userID"` + Content string `json:"content"` + PageNumber int32 `json:"pageNumber" binding:"required"` + ShowNumber int32 `json:"showNumber" binding:"required"` +} + +type CMSUser struct { + UserID string `json:"userID"` + Nickname string `json:"nickname"` + FaceURL string `json:"faceURL"` + Gender int32 `json:"gender"` + PhoneNumber string `json:"phoneNumber"` + Birth uint32 `json:"birth"` + Email string `json:"email"` + Ex string `json:"ex"` + CreateIp string `json:"createIp"` + CreateTime uint32 `json:"createTime"` + LastLoginIp string `json:"LastLoginIp"` + LastLoginTime uint32 `json:"LastLoginTime"` + AppMangerLevel int32 `json:"appMangerLevel"` + GlobalRecvMsgOpt int32 `json:"globalRecvMsgOpt"` + IsBlock bool `json:"isBlock"` +} + +type GetUsersResp struct { + CommResp + Data struct { + UserList []*CMSUser `json:"userList"` + TotalNum int32 `json:"totalNum"` + CurrentPage int32 `json:"currentPage"` + ShowNumber int32 `json:"showNumber"` + } `json:"data"` +} diff --git a/pkg/api_struct/office.go b/pkg/api_struct/office.go new file mode 100644 index 000000000..3eeb1ed3f --- /dev/null +++ b/pkg/api_struct/office.go @@ -0,0 +1,88 @@ +package api_struct + +import ( + pbOffice "Open_IM/pkg/proto/office" +) + +type GetUserTagsReq struct { + OperationID string `json:"operationID" binding:"required"` +} + +type GetUserTagsResp struct { + CommResp + Data struct { + Tags []*pbOffice.Tag `json:"tags"` + } `json:"data"` +} + +type CreateTagReq struct { + TagName string `json:"tagName" binding:"required"` // tag名称 + UserIDList []string `json:"userIDList" binding:"required"` // 用户ID列表 + OperationID string `json:"operationID" binding:"required"` +} + +type CreateTagResp struct { + CommResp +} + +type DeleteTagReq struct { + TagID string `json:"tagID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type DeleteTagResp struct { + CommResp +} + +type SetTagReq struct { + TagID string `json:"tagID" binding:"required"` + NewName string `json:"newName"` + IncreaseUserIDList []string `json:"increaseUserIDList"` + ReduceUserIDList []string `json:"reduceUserIDList"` + OperationID string `json:"operationID" binding:"required"` +} + +type SetTagResp struct { + CommResp +} + +type SendMsg2TagReq struct { + TagList []string `json:"tagList"` + UserList []string `json:"userList"` + GroupList []string `json:"groupList"` + + SenderPlatformID int32 `json:"senderPlatformID" binding:"required"` + Content string `json:"content" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type SendMsg2TagResp struct { + CommResp +} + +type GetTagSendLogsReq struct { + PageNumber int32 `json:"pageNumber" binding:"required"` + ShowNumber int32 `json:"showNumber" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type GetTagSendLogsResp struct { + CommResp + Data struct { + Logs []*pbOffice.TagSendLog `json:"logs"` + CurrentPage int32 `json:"currentPage"` + ShowNumber int32 `json:"showNumber"` + } `json:"data"` +} + +type GetUserTagByIDReq struct { + TagID string `json:"tagID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type GetUserTagByIDResp struct { + CommResp + Data struct { + Tag *pbOffice.Tag `json:"tag"` + } `json:"data"` +} diff --git a/pkg/api_struct/organization.go b/pkg/api_struct/organization.go new file mode 100644 index 000000000..c6c1d8327 --- /dev/null +++ b/pkg/api_struct/organization.go @@ -0,0 +1,121 @@ +package api_struct + +import open_im_sdk "Open_IM/pkg/proto/sdk_ws" + +type CreateDepartmentReq struct { + *open_im_sdk.Department + OperationID string `json:"operationID" binding:"required"` +} +type CreateDepartmentResp struct { + CommResp + Department *open_im_sdk.Department `json:"-"` + Data map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type UpdateDepartmentReq struct { + *open_im_sdk.Department + DepartmentID string `json:"departmentID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type UpdateDepartmentResp struct { + CommResp +} + +type GetSubDepartmentReq struct { + OperationID string `json:"operationID" binding:"required"` + DepartmentID string `json:"departmentID" binding:"required"` +} +type GetSubDepartmentResp struct { + CommResp + DepartmentList []*open_im_sdk.Department `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type DeleteDepartmentReq struct { + OperationID string `json:"operationID" binding:"required"` + DepartmentID string `json:"departmentID" binding:"required"` +} +type DeleteDepartmentResp struct { + CommResp +} + +type CreateOrganizationUserReq struct { + OperationID string `json:"operationID" binding:"required"` + *open_im_sdk.OrganizationUser +} +type CreateOrganizationUserResp struct { + CommResp +} + +type UpdateOrganizationUserReq struct { + OperationID string `json:"operationID" binding:"required"` + *open_im_sdk.OrganizationUser +} +type UpdateOrganizationUserResp struct { + CommResp +} + +type CreateDepartmentMemberReq struct { + OperationID string `json:"operationID" binding:"required"` + *open_im_sdk.DepartmentMember +} + +type CreateDepartmentMemberResp struct { + CommResp +} + +type GetUserInDepartmentReq struct { + UserID string `json:"userID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type GetUserInDepartmentResp struct { + CommResp + UserInDepartment *open_im_sdk.UserInDepartment `json:"-"` + Data map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type UpdateUserInDepartmentReq struct { + OperationID string `json:"operationID" binding:"required"` + *open_im_sdk.DepartmentMember +} +type UpdateUserInDepartmentResp struct { + CommResp +} + +type DeleteOrganizationUserReq struct { + UserID string `json:"userID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type DeleteOrganizationUserResp struct { + CommResp +} + +type GetDepartmentMemberReq struct { + DepartmentID string `json:"departmentID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type GetDepartmentMemberResp struct { + CommResp + UserInDepartmentList []*open_im_sdk.UserDepartmentMember `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type DeleteUserInDepartmentReq struct { + DepartmentID string `json:"departmentID" binding:"required"` + UserID string `json:"userID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type DeleteUserInDepartmentResp struct { + CommResp +} + +type GetUserInOrganizationReq struct { + OperationID string `json:"operationID" binding:"required"` + UserIDList []string `json:"userIDList" binding:"required"` +} + +type GetUserInOrganizationResp struct { + CommResp + OrganizationUserList []*open_im_sdk.OrganizationUser `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} diff --git a/pkg/api_struct/oss.go b/pkg/api_struct/oss.go new file mode 100644 index 000000000..9cbac79f8 --- /dev/null +++ b/pkg/api_struct/oss.go @@ -0,0 +1,22 @@ +package api_struct + +type OSSCredentialReq struct { + OperationID string `json:"operationID"` + Filename string `json:"filename"` + FileType string `json:"file_type"` +} + +type OSSCredentialRespData struct { + Endpoint string `json:"endpoint"` + AccessKeyId string `json:"access_key_id"` + AccessKeySecret string `json:"access_key_secret"` + Token string `json:"token"` + Bucket string `json:"bucket"` + FinalHost string `json:"final_host"` +} + +type OSSCredentialResp struct { + CommResp + OssData OSSCredentialRespData `json:"-"` + Data map[string]interface{} `json:"data"` +} diff --git a/pkg/api_struct/public.go b/pkg/api_struct/public.go new file mode 100644 index 000000000..99109bf76 --- /dev/null +++ b/pkg/api_struct/public.go @@ -0,0 +1,30 @@ +package api_struct + +import ( + "net/http" + + "github.com/gin-gonic/gin" +) + +type ApiUserInfo struct { + UserID string `json:"userID" binding:"required,min=1,max=64" swaggo:"true,用户ID,"` + Nickname string `json:"nickname" binding:"omitempty,min=1,max=64" swaggo:"true,my id,19"` + FaceURL string `json:"faceURL" binding:"omitempty,max=1024"` + Gender int32 `json:"gender" binding:"omitempty,oneof=0 1 2"` + PhoneNumber string `json:"phoneNumber" binding:"omitempty,max=32"` + Birth int64 `json:"birth" binding:"omitempty"` + Email string `json:"email" binding:"omitempty,max=64"` + CreateTime int64 `json:"createTime"` + Ex string `json:"ex" binding:"omitempty,max=1024"` +} + +type GroupAddMemberInfo struct { + UserID string `json:"userID" binding:"required"` + RoleLevel int32 `json:"roleLevel" binding:"required,oneof= 1 3"` +} + +func SetErrCodeMsg(c *gin.Context, status int) *CommResp { + resp := CommResp{ErrCode: int32(status), ErrMsg: http.StatusText(status)} + c.JSON(status, resp) + return &resp +} diff --git a/pkg/api_struct/third.go b/pkg/api_struct/third.go new file mode 100644 index 000000000..258c19a42 --- /dev/null +++ b/pkg/api_struct/third.go @@ -0,0 +1,123 @@ +package api_struct + +import "mime/multipart" + +type MinioStorageCredentialReq struct { + OperationID string `json:"operationID"` +} + +type MiniostorageCredentialResp struct { + SecretAccessKey string `json:"secretAccessKey"` + AccessKeyID string `json:"accessKeyID"` + SessionToken string `json:"sessionToken"` + BucketName string `json:"bucketName"` + StsEndpointURL string `json:"stsEndpointURL"` + StorageTime int `json:"storageTime"` + IsDistributedMod bool `json:"isDistributedMod"` +} + +type MinioUploadFileReq struct { + OperationID string `form:"operationID" binding:"required"` + FileType int `form:"fileType" binding:"required"` +} + +type MinioUploadFile struct { + URL string `json:"URL"` + NewName string `json:"newName"` + SnapshotURL string `json:"snapshotURL,omitempty"` + SnapshotNewName string `json:"snapshotName,omitempty"` +} + +type MinioUploadFileResp struct { + CommResp + Data struct { + MinioUploadFile + } `json:"data"` +} + +type UploadUpdateAppReq struct { + OperationID string `form:"operationID" binding:"required"` + Type int `form:"type" binding:"required"` + Version string `form:"version" binding:"required"` + File *multipart.FileHeader `form:"file" binding:"required"` + Yaml *multipart.FileHeader `form:"yaml"` + ForceUpdate bool `form:"forceUpdate"` + UpdateLog string `form:"updateLog" binding:"required"` +} + +type UploadUpdateAppResp struct { + CommResp +} + +type GetDownloadURLReq struct { + OperationID string `json:"operationID" binding:"required"` + Type int `json:"type" binding:"required"` + Version string `json:"version" binding:"required"` +} + +type GetDownloadURLResp struct { + CommResp + Data struct { + HasNewVersion bool `json:"hasNewVersion"` + ForceUpdate bool `json:"forceUpdate"` + FileURL string `json:"fileURL"` + YamlURL string `json:"yamlURL"` + Version string `json:"version"` + UpdateLog string `json:"update_log"` + } `json:"data"` +} + +type GetRTCInvitationInfoReq struct { + OperationID string `json:"operationID" binding:"required"` + ClientMsgID string `json:"clientMsgID" binding:"required"` +} + +type GetRTCInvitationInfoResp struct { + CommResp + Data struct { + OpUserID string `json:"opUserID"` + Invitation struct { + InviterUserID string `json:"inviterUserID"` + InviteeUserIDList []string `json:"inviteeUserIDList"` + GroupID string `json:"groupID"` + RoomID string `json:"roomID"` + Timeout int32 `json:"timeout"` + MediaType string `json:"mediaType"` + SessionType int32 `json:"sessionType"` + InitiateTime int32 `json:"initiateTime"` + PlatformID int32 `json:"platformID"` + CustomData string `json:"customData"` + } `json:"invitation"` + OfflinePushInfo struct{} `json:"offlinePushInfo"` + } `json:"data"` +} + +type GetRTCInvitationInfoStartAppReq struct { + OperationID string `json:"operationID" binding:"required"` +} + +type GetRTCInvitationInfoStartAppResp struct { + GetRTCInvitationInfoResp +} + +/** + * FCM第三方上报Token + */ +type FcmUpdateTokenReq struct { + OperationID string `json:"operationID" binding:"required"` + Platform int `json:"platform" binding:"required,min=1,max=2"` //only for ios + android + FcmToken string `json:"fcmToken" binding:"required"` +} + +type FcmUpdateTokenResp struct { + CommResp +} +type SetAppBadgeReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` + AppUnreadCount int32 `json:"appUnreadCount"` +} + +type SetAppBadgeResp struct { + CommResp +} diff --git a/pkg/api_struct/user.go b/pkg/api_struct/user.go new file mode 100644 index 000000000..7cd165fbb --- /dev/null +++ b/pkg/api_struct/user.go @@ -0,0 +1,58 @@ +package api_struct + +import ( + open_im_sdk "Open_IM/pkg/proto/sdk_ws" +) + +type GetUsersInfoReq struct { + OperationID string `json:"operationID" binding:"required"` + UserIDList []string `json:"userIDList" binding:"required"` +} +type GetUsersInfoResp struct { + CommResp + UserInfoList []*open_im_sdk.PublicUserInfo `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type UpdateSelfUserInfoReq struct { + ApiUserInfo + OperationID string `json:"operationID" binding:"required"` +} +type SetGlobalRecvMessageOptReq struct { + OperationID string `json:"operationID" binding:"required"` + GlobalRecvMsgOpt *int32 `json:"globalRecvMsgOpt" binding:"omitempty,oneof=0 1 2"` +} +type SetGlobalRecvMessageOptResp struct { + CommResp +} +type UpdateUserInfoResp struct { + CommResp +} + +type GetSelfUserInfoReq struct { + OperationID string `json:"operationID" binding:"required"` + UserID string `json:"userID" binding:"required"` +} +type GetSelfUserInfoResp struct { + CommResp + UserInfo *open_im_sdk.UserInfo `json:"-"` + Data map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type GetFriendIDListFromCacheReq struct { + OperationID string `json:"operationID" binding:"required"` +} + +type GetFriendIDListFromCacheResp struct { + CommResp + UserIDList []string `json:"userIDList" binding:"required"` +} + +type GetBlackIDListFromCacheReq struct { + OperationID string `json:"operationID" binding:"required"` +} + +type GetBlackIDListFromCacheResp struct { + CommResp + UserIDList []string `json:"userIDList" binding:"required"` +} diff --git a/pkg/api_struct/work_moments.go b/pkg/api_struct/work_moments.go new file mode 100644 index 000000000..ce7fe59a4 --- /dev/null +++ b/pkg/api_struct/work_moments.go @@ -0,0 +1,138 @@ +package api_struct + +import "Open_IM/pkg/proto/office" + +type CreateOneWorkMomentReq struct { + office.CreateOneWorkMomentReq +} + +type CreateOneWorkMomentResp struct { + CommResp + Data struct{} `json:"data"` +} + +type DeleteOneWorkMomentReq struct { + WorkMomentID string `json:"workMomentID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type DeleteOneWorkMomentResp struct { + CommResp + Data struct{} `json:"data"` +} + +type LikeOneWorkMomentReq struct { + WorkMomentID string `json:"workMomentID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type LikeOneWorkMomentResp struct { + CommResp + Data struct{} `json:"data"` +} + +type CommentOneWorkMomentReq struct { + WorkMomentID string `json:"workMomentID" binding:"required"` + ReplyUserID string `json:"replyUserID"` + Content string `json:"content" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type CommentOneWorkMomentResp struct { + CommResp + Data struct{} `json:"data"` +} + +type DeleteCommentReq struct { + WorkMomentID string `json:"workMomentID" binding:"required"` + ContentID string `json:"contentID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type DeleteCommentResp struct { + CommResp + Data struct{} `json:"data"` +} + +type WorkMomentsUserCommonReq struct { + PageNumber int32 `json:"pageNumber" binding:"required"` + ShowNumber int32 `json:"showNumber" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type GetWorkMomentByIDReq struct { + WorkMomentID string `json:"workMomentID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type WorkMoment struct { + WorkMomentID string `json:"workMomentID"` + UserID string `json:"userID"` + Content string `json:"content"` + LikeUserList []*WorkMomentUser `json:"likeUsers"` + Comments []*Comment `json:"comments"` + FaceURL string `json:"faceURL"` + UserName string `json:"userName"` + AtUserList []*WorkMomentUser `json:"atUsers"` + PermissionUserList []*WorkMomentUser `json:"permissionUsers"` + CreateTime int32 `json:"createTime"` + Permission int32 `json:"permission"` +} + +type WorkMomentUser struct { + UserID string `json:"userID"` + UserName string `json:"userName"` +} + +type Comment struct { + UserID string `json:"userID"` + UserName string `json:"userName"` + ReplyUserID string `json:"replyUserID"` + ReplyUserName string `json:"replyUserName"` + ContentID string `json:"contentID"` + Content string `json:"content"` + CreateTime int32 `json:"createTime"` +} + +type GetWorkMomentByIDResp struct { + CommResp + Data struct { + WorkMoment *WorkMoment `json:"workMoment"` + } `json:"data"` +} + +type GetUserWorkMomentsReq struct { + WorkMomentsUserCommonReq + UserID string `json:"userID"` +} + +type GetUserWorkMomentsResp struct { + CommResp + Data struct { + WorkMoments []*WorkMoment `json:"workMoments"` + CurrentPage int32 `json:"currentPage"` + ShowNumber int32 `json:"showNumber"` + } `json:"data"` +} + +type GetUserFriendWorkMomentsReq struct { + WorkMomentsUserCommonReq +} + +type GetUserFriendWorkMomentsResp struct { + CommResp + Data struct { + WorkMoments []*WorkMoment `json:"workMoments"` + CurrentPage int32 `json:"currentPage"` + ShowNumber int32 `json:"showNumber"` + } `json:"data"` +} + +type SetUserWorkMomentsLevelReq struct { + office.SetUserWorkMomentsLevelReq +} + +type SetUserWorkMomentsLevelResp struct { + CommResp + Data struct{} `json:"data"` +} From ef475cb9d950240eb57606f1bdaad1e7941db7dc Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Wed, 1 Feb 2023 15:42:27 +0800 Subject: [PATCH 05/10] 1 --- internal/rpc/group/g.go | 58 ++++++++++++++++++------------------- internal/rpc/group/group.go | 41 ++++++++++++++++++++++++-- 2 files changed, 66 insertions(+), 33 deletions(-) diff --git a/internal/rpc/group/g.go b/internal/rpc/group/g.go index ef18feedf..f5e4b4d54 100644 --- a/internal/rpc/group/g.go +++ b/internal/rpc/group/g.go @@ -1,9 +1,7 @@ package group import ( - "Open_IM/pkg/common/constant" - relation "Open_IM/pkg/common/db/mysql" - pbGroup "Open_IM/pkg/proto/group" + "Open_IM/pkg/common/tracelog" sdk_ws "Open_IM/pkg/proto/sdk_ws" "Open_IM/pkg/utils" "context" @@ -12,32 +10,32 @@ import ( "time" ) -func getDBGroupRequest(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) (dbGroupRequest *relation.GroupRequest) { - dbGroupRequest = &relation.GroupRequest{} - utils.CopyStructFields(&dbGroupRequest, req) - dbGroupRequest.UserID = req.FromUserID - dbGroupRequest.HandleUserID = utils.OpUserID(ctx) - dbGroupRequest.HandledTime = time.Now() - return dbGroupRequest -} - -func getDBGroupMember(ctx context.Context, groupID, userID string) (dbGroupMember *relation.GroupMember, err error) { - dbGroupMember = &relation.GroupMember{} - - member := relation.GroupMember{} - member.GroupID = groupID - member.UserID = userID - member.RoleLevel = constant.GroupOrdinaryUsers - member.OperatorUserID = utils.OpUserID(ctx) - - member.FaceURL = user.FaceURL - member.Nickname = user.Nickname - member.JoinSource = request.JoinSource - member.InviterUserID = request.InviterUserID - member.MuteEndTime = time.Unix(int64(time.Now().Second()), 0) - - return dbGroupMember, nil -} +//func getDBGroupRequest(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) (dbGroupRequest *relation.GroupRequest) { +// dbGroupRequest = &relation.GroupRequest{} +// utils.CopyStructFields(&dbGroupRequest, req) +// dbGroupRequest.UserID = req.FromUserID +// dbGroupRequest.HandleUserID = utils.OpUserID(ctx) +// dbGroupRequest.HandledTime = time.Now() +// return dbGroupRequest +//} +// +//func getDBGroupMember(ctx context.Context, groupID, userID string) (dbGroupMember *relation.GroupMember, err error) { +// dbGroupMember = &relation.GroupMember{} +// +// member := relation.GroupMember{} +// member.GroupID = groupID +// member.UserID = userID +// member.RoleLevel = constant.GroupOrdinaryUsers +// member.OperatorUserID = utils.OpUserID(ctx) +// +// member.FaceURL = user.FaceURL +// member.Nickname = user.Nickname +// member.JoinSource = request.JoinSource +// member.InviterUserID = request.InviterUserID +// member.MuteEndTime = time.Unix(int64(time.Now().Second()), 0) +// +// return dbGroupMember, nil +//} func getUsersInfo(ctx context.Context, userIDs []string) ([]*sdk_ws.UserInfo, error) { return nil, nil @@ -59,7 +57,7 @@ func genGroupID(ctx context.Context, groupID string) string { if groupID != "" { return groupID } - groupID = utils.Md5(utils.OperationID(ctx) + strconv.FormatInt(time.Now().UnixNano(), 10)) + groupID = utils.Md5(tracelog.GetOperationID(ctx) + strconv.FormatInt(time.Now().UnixNano(), 10)) bi := big.NewInt(0) bi.SetString(groupID[0:8], 16) groupID = bi.String() diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 03c0b033a..9599d9465 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -526,14 +526,49 @@ func FillPublicUserInfoByUserID(operationID, userID string, userInfo *open_im_sd func (s *groupServer) GetGroupApplicationList(ctx context.Context, req *pbGroup.GetGroupApplicationListReq) (*pbGroup.GetGroupApplicationListResp, error) { resp := &pbGroup.GetGroupApplicationListResp{} - reply, err := s.GroupInterface.GetGroupRecvApplicationList(ctx, req.FromUserID) + groupRequests, err := s.GroupInterface.GetGroupRecvApplicationList(ctx, req.FromUserID) if err != nil { return nil, err } + if len(groupRequests) == 0 { + return resp, nil + } + var ( + userIDs []string + groupIDs []string + ) + for _, gr := range groupRequests { + userIDs = append(userIDs, gr.UserID) + groupIDs = append(groupIDs, gr.GroupID) + } + userMap, err := getUserMap(ctx, userIDs) + if err != nil { + return nil, err + } + for _, userID := range userIDs { + if _, ok := userMap[userID]; !ok { + return nil, constant.ErrUserIDNotFound.Wrap(userID) + } + } + groups, err := s.GroupInterface.FindGroupsByID(ctx, groupIDs) + if err != nil { + return nil, err + } + groupMap := make(map[string]*relation.Group) + for i, group := range groups { + groupMap[group.GroupID] = groups[i] + } + + for _, gr := range groupRequests { + groupRequest := open_im_sdk.GroupRequest{UserInfo: &open_im_sdk.PublicUserInfo{}, GroupInfo: &open_im_sdk.GroupInfo{}} + utils.CopyStructFields(&groupRequest, gr) + getUserMap() + + } var errResult error - tracelog.SetCtxInfo(ctx, "GetRecvGroupApplicationList", nil, " FromUserID: ", req.FromUserID, "GroupApplicationList: ", reply) - for _, v := range reply { + tracelog.SetCtxInfo(ctx, "GetRecvGroupApplicationList", nil, " FromUserID: ", req.FromUserID, "GroupApplicationList: ", groupRequests) + for _, v := range groupRequests { node := open_im_sdk.GroupRequest{UserInfo: &open_im_sdk.PublicUserInfo{}, GroupInfo: &open_im_sdk.GroupInfo{}} err := FillGroupInfoByGroupID(tracelog.GetOperationID(ctx), v.GroupID, node.GroupInfo) if err != nil { From e550c9a87489d791f38258832570a8e99e89ff97 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Wed, 1 Feb 2023 15:56:17 +0800 Subject: [PATCH 06/10] friend update --- internal/rpc/friend/friend.go | 4 +- pkg/common/db/controller/friend.go | 4 +- pkg/common/db/relation/friend_model_k.go | 51 ++++++++++++++---------- 3 files changed, 34 insertions(+), 25 deletions(-) diff --git a/internal/rpc/friend/friend.go b/internal/rpc/friend/friend.go index 2e53e5bb9..0272aa7d3 100644 --- a/internal/rpc/friend/friend.go +++ b/internal/rpc/friend/friend.go @@ -45,8 +45,8 @@ func NewFriendServer(port int) *friendServer { } //mysql init var mysql relation.Mysql - var model relation.Friend - err := mysql.InitConn().AutoMigrateModel(&model) + var model relation.FriendGorm + err := mysql.InitConn().AutoMigrateModel(&relation.FriendModel{}) if err != nil { panic("db init err:" + err.Error()) } diff --git a/pkg/common/db/controller/friend.go b/pkg/common/db/controller/friend.go index 1f5670f6a..d4c498b65 100644 --- a/pkg/common/db/controller/friend.go +++ b/pkg/common/db/controller/friend.go @@ -117,11 +117,11 @@ type FriendDatabaseInterface interface { } type FriendDatabase struct { - sqlDB *relation.Friend + sqlDB relation.FriendDB } func NewFriendDatabase(db *gorm.DB) *FriendDatabase { - sqlDB := relation.NewFriendDB(db) + sqlDB := relation.NewFriendGorm(db) database := &FriendDatabase{ sqlDB: sqlDB, } diff --git a/pkg/common/db/relation/friend_model_k.go b/pkg/common/db/relation/friend_model_k.go index d581e1d25..5355dcc9b 100644 --- a/pkg/common/db/relation/friend_model_k.go +++ b/pkg/common/db/relation/friend_model_k.go @@ -8,7 +8,16 @@ import ( "time" ) -type Friend struct { +type FriendDB interface { + Create(ctx context.Context, friends []*FriendModel) (err error) + Delete(ctx context.Context, ownerUserID string, friendUserIDs string) (err error) + UpdateByMap(ctx context.Context, ownerUserID string, args map[string]interface{}) (err error) + Update(ctx context.Context, friends []*FriendModel) (err error) + UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error) + FindOwnerUserID(ctx context.Context, ownerUserID string) (friends []*FriendModel, err error) +} + +type FriendModel struct { OwnerUserID string `gorm:"column:owner_user_id;primary_key;size:64"` FriendUserID string `gorm:"column:friend_user_id;primary_key;size:64"` Remark string `gorm:"column:remark;size:255"` @@ -16,77 +25,77 @@ type Friend struct { AddSource int32 `gorm:"column:add_source"` OperatorUserID string `gorm:"column:operator_user_id;size:64"` Ex string `gorm:"column:ex;size:1024"` - DB *gorm.DB `gorm:"-"` +} +type FriendGorm struct { + DB *gorm.DB `gorm:"-"` +} + +func NewFriendGorm(DB *gorm.DB) *FriendGorm { + return &FriendGorm{DB: DB} } type FriendUser struct { - Friend + FriendGorm Nickname string `gorm:"column:name;size:255"` } -func NewFriendDB(db *gorm.DB) *Friend { - var friend Friend - friend.DB = db - return &friend -} - -func (f *Friend) Create(ctx context.Context, friends []*Friend) (err error) { +func (f *FriendGorm) Create(ctx context.Context, friends []*FriendModel) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "friends", friends) }() return utils.Wrap(f.DB.Create(&friends).Error, "") } -func (f *Friend) Delete(ctx context.Context, ownerUserID string, friendUserIDs string) (err error) { +func (f *FriendGorm) Delete(ctx context.Context, ownerUserID string, friendUserIDs string) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserIDs", friendUserIDs) }() - err = utils.Wrap(f.DB.Where("owner_user_id = ? and friend_user_id = ?", ownerUserID, friendUserIDs).Delete(&Friend{}).Error, "") + err = utils.Wrap(f.DB.Where("owner_user_id = ? and friend_user_id = ?", ownerUserID, friendUserIDs).Delete(&FriendModel{}).Error, "") return err } -func (f *Friend) UpdateByMap(ctx context.Context, ownerUserID string, args map[string]interface{}) (err error) { +func (f *FriendGorm) UpdateByMap(ctx context.Context, ownerUserID string, args map[string]interface{}) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "args", args) }() return utils.Wrap(f.DB.Where("owner_user_id = ?", ownerUserID).Updates(args).Error, "") } -func (f *Friend) Update(ctx context.Context, friends []*Friend) (err error) { +func (f *FriendGorm) Update(ctx context.Context, friends []*FriendModel) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "friends", friends) }() return utils.Wrap(f.DB.Updates(&friends).Error, "") } -func (f *Friend) UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error) { +func (f *FriendGorm) UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "remark", remark) }() - return utils.Wrap(f.DB.Model(f).Where("owner_user_id = ? and friend_user_id = ?", ownerUserID, friendUserID).Update("remark", remark).Error, "") + return utils.Wrap(f.DB.Model(&FriendModel{}).Where("owner_user_id = ? and friend_user_id = ?", ownerUserID, friendUserID).Update("remark", remark).Error, "") } -func (f *Friend) FindOwnerUserID(ctx context.Context, ownerUserID string) (friends []*Friend, err error) { +func (f *FriendGorm) FindOwnerUserID(ctx context.Context, ownerUserID string) (friends []*FriendModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friends", friends) }() return friends, utils.Wrap(f.DB.Where("owner_user_id = ?", ownerUserID).Find(&friends).Error, "") } -func (f *Friend) FindFriendUserID(ctx context.Context, friendUserID string) (friends []*Friend, err error) { +func (f *FriendGorm) FindFriendUserID(ctx context.Context, friendUserID string) (friends []*FriendModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "friendUserID", friendUserID, "friends", friends) }() return friends, utils.Wrap(f.DB.Where("friend_user_id = ?", friendUserID).Find(&friends).Error, "") } -func (f *Friend) Take(ctx context.Context, ownerUserID, friendUserID string) (friend *Friend, err error) { - friend = &Friend{} +func (f *FriendGorm) Take(ctx context.Context, ownerUserID, friendUserID string) (friend *FriendModel, err error) { + friend = &FriendModel{} defer tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "friend", friend) return friend, utils.Wrap(f.DB.Where("owner_user_id = ? and friend_user_id", ownerUserID, friendUserID).Take(friend).Error, "") } -func (f *Friend) FindUserState(ctx context.Context, userID1, userID2 string) (friends []*Friend, err error) { +func (f *FriendGorm) FindUserState(ctx context.Context, userID1, userID2 string) (friends []*FriendModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "userID1", userID1, "userID2", userID2) }() From 80bde864c16b339e4554327f6fcf570c6e58030d Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Wed, 1 Feb 2023 16:19:44 +0800 Subject: [PATCH 07/10] friend update --- pkg/common/db/controller/friend.go | 3 +- pkg/common/db/relation/friend_model_k.go | 35 +++++++++--------------- pkg/common/db/table/table.go | 13 +++++++++ 3 files changed, 28 insertions(+), 23 deletions(-) create mode 100644 pkg/common/db/table/table.go diff --git a/pkg/common/db/controller/friend.go b/pkg/common/db/controller/friend.go index d4c498b65..47d763777 100644 --- a/pkg/common/db/controller/friend.go +++ b/pkg/common/db/controller/friend.go @@ -2,6 +2,7 @@ package controller import ( "Open_IM/pkg/common/db/relation" + "Open_IM/pkg/common/db/table" "context" "gorm.io/gorm" ) @@ -95,7 +96,7 @@ type FriendDatabaseInterface interface { // AddFriendRequest 增加或者更新好友申请 AddFriendRequest(ctx context.Context, fromUserID, toUserID string, reqMsg string, ex string) (err error) // BecomeFriend 先判断是否在好友表,如果在则不插入 - BecomeFriend(ctx context.Context, friends []*relation.Friend) (err error) + BecomeFriend(ctx context.Context, friends []*table.FriendModel) (err error) // RefuseFriendRequest 拒绝好友申请 RefuseFriendRequest(ctx context.Context, friendRequest *relation.FriendRequest) (err error) // AgreeFriendRequest 同意好友申请 diff --git a/pkg/common/db/relation/friend_model_k.go b/pkg/common/db/relation/friend_model_k.go index 5355dcc9b..7b78de93d 100644 --- a/pkg/common/db/relation/friend_model_k.go +++ b/pkg/common/db/relation/friend_model_k.go @@ -1,31 +1,22 @@ package relation import ( + "Open_IM/pkg/common/db/table" "Open_IM/pkg/common/tracelog" "Open_IM/pkg/utils" "context" "gorm.io/gorm" - "time" ) type FriendDB interface { - Create(ctx context.Context, friends []*FriendModel) (err error) + Create(ctx context.Context, friends []*table.FriendModel) (err error) Delete(ctx context.Context, ownerUserID string, friendUserIDs string) (err error) UpdateByMap(ctx context.Context, ownerUserID string, args map[string]interface{}) (err error) - Update(ctx context.Context, friends []*FriendModel) (err error) + Update(ctx context.Context, friends []*table.FriendModel) (err error) UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error) - FindOwnerUserID(ctx context.Context, ownerUserID string) (friends []*FriendModel, err error) + FindOwnerUserID(ctx context.Context, ownerUserID string) (friends []*table.FriendModel, err error) } -type FriendModel struct { - OwnerUserID string `gorm:"column:owner_user_id;primary_key;size:64"` - FriendUserID string `gorm:"column:friend_user_id;primary_key;size:64"` - Remark string `gorm:"column:remark;size:255"` - CreateTime time.Time `gorm:"column:create_time"` - AddSource int32 `gorm:"column:add_source"` - OperatorUserID string `gorm:"column:operator_user_id;size:64"` - Ex string `gorm:"column:ex;size:1024"` -} type FriendGorm struct { DB *gorm.DB `gorm:"-"` } @@ -39,7 +30,7 @@ type FriendUser struct { Nickname string `gorm:"column:name;size:255"` } -func (f *FriendGorm) Create(ctx context.Context, friends []*FriendModel) (err error) { +func (f *FriendGorm) Create(ctx context.Context, friends []*table.FriendModel) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "friends", friends) }() @@ -50,7 +41,7 @@ func (f *FriendGorm) Delete(ctx context.Context, ownerUserID string, friendUserI defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserIDs", friendUserIDs) }() - err = utils.Wrap(f.DB.Where("owner_user_id = ? and friend_user_id = ?", ownerUserID, friendUserIDs).Delete(&FriendModel{}).Error, "") + err = utils.Wrap(f.DB.Where("owner_user_id = ? and friend_user_id = ?", ownerUserID, friendUserIDs).Delete(&table.FriendModel{}).Error, "") return err } @@ -61,7 +52,7 @@ func (f *FriendGorm) UpdateByMap(ctx context.Context, ownerUserID string, args m return utils.Wrap(f.DB.Where("owner_user_id = ?", ownerUserID).Updates(args).Error, "") } -func (f *FriendGorm) Update(ctx context.Context, friends []*FriendModel) (err error) { +func (f *FriendGorm) Update(ctx context.Context, friends []*table.FriendModel) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "friends", friends) }() @@ -72,30 +63,30 @@ func (f *FriendGorm) UpdateRemark(ctx context.Context, ownerUserID, friendUserID defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "remark", remark) }() - return utils.Wrap(f.DB.Model(&FriendModel{}).Where("owner_user_id = ? and friend_user_id = ?", ownerUserID, friendUserID).Update("remark", remark).Error, "") + return utils.Wrap(f.DB.Model(&table.FriendModel{}).Where("owner_user_id = ? and friend_user_id = ?", ownerUserID, friendUserID).Update("remark", remark).Error, "") } -func (f *FriendGorm) FindOwnerUserID(ctx context.Context, ownerUserID string) (friends []*FriendModel, err error) { +func (f *FriendGorm) FindOwnerUserID(ctx context.Context, ownerUserID string) (friends []*table.FriendModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friends", friends) }() return friends, utils.Wrap(f.DB.Where("owner_user_id = ?", ownerUserID).Find(&friends).Error, "") } -func (f *FriendGorm) FindFriendUserID(ctx context.Context, friendUserID string) (friends []*FriendModel, err error) { +func (f *FriendGorm) FindFriendUserID(ctx context.Context, friendUserID string) (friends []*table.FriendModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "friendUserID", friendUserID, "friends", friends) }() return friends, utils.Wrap(f.DB.Where("friend_user_id = ?", friendUserID).Find(&friends).Error, "") } -func (f *FriendGorm) Take(ctx context.Context, ownerUserID, friendUserID string) (friend *FriendModel, err error) { - friend = &FriendModel{} +func (f *FriendGorm) Take(ctx context.Context, ownerUserID, friendUserID string) (friend *table.FriendModel, err error) { + friend = &table.FriendModel{} defer tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "friend", friend) return friend, utils.Wrap(f.DB.Where("owner_user_id = ? and friend_user_id", ownerUserID, friendUserID).Take(friend).Error, "") } -func (f *FriendGorm) FindUserState(ctx context.Context, userID1, userID2 string) (friends []*FriendModel, err error) { +func (f *FriendGorm) FindUserState(ctx context.Context, userID1, userID2 string) (friends []*table.FriendModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "userID1", userID1, "userID2", userID2) }() diff --git a/pkg/common/db/table/table.go b/pkg/common/db/table/table.go new file mode 100644 index 000000000..78b3eec49 --- /dev/null +++ b/pkg/common/db/table/table.go @@ -0,0 +1,13 @@ +package table + +import "time" + +type FriendModel struct { + OwnerUserID string `gorm:"column:owner_user_id;primary_key;size:64"` + FriendUserID string `gorm:"column:friend_user_id;primary_key;size:64"` + Remark string `gorm:"column:remark;size:255"` + CreateTime time.Time `gorm:"column:create_time"` + AddSource int32 `gorm:"column:add_source"` + OperatorUserID string `gorm:"column:operator_user_id;size:64"` + Ex string `gorm:"column:ex;size:1024"` +} From aafe17a0f36699320aabd6847d45fc23e2745ba3 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Wed, 1 Feb 2023 16:22:13 +0800 Subject: [PATCH 08/10] friend update --- pkg/common/db/table/table.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkg/common/db/table/table.go b/pkg/common/db/table/table.go index 78b3eec49..5ec125727 100644 --- a/pkg/common/db/table/table.go +++ b/pkg/common/db/table/table.go @@ -11,3 +11,21 @@ type FriendModel struct { OperatorUserID string `gorm:"column:operator_user_id;size:64"` Ex string `gorm:"column:ex;size:1024"` } +type ConversationModel struct { + OwnerUserID string `gorm:"column:owner_user_id;primary_key;type:char(128)" json:"OwnerUserID"` + ConversationID string `gorm:"column:conversation_id;primary_key;type:char(128)" json:"conversationID"` + ConversationType int32 `gorm:"column:conversation_type" json:"conversationType"` + UserID string `gorm:"column:user_id;type:char(64)" json:"userID"` + GroupID string `gorm:"column:group_id;type:char(128)" json:"groupID"` + RecvMsgOpt int32 `gorm:"column:recv_msg_opt" json:"recvMsgOpt"` + UnreadCount int32 `gorm:"column:unread_count" json:"unreadCount"` + DraftTextTime int64 `gorm:"column:draft_text_time" json:"draftTextTime"` + IsPinned bool `gorm:"column:is_pinned" json:"isPinned"` + IsPrivateChat bool `gorm:"column:is_private_chat" json:"isPrivateChat"` + BurnDuration int32 `gorm:"column:burn_duration;default:30" json:"burnDuration"` + GroupAtType int32 `gorm:"column:group_at_type" json:"groupAtType"` + IsNotInGroup bool `gorm:"column:is_not_in_group" json:"isNotInGroup"` + UpdateUnreadCountTime int64 `gorm:"column:update_unread_count_time" json:"updateUnreadCountTime"` + AttachedInfo string `gorm:"column:attached_info;type:varchar(1024)" json:"attachedInfo"` + Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"` +} From fb436e7713c81351b087cb5ad04d3efd0e64a618 Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Wed, 1 Feb 2023 16:44:50 +0800 Subject: [PATCH 09/10] Error code standardization --- internal/common/convert/convert.go | 5 +- internal/rpc/friend/friend.go | 2 +- pkg/common/db/controller/friend.go | 71 +++++----- pkg/common/db/relation/friend_model_k.go | 16 +-- .../db/relation/friend_request_model.go | 128 ++++-------------- pkg/common/db/table/table.go | 16 ++- 6 files changed, 85 insertions(+), 153 deletions(-) diff --git a/internal/common/convert/convert.go b/internal/common/convert/convert.go index e31a9c76a..84aaab1b8 100644 --- a/internal/common/convert/convert.go +++ b/internal/common/convert/convert.go @@ -2,6 +2,7 @@ package convert import ( "Open_IM/pkg/common/db/relation" + "Open_IM/pkg/common/db/table" sdk "Open_IM/pkg/proto/sdk_ws" utils "github.com/OpenIMSDK/open_utils" "time" @@ -19,10 +20,10 @@ func getNumberOfGroupMember(groupID string) (int32, error) { } type DBFriend struct { - *relation.Friend + *table.FriendModel } -func NewDBFriend(friend *relation.Friend) *DBFriend { +func NewDBFriend(friend *controller.Friend) *DBFriend { return &DBFriend{Friend: friend} } diff --git a/internal/rpc/friend/friend.go b/internal/rpc/friend/friend.go index 2f721073f..8caa41a76 100644 --- a/internal/rpc/friend/friend.go +++ b/internal/rpc/friend/friend.go @@ -171,7 +171,7 @@ func (s *friendServer) RespondFriendApply(ctx context.Context, req *pbFriend.Res if err := check.Access(ctx, req.ToUserID); err != nil { return nil, err } - friendRequest := relation.FriendRequest{FromUserID: req.FromUserID, ToUserID: req.ToUserID, HandleMsg: req.HandleMsg, HandleResult: req.HandleResult} + friendRequest := controller.FriendRequest{FromUserID: req.FromUserID, ToUserID: req.ToUserID, HandleMsg: req.HandleMsg, HandleResult: req.HandleResult} if req.HandleResult == constant.FriendResponseAgree { err := s.AgreeFriendRequest(ctx, &friendRequest) if err != nil { diff --git a/pkg/common/db/controller/friend.go b/pkg/common/db/controller/friend.go index 47d763777..13bfd16b3 100644 --- a/pkg/common/db/controller/friend.go +++ b/pkg/common/db/controller/friend.go @@ -13,25 +13,25 @@ type FriendInterface interface { // AddFriendRequest 增加或者更新好友申请 AddFriendRequest(ctx context.Context, fromUserID, toUserID string, reqMsg string, ex string) (err error) // BecomeFriend 先判断是否在好友表,如果在则不插入 - BecomeFriend(ctx context.Context, friends []*relation.Friend) (err error) + BecomeFriend(ctx context.Context, friends []*table.FriendModel) (err error) // RefuseFriendRequest 拒绝好友申请 - RefuseFriendRequest(ctx context.Context, friendRequest *relation.FriendRequest) (err error) + RefuseFriendRequest(ctx context.Context, friendRequest *table.FriendRequestModel) (err error) // AgreeFriendRequest 同意好友申请 - AgreeFriendRequest(ctx context.Context, friendRequest *relation.FriendRequest) (err error) + AgreeFriendRequest(ctx context.Context, friendRequest *table.FriendRequestModel) (err error) // Delete 删除好友 Delete(ctx context.Context, ownerUserID string, friendUserIDs string) (err error) // UpdateRemark 更新好友备注 UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error) // FindOwnerFriends 获取ownerUserID的好友列表 - FindOwnerFriends(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (friends []*relation.Friend, err error) + FindOwnerFriends(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (friends []*table.FriendModel, err error) // FindInWhoseFriends friendUserID在哪些人的好友列表中 - FindInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*relation.Friend, err error) + FindInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*table.FriendModel, err error) // FindFriendRequestFromMe 获取我发出去的好友申请 - FindFriendRequestFromMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequest, err error) + FindFriendRequestFromMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*table.FriendRequestModel, err error) // FindFriendRequestToMe 获取我收到的的好友申请 - FindFriendRequestToMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequest, err error) + FindFriendRequestToMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*table.FriendRequestModel, err error) // FindFriends 获取某人指定好友的信息 - FindFriends(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*relation.Friend, err error) + FindFriends(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*table.FriendModel, err error) } type FriendController struct { @@ -51,15 +51,15 @@ func (f *FriendController) AddFriendRequest(ctx context.Context, fromUserID, toU } // BecomeFriend 先判断是否在好友表,如果在则不插入 -func (f *FriendController) BecomeFriend(ctx context.Context, friends []*relation.Friend) (err error) { +func (f *FriendController) BecomeFriend(ctx context.Context, friends []*table.FriendModel) (err error) { } // RefuseFriendRequest 拒绝好友申请 -func (f *FriendController) RefuseFriendRequest(ctx context.Context, friendRequest *relation.FriendRequest) (err error) { +func (f *FriendController) RefuseFriendRequest(ctx context.Context, friendRequest *table.FriendRequestModel) (err error) { } // AgreeFriendRequest 同意好友申请 -func (f *FriendController) AgreeFriendRequest(ctx context.Context, friendRequest *relation.FriendRequest) (err error) { +func (f *FriendController) AgreeFriendRequest(ctx context.Context, friendRequest *table.FriendRequestModel) (err error) { } // Delete 删除好友 @@ -71,23 +71,23 @@ func (f *FriendController) UpdateRemark(ctx context.Context, ownerUserID, friend } // FindOwnerFriends 获取ownerUserID的好友列表 -func (f *FriendController) FindOwnerFriends(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (friends []*relation.Friend, err error) { +func (f *FriendController) FindOwnerFriends(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (friends []*table.FriendModel, err error) { } // FindInWhoseFriends friendUserID在哪些人的好友列表中 -func (f *FriendController) FindInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*relation.Friend, err error) { +func (f *FriendController) FindInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*table.FriendModel, err error) { } // FindFriendRequestFromMe 获取我发出去的好友申请 -func (f *FriendController) FindFriendRequestFromMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequest, err error) { +func (f *FriendController) FindFriendRequestFromMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*table.FriendRequestModel, err error) { } // FindFriendRequestToMe 获取我收到的的好友申请 -func (f *FriendController) FindFriendRequestToMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequest, err error) { +func (f *FriendController) FindFriendRequestToMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*table.FriendRequestModel, err error) { } // FindFriends 获取某人指定好友的信息 -func (f *FriendController) FindFriends(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*relation.Friend, err error) { +func (f *FriendController) FindFriends(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*table.FriendModel, err error) { } type FriendDatabaseInterface interface { @@ -98,35 +98,32 @@ type FriendDatabaseInterface interface { // BecomeFriend 先判断是否在好友表,如果在则不插入 BecomeFriend(ctx context.Context, friends []*table.FriendModel) (err error) // RefuseFriendRequest 拒绝好友申请 - RefuseFriendRequest(ctx context.Context, friendRequest *relation.FriendRequest) (err error) + RefuseFriendRequest(ctx context.Context, friendRequest *table.FriendRequestModel) (err error) // AgreeFriendRequest 同意好友申请 - AgreeFriendRequest(ctx context.Context, friendRequest *relation.FriendRequest) (err error) + AgreeFriendRequest(ctx context.Context, friendRequest *table.FriendRequestModel) (err error) // Delete 删除好友 Delete(ctx context.Context, ownerUserID string, friendUserIDs string) (err error) // UpdateRemark 更新好友备注 UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error) // FindOwnerFriends 获取ownerUserID的好友列表 - FindOwnerFriends(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (friends []*relation.Friend, err error) + FindOwnerFriends(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (friends []*table.FriendModel, err error) // FindInWhoseFriends friendUserID在哪些人的好友列表中 - FindInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*relation.Friend, err error) + FindInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*table.FriendModel, err error) // FindFriendRequestFromMe 获取我发出去的好友申请 - FindFriendRequestFromMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequest, err error) + FindFriendRequestFromMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*table.FriendRequestModel, err error) // FindFriendRequestToMe 获取我收到的的好友申请 - FindFriendRequestToMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequest, err error) + FindFriendRequestToMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*table.FriendRequestModel, err error) // FindFriends 获取某人指定好友的信息 - FindFriends(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*relation.Friend, err error) + FindFriends(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*table.FriendModel, err error) } type FriendDatabase struct { - sqlDB relation.FriendDB + friend *relation.FriendGorm + friendRequest *relation.FriendRequestGorm } func NewFriendDatabase(db *gorm.DB) *FriendDatabase { - sqlDB := relation.NewFriendGorm(db) - database := &FriendDatabase{ - sqlDB: sqlDB, - } - return database + return &FriendDatabase{friend: relation.NewFriendGorm(db), friendRequest: relation.NewFriendRequestGorm(db)} } // CheckIn 检查user2是否在user1的好友列表中(inUser1Friends==true) 检查user1是否在user2的好友列表中(inUser2Friends==true) @@ -138,15 +135,15 @@ func (f *FriendDatabase) AddFriendRequest(ctx context.Context, fromUserID, toUse } // BecomeFriend 先判断是否在好友表,如果在则不插入 -func (f *FriendDatabase) BecomeFriend(ctx context.Context, friends []*relation.Friend) (err error) { +func (f *FriendDatabase) BecomeFriend(ctx context.Context, friends []*table.FriendModel) (err error) { } // RefuseFriendRequest 拒绝好友申请 -func (f *FriendDatabase) RefuseFriendRequest(ctx context.Context, friendRequest *relation.FriendRequest) (err error) { +func (f *FriendDatabase) RefuseFriendRequest(ctx context.Context, friendRequest *table.FriendRequestModel) (err error) { } // AgreeFriendRequest 同意好友申请 -func (f *FriendDatabase) AgreeFriendRequest(ctx context.Context, friendRequest *relation.FriendRequest) (err error) { +func (f *FriendDatabase) AgreeFriendRequest(ctx context.Context, friendRequest *table.FriendRequestModel) (err error) { } // Delete 删除好友 @@ -158,21 +155,21 @@ func (f *FriendDatabase) UpdateRemark(ctx context.Context, ownerUserID, friendUs } // FindOwnerFriends 获取ownerUserID的好友列表 -func (f *FriendDatabase) FindOwnerFriends(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (friends []*relation.Friend, err error) { +func (f *FriendDatabase) FindOwnerFriends(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (friends []*table.FriendModel, err error) { } // FindInWhoseFriends friendUserID在哪些人的好友列表中 -func (f *FriendDatabase) FindInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*relation.Friend, err error) { +func (f *FriendDatabase) FindInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*table.FriendModel, err error) { } // FindFriendRequestFromMe 获取我发出去的好友申请 -func (f *FriendDatabase) FindFriendRequestFromMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequest, err error) { +func (f *FriendDatabase) FindFriendRequestFromMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*table.FriendRequestModel, err error) { } // FindFriendRequestToMe 获取我收到的的好友申请 -func (f *FriendDatabase) FindFriendRequestToMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequest, err error) { +func (f *FriendDatabase) FindFriendRequestToMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*table.FriendRequestModel, err error) { } // FindFriends 获取某人指定好友的信息 -func (f *FriendDatabase) FindFriends(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*relation.Friend, err error) { +func (f *FriendDatabase) FindFriends(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*table.FriendModel, err error) { } diff --git a/pkg/common/db/relation/friend_model_k.go b/pkg/common/db/relation/friend_model_k.go index 7b78de93d..b270fef99 100644 --- a/pkg/common/db/relation/friend_model_k.go +++ b/pkg/common/db/relation/friend_model_k.go @@ -34,14 +34,14 @@ func (f *FriendGorm) Create(ctx context.Context, friends []*table.FriendModel) ( defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "friends", friends) }() - return utils.Wrap(f.DB.Create(&friends).Error, "") + return utils.Wrap(f.DB.Model(&table.FriendModel{}).Create(&friends).Error, "") } func (f *FriendGorm) Delete(ctx context.Context, ownerUserID string, friendUserIDs string) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserIDs", friendUserIDs) }() - err = utils.Wrap(f.DB.Where("owner_user_id = ? and friend_user_id = ?", ownerUserID, friendUserIDs).Delete(&table.FriendModel{}).Error, "") + err = utils.Wrap(f.DB.Model(&table.FriendModel{}).Where("owner_user_id = ? and friend_user_id = ?", ownerUserID, friendUserIDs).Delete(&table.FriendModel{}).Error, "") return err } @@ -49,14 +49,14 @@ func (f *FriendGorm) UpdateByMap(ctx context.Context, ownerUserID string, args m defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "args", args) }() - return utils.Wrap(f.DB.Where("owner_user_id = ?", ownerUserID).Updates(args).Error, "") + return utils.Wrap(f.DB.Model(&table.FriendModel{}).Where("owner_user_id = ?", ownerUserID).Updates(args).Error, "") } func (f *FriendGorm) Update(ctx context.Context, friends []*table.FriendModel) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "friends", friends) }() - return utils.Wrap(f.DB.Updates(&friends).Error, "") + return utils.Wrap(f.DB.Model(&table.FriendModel{}).Updates(&friends).Error, "") } func (f *FriendGorm) UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error) { @@ -70,25 +70,25 @@ func (f *FriendGorm) FindOwnerUserID(ctx context.Context, ownerUserID string) (f defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friends", friends) }() - return friends, utils.Wrap(f.DB.Where("owner_user_id = ?", ownerUserID).Find(&friends).Error, "") + return friends, utils.Wrap(f.DB.Model(&table.FriendModel{}).Where("owner_user_id = ?", ownerUserID).Find(&friends).Error, "") } func (f *FriendGorm) FindFriendUserID(ctx context.Context, friendUserID string) (friends []*table.FriendModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "friendUserID", friendUserID, "friends", friends) }() - return friends, utils.Wrap(f.DB.Where("friend_user_id = ?", friendUserID).Find(&friends).Error, "") + return friends, utils.Wrap(f.DB.Model(&table.FriendModel{}).Where("friend_user_id = ?", friendUserID).Find(&friends).Error, "") } func (f *FriendGorm) Take(ctx context.Context, ownerUserID, friendUserID string) (friend *table.FriendModel, err error) { friend = &table.FriendModel{} defer tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "friend", friend) - return friend, utils.Wrap(f.DB.Where("owner_user_id = ? and friend_user_id", ownerUserID, friendUserID).Take(friend).Error, "") + return friend, utils.Wrap(f.DB.Model(&table.FriendModel{}).Where("owner_user_id = ? and friend_user_id", ownerUserID, friendUserID).Take(friend).Error, "") } func (f *FriendGorm) FindUserState(ctx context.Context, userID1, userID2 string) (friends []*table.FriendModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "userID1", userID1, "userID2", userID2) }() - return friends, utils.Wrap(f.DB.Where("(owner_user_id = ? and friend_user_id = ?) or (owner_user_id = ? and friend_user_id = ?)", userID1, userID2, userID2, userID1).Find(&friends).Error, "") + return friends, utils.Wrap(f.DB.Model(&table.FriendModel{}).Where("(owner_user_id = ? and friend_user_id = ?) or (owner_user_id = ? and friend_user_id = ?)", userID1, userID2, userID2, userID1).Find(&friends).Error, "") } diff --git a/pkg/common/db/relation/friend_request_model.go b/pkg/common/db/relation/friend_request_model.go index 954c3eac5..5adc5ef9e 100644 --- a/pkg/common/db/relation/friend_request_model.go +++ b/pkg/common/db/relation/friend_request_model.go @@ -1,156 +1,76 @@ package relation import ( + "Open_IM/pkg/common/db/table" "Open_IM/pkg/common/tracelog" "Open_IM/pkg/utils" "context" "gorm.io/gorm" - "time" ) //var FriendRequestDB *gorm.DB -type FriendRequest struct { - FromUserID string `gorm:"column:from_user_id;primary_key;size:64"` - ToUserID string `gorm:"column:to_user_id;primary_key;size:64"` - HandleResult int32 `gorm:"column:handle_result"` - ReqMsg string `gorm:"column:req_msg;size:255"` - CreateTime time.Time `gorm:"column:create_time"` - HandlerUserID string `gorm:"column:handler_user_id;size:64"` - HandleMsg string `gorm:"column:handle_msg;size:255"` - HandleTime time.Time `gorm:"column:handle_time"` - Ex string `gorm:"column:ex;size:1024"` - DB *gorm.DB `gorm:"-"` -} - -func NewFriendRequest(db *gorm.DB) *FriendRequest { - var fr FriendRequest +func NewFriendRequestGorm(db *gorm.DB) *FriendRequestGorm { + var fr FriendRequestGorm fr.DB = db return &fr } -func (f *FriendRequest) Create(ctx context.Context, friends []*FriendRequest) (err error) { +type FriendRequestGorm struct { + DB *gorm.DB `gorm:"-"` +} + +func (f *FriendRequestGorm) Create(ctx context.Context, friends []*table.FriendRequestModel) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "friends", friends) }() - return utils.Wrap(f.DB.Create(&friends).Error, "") + return utils.Wrap(f.DB.Model(&table.FriendRequestModel{}).Create(&friends).Error, "") } -func (f *FriendRequest) Delete(ctx context.Context, fromUserID, toUserID string) (err error) { +func (f *FriendRequestGorm) Delete(ctx context.Context, fromUserID, toUserID string) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "fromUserID", fromUserID, "toUserID", toUserID) }() - return utils.Wrap(f.DB.Where("from_user_id = ? and to_user_id = ?", fromUserID, toUserID).Delete(&FriendRequest{}).Error, "") + return utils.Wrap(f.DB.Model(&table.FriendRequestModel{}).Where("from_user_id = ? and to_user_id = ?", fromUserID, toUserID).Delete(&table.FriendRequestModel{}).Error, "") } -func (f *FriendRequest) UpdateByMap(ctx context.Context, ownerUserID string, args map[string]interface{}) (err error) { +func (f *FriendRequestGorm) UpdateByMap(ctx context.Context, ownerUserID string, args map[string]interface{}) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "args", args) }() - return utils.Wrap(f.DB.Where("owner_user_id = ?", ownerUserID).Updates(args).Error, "") + return utils.Wrap(f.DB.Model(&table.FriendRequestModel{}).Where("owner_user_id = ?", ownerUserID).Updates(args).Error, "") } -func (f *FriendRequest) Update(ctx context.Context, friends []*FriendRequest) (err error) { +func (f *FriendRequestGorm) Update(ctx context.Context, friends []*table.FriendRequestModel) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "friends", friends) }() - return utils.Wrap(f.DB.Updates(&friends).Error, "") + return utils.Wrap(f.DB.Model(&table.FriendRequestModel{}).Updates(&friends).Error, "") } -func (f *FriendRequest) Find(ctx context.Context, ownerUserID string) (friends []*FriendRequest, err error) { +func (f *FriendRequestGorm) Find(ctx context.Context, ownerUserID string) (friends []*table.FriendRequestModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "ownerUserID", ownerUserID, "friends", friends) }() - return friends, utils.Wrap(f.DB.Where("owner_user_id = ?", ownerUserID).Find(&friends).Error, "") + return friends, utils.Wrap(f.DB.Model(&table.FriendRequestModel{}).Where("owner_user_id = ?", ownerUserID).Find(&friends).Error, "") } -func (f *FriendRequest) Take(ctx context.Context, fromUserID, toUserID string) (friend *FriendRequest, err error) { - friend = &FriendRequest{} +func (f *FriendRequestGorm) Take(ctx context.Context, fromUserID, toUserID string) (friend *table.FriendRequestModel, err error) { + friend = &table.FriendRequestModel{} defer tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "fromUserID", fromUserID, "toUserID", toUserID, "friend", friend) - return friend, utils.Wrap(f.DB.Where("from_user_id = ? and to_user_id", fromUserID, toUserID).Take(friend).Error, "") + return friend, utils.Wrap(f.DB.Model(&table.FriendRequestModel{}).Where("from_user_id = ? and to_user_id", fromUserID, toUserID).Take(friend).Error, "") } -func (f *FriendRequest) FindToUserID(ctx context.Context, toUserID string) (friends []*FriendRequest, err error) { +func (f *FriendRequestGorm) FindToUserID(ctx context.Context, toUserID string) (friends []*table.FriendRequestModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "toUserID", toUserID, "friends", friends) }() - return friends, utils.Wrap(f.DB.Where("to_user_id = ?", toUserID).Find(&friends).Error, "") + return friends, utils.Wrap(f.DB.Model(&table.FriendRequestModel{}).Where("to_user_id = ?", toUserID).Find(&friends).Error, "") } -func (f *FriendRequest) FindFromUserID(ctx context.Context, fromUserID string) (friends []*FriendRequest, err error) { +func (f *FriendRequestGorm) FindFromUserID(ctx context.Context, fromUserID string) (friends []*table.FriendRequestModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetSelfFuncName(), err, "fromUserID", fromUserID, "friends", friends) }() - return friends, utils.Wrap(f.DB.Where("from_user_id = ?", fromUserID).Find(&friends).Error, "") -} - -// who apply to add me -func GetReceivedFriendsApplicationListByUserID(ToUserID string) ([]FriendRequest, error) { - var usersInfo []FriendRequest - err := FriendRequestDB.Table("friend_requests").Where("to_user_id=?", ToUserID).Find(&usersInfo).Error - if err != nil { - return nil, err - } - return usersInfo, nil -} - -// I apply to add somebody -func GetSendFriendApplicationListByUserID(FromUserID string) ([]FriendRequest, error) { - var usersInfo []FriendRequest - err := FriendRequestDB.Table("friend_requests").Where("from_user_id=?", FromUserID).Find(&usersInfo).Error - if err != nil { - return nil, err - } - return usersInfo, nil -} - -// FromUserId apply to add ToUserID -func GetFriendApplicationByBothUserID(FromUserID, ToUserID string) (*FriendRequest, error) { - var friendRequest FriendRequest - err := FriendRequestDB.Table("friend_requests").Where("from_user_id=? and to_user_id=?", FromUserID, ToUserID).Take(&friendRequest).Error - if err != nil { - return nil, err - } - return &friendRequest, nil -} - -func UpdateFriendApplication(friendRequest *FriendRequest) error { - friendRequest.CreateTime = time.Now() - return FriendRequestDB.Table("friend_requests").Where("from_user_id=? and to_user_id=?", - friendRequest.FromUserID, friendRequest.ToUserID).Updates(&friendRequest).Error -} - -func InsertFriendApplication(friendRequest *FriendRequest, args map[string]interface{}) error { - if err := FriendRequestDB.Table("friend_requests").Create(friendRequest).Error; err == nil { - return nil - } - - //t := dbConn.Debug().Table("friend_requests").Where("from_user_id = ? and to_user_id = ?", friendRequest.FromUserID, friendRequest.ToUserID).Select("*").Updates(*friendRequest) - //if t.RowsAffected == 0 { - // return utils.Wrap(errors.New("RowsAffected == 0"), "no update") - //} - //return utils.Wrap(t.Error, "") - - friendRequest.CreateTime = time.Now() - args["create_time"] = friendRequest.CreateTime - u := FriendRequestDB.Model(friendRequest).Updates(args) - //u := dbConn.Table("friend_requests").Where("from_user_id=? and to_user_id=?", - // friendRequest.FromUserID, friendRequest.ToUserID).Update(&friendRequest) - //u := dbConn.Table("friend_requests").Where("from_user_id=? and to_user_id=?", - // friendRequest.FromUserID, friendRequest.ToUserID).Update(&friendRequest) - if u.RowsAffected != 0 { - return nil - } - - if friendRequest.CreateTime.Unix() < 0 { - friendRequest.CreateTime = time.Now() - } - if friendRequest.HandleTime.Unix() < 0 { - friendRequest.HandleTime = utils.UnixSecondToTime(0) - } - err := FriendRequestDB.Table("friend_requests").Create(friendRequest).Error - if err != nil { - return err - } - return nil + return friends, utils.Wrap(f.DB.Model(&table.FriendRequestModel{}).Where("from_user_id = ?", fromUserID).Find(&friends).Error, "") } diff --git a/pkg/common/db/table/table.go b/pkg/common/db/table/table.go index 5ec125727..50a3bc60a 100644 --- a/pkg/common/db/table/table.go +++ b/pkg/common/db/table/table.go @@ -1,6 +1,8 @@ package table -import "time" +import ( + "time" +) type FriendModel struct { OwnerUserID string `gorm:"column:owner_user_id;primary_key;size:64"` @@ -29,3 +31,15 @@ type ConversationModel struct { AttachedInfo string `gorm:"column:attached_info;type:varchar(1024)" json:"attachedInfo"` Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"` } + +type FriendRequestModel struct { + FromUserID string `gorm:"column:from_user_id;primary_key;size:64"` + ToUserID string `gorm:"column:to_user_id;primary_key;size:64"` + HandleResult int32 `gorm:"column:handle_result"` + ReqMsg string `gorm:"column:req_msg;size:255"` + CreateTime time.Time `gorm:"column:create_time"` + HandlerUserID string `gorm:"column:handler_user_id;size:64"` + HandleMsg string `gorm:"column:handle_msg;size:255"` + HandleTime time.Time `gorm:"column:handle_time"` + Ex string `gorm:"column:ex;size:1024"` +} From 0f3691893e7eb9cf4cfa3c43388405633c3dcf29 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Wed, 1 Feb 2023 17:07:56 +0800 Subject: [PATCH 10/10] 1 --- internal/rpc/group/group.go | 11 +- pkg/common/db/cache/group.go | 14 +- pkg/common/db/cache/rockscache.go | 9 +- pkg/common/db/controller/group.go | 71 +-- .../db/relation/group_member_model_k.go | 466 +++++++++--------- pkg/common/db/relation/group_model_k.go | 43 +- .../db/relation/group_request_model_k.go | 53 +- pkg/common/db/table/table.go | 50 +- 8 files changed, 357 insertions(+), 360 deletions(-) diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 9599d9465..d3f8eebe5 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -8,6 +8,7 @@ import ( "Open_IM/pkg/common/db/cache" "Open_IM/pkg/common/db/controller" "Open_IM/pkg/common/db/relation" + "Open_IM/pkg/common/db/table" "Open_IM/pkg/common/db/unrelation" "Open_IM/pkg/common/log" "Open_IM/pkg/common/middleware" @@ -54,7 +55,7 @@ func NewGroupServer(port int) *groupServer { //mysql init var mysql relation.Mysql var mongo unrelation.Mongo - var groupModel relation.Group + var groupModel table.GroupModel var redis cache.RedisClient err := mysql.InitConn().AutoMigrateModel(&groupModel) if err != nil { @@ -170,7 +171,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR if err := callbackBeforeCreateGroup(ctx, req); err != nil { return nil, err } - var group relation.Group + var group relation.GroupGorm var groupMembers []*relation.GroupMember utils.CopyStructFields(&group, req.GroupInfo) group.GroupID = genGroupID(ctx, req.GroupInfo.GroupID) @@ -203,7 +204,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR } } } - if err := s.GroupInterface.CreateGroup(ctx, []*relation.Group{&group}, groupMembers); err != nil { + if err := s.GroupInterface.CreateGroup(ctx, []*relation.GroupGorm{&group}, groupMembers); err != nil { return nil, err } utils.CopyStructFields(resp.GroupInfo, group) @@ -554,7 +555,7 @@ func (s *groupServer) GetGroupApplicationList(ctx context.Context, req *pbGroup. if err != nil { return nil, err } - groupMap := make(map[string]*relation.Group) + groupMap := make(map[string]*relation.GroupGorm) for i, group := range groups { groupMap[group.GroupID] = groups[i] } @@ -851,7 +852,7 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf } } //only administrators can set group information - var groupInfo relation.Group + var groupInfo relation.GroupGorm utils.CopyStructFields(&groupInfo, req.GroupInfoForSet) if req.GroupInfoForSet.Notification != "" { groupInfo.NotificationUserID = tracelog.GetOpUserID(ctx) diff --git a/pkg/common/db/cache/group.go b/pkg/common/db/cache/group.go index 50563ca88..b2f5c639b 100644 --- a/pkg/common/db/cache/group.go +++ b/pkg/common/db/cache/group.go @@ -29,9 +29,9 @@ const ( ) type GroupCache struct { - group *relation.Group - groupMember *relation.GroupMember - groupRequest *relation.GroupRequest + group *relation.GroupGorm + groupMember *relation.GroupMemberGorm + groupRequest *relation.GroupRequestGorm mongoDB *unrelation.SuperGroupMgoDB expireTime time.Duration redisClient *RedisClient @@ -47,7 +47,7 @@ type GroupMemberIDsHash struct { UserIDs []string } -func NewGroupCache(rdb redis.UniversalClient, groupDB *relation.Group, groupMemberDB *relation.GroupMember, groupRequestDB *relation.GroupRequest, mongoClient *unrelation.SuperGroupMgoDB, opts rockscache.Options) *GroupCache { +func NewGroupCache(rdb redis.UniversalClient, groupDB *relation.GroupGorm, groupMemberDB *relation.GroupMemberGorm, groupRequestDB *relation.GroupRequestGorm, mongoClient *unrelation.SuperGroupMgoDB, opts rockscache.Options) *GroupCache { return &GroupCache{rcClient: rockscache.NewClient(rdb, opts), expireTime: groupExpireTime, group: groupDB, groupMember: groupMemberDB, groupRequest: groupRequestDB, redisClient: NewRedisClient(rdb), mongoDB: mongoClient, cacheGroupMemberUserIDs: make(map[string]*GroupMemberIDsHash, 0), @@ -86,7 +86,7 @@ func (g *GroupCache) getGroupMemberNumKey(groupID string) string { return groupMemberNumKey + groupID } -/// groupInfo +// / groupInfo func (g *GroupCache) GetGroupsInfo(ctx context.Context, groupIDs []string) (groups []*relation.Group, err error) { for _, groupID := range groupIDs { group, err := g.GetGroupInfo(ctx, groupID) @@ -98,7 +98,7 @@ func (g *GroupCache) GetGroupsInfo(ctx context.Context, groupIDs []string) (grou return groups, nil } -func (g *GroupCache) GetGroupInfo(ctx context.Context, groupID string) (group *relation.Group, err error) { +func (g *GroupCache) GetGroupInfo(ctx context.Context, groupID string) (group *relation.GroupGorm, err error) { getGroup := func() (string, error) { groupInfo, err := g.group.Take(ctx, groupID) if err != nil { @@ -110,7 +110,7 @@ func (g *GroupCache) GetGroupInfo(ctx context.Context, groupID string) (group *r } return string(bytes), nil } - group = &relation.Group{} + group = &relation.GroupGorm{} defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "group", *group) }() diff --git a/pkg/common/db/cache/rockscache.go b/pkg/common/db/cache/rockscache.go index e17ea7c81..247c6b194 100644 --- a/pkg/common/db/cache/rockscache.go +++ b/pkg/common/db/cache/rockscache.go @@ -2,17 +2,12 @@ package cache import ( "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/db/mongo" - "Open_IM/pkg/common/db/mysql" "Open_IM/pkg/common/db/relation" "Open_IM/pkg/common/log" "Open_IM/pkg/common/tracelog" "Open_IM/pkg/utils" "context" "encoding/json" - "github.com/dtm-labs/rockscache" - "github.com/go-redis/redis/v8" - "gorm.io/gorm" "math/big" "sort" "strconv" @@ -358,7 +353,7 @@ func DelAllGroupMembersInfoFromCache(ctx context.Context, groupID string) (err e return db.DB.Rc.TagAsDeleted(groupAllMemberInfoCache + groupID) } -//func GetGroupInfoFromCache(ctx context.Context, groupID string) (groupInfo *mysql.Group, err error) { +//func GetGroupInfoFromCache(ctx context.Context, groupID string) (groupInfo *mysql.GroupGorm, err error) { // getGroupInfo := func() (string, error) { // groupInfo, err := mysql.GetGroupInfoByGroupID(groupID) // if err != nil { @@ -370,7 +365,7 @@ func DelAllGroupMembersInfoFromCache(ctx context.Context, groupID string) (err e // } // return string(bytes), nil // } -// groupInfo = &mysql.Group{} +// groupInfo = &mysql.GroupGorm{} // defer func() { // tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "groupInfo", groupInfo) // }() diff --git a/pkg/common/db/controller/group.go b/pkg/common/db/controller/group.go index bbcef5a2d..1f0ebd68d 100644 --- a/pkg/common/db/controller/group.go +++ b/pkg/common/db/controller/group.go @@ -3,6 +3,7 @@ package controller import ( "Open_IM/pkg/common/db/cache" "Open_IM/pkg/common/db/relation" + "Open_IM/pkg/common/db/table" "Open_IM/pkg/common/db/unrelation" "context" "github.com/dtm-labs/rockscache" @@ -13,23 +14,23 @@ import ( ) type GroupInterface interface { - FindGroupsByID(ctx context.Context, groupIDs []string) (groups []*relation.Group, err error) - CreateGroup(ctx context.Context, groups []*relation.Group, groupMember []*relation.GroupMember) error + FindGroupsByID(ctx context.Context, groupIDs []string) (groups []*table.GroupModel, err error) + CreateGroup(ctx context.Context, groups []*table.GroupModel, groupMember []*table.GroupModel) error DeleteGroupByIDs(ctx context.Context, groupIDs []string) error - TakeGroupByID(ctx context.Context, groupID string) (group *relation.Group, err error) - TakeGroupMemberByID(ctx context.Context, groupID string, userID string) (groupMember *relation.GroupMember, err error) - GetJoinedGroupList(ctx context.Context, userID string) ([]*relation.Group, error) - GetGroupMemberList(ctx context.Context, groupID string) ([]*relation.GroupMember, error) - GetGroupMemberListByUserID(ctx context.Context, groupID string, userIDs []string) ([]*relation.GroupMember, error) - GetGroupMemberFilterList(ctx context.Context, groupID string, filter int32, begin int32, maxNumber int32) ([]*relation.GroupMember, error) // relation.GetGroupMemberByGroupID(req.GroupID, req.Filter, req.NextSeq, 30) - FindGroupMembersByID(ctx context.Context, groupID string, userIDs []string) (groups []*relation.GroupMember, err error) + TakeGroupByID(ctx context.Context, groupID string) (group *table.GroupModel, err error) + TakeGroupMemberByID(ctx context.Context, groupID string, userID string) (groupMember *table.GroupModel, err error) + GetJoinedGroupList(ctx context.Context, userID string) ([]*table.GroupModel, error) + GetGroupMemberList(ctx context.Context, groupID string) ([]*table.GroupModel, error) + GetGroupMemberListByUserID(ctx context.Context, groupID string, userIDs []string) ([]*table.GroupModel, error) + GetGroupMemberFilterList(ctx context.Context, groupID string, filter int32, begin int32, maxNumber int32) ([]*table.GroupModel, error) // relation.GetGroupMemberByGroupID(req.GroupID, req.Filter, req.NextSeq, 30) + FindGroupMembersByID(ctx context.Context, groupID string, userIDs []string) (groups []*table.GroupModel, err error) DelGroupMember(ctx context.Context, groupID string, userIDs []string) error GetGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]int, error) GetGroupOwnerUserID(ctx context.Context, groupIDs []string) (map[string]string, error) - GetGroupRecvApplicationList(ctx context.Context, userID string) ([]*relation.GroupRequest, error) + GetGroupRecvApplicationList(ctx context.Context, userID string) ([]*table.GroupRequestModel, error) - CreateGroupMember(ctx context.Context, groupMember []*relation.GroupMember) error - CreateGroupRequest(ctx context.Context, requests []*relation.GroupRequest) error + CreateGroupMember(ctx context.Context, groupMember []*table.GroupModel) error + CreateGroupRequest(ctx context.Context, requests []*table.GroupRequestModel) error //mongo CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error @@ -44,12 +45,12 @@ type GroupController struct { database GroupDataBaseInterface } -func (g *GroupController) TakeGroupMemberByID(ctx context.Context, groupID string, userID string) (groupMember *relation.GroupMember, err error) { +func (g *GroupController) TakeGroupMemberByID(ctx context.Context, groupID string, userID string) (groupMember *table.GroupModel, err error) { //TODO implement me panic("implement me") } -func (g *GroupController) FindGroupMembersByID(ctx context.Context, groupID string, userIDs []string) (groups []*relation.GroupMember, err error) { +func (g *GroupController) FindGroupMembersByID(ctx context.Context, groupID string, userIDs []string) (groups []*table.GroupModel, err error) { //TODO implement me panic("implement me") } @@ -59,7 +60,7 @@ func (g *GroupController) DelGroupMember(ctx context.Context, groupID string, us panic("implement me") } -func (g *GroupController) GetGroupRecvApplicationList(ctx context.Context, userID string) ([]*relation.GroupRequest, error) { +func (g *GroupController) GetGroupRecvApplicationList(ctx context.Context, userID string) ([]*table.GroupRequestModel, error) { /* var groupRequestList []db.GroupRequest memberList, err := GetGroupMemberListByUserID(userID) @@ -89,22 +90,22 @@ func (g *GroupController) DelSuperGroupMember(ctx context.Context, groupID strin panic("implement me") } -func (g *GroupController) GetJoinedGroupList(ctx context.Context, userID string) ([]*relation.Group, error) { +func (g *GroupController) GetJoinedGroupList(ctx context.Context, userID string) ([]*table.GroupModel, error) { //TODO implement me panic("implement me") } -func (g *GroupController) GetGroupMemberList(ctx context.Context, groupID string) ([]*relation.GroupMember, error) { +func (g *GroupController) GetGroupMemberList(ctx context.Context, groupID string) ([]*table.GroupModel, error) { //TODO implement me panic("implement me") } -func (g *GroupController) GetGroupMemberListByUserID(ctx context.Context, groupID string, userIDs []string) ([]*relation.GroupMember, error) { +func (g *GroupController) GetGroupMemberListByUserID(ctx context.Context, groupID string, userIDs []string) ([]*table.GroupModel, error) { //TODO implement me panic("implement me") } -func (g *GroupController) GetGroupMemberFilterList(ctx context.Context, groupID string, filter int32, begin int32, maxNumber int32) ([]*relation.GroupMember, error) { +func (g *GroupController) GetGroupMemberFilterList(ctx context.Context, groupID string, filter int32, begin int32, maxNumber int32) ([]*table.GroupModel, error) { //TODO implement me panic("implement me") } @@ -119,12 +120,12 @@ func (g *GroupController) GetGroupOwnerUserID(ctx context.Context, groupIDs []st panic("implement me") } -func (g *GroupController) CreateGroupMember(ctx context.Context, groupMember []*relation.GroupMember) error { +func (g *GroupController) CreateGroupMember(ctx context.Context, groupMember []*table.GroupModel) error { //TODO implement me panic("implement me") } -func (g *GroupController) CreateGroupRequest(ctx context.Context, requests []*relation.GroupRequest) error { +func (g *GroupController) CreateGroupRequest(ctx context.Context, requests []*table.GroupRequestModel) error { //TODO implement me panic("implement me") } @@ -139,11 +140,11 @@ func NewGroupController(db *gorm.DB, rdb redis.UniversalClient, mgoClient *mongo return groupController } -func (g *GroupController) FindGroupsByID(ctx context.Context, groupIDs []string) (groups []*relation.Group, err error) { +func (g *GroupController) FindGroupsByID(ctx context.Context, groupIDs []string) (groups []*table.GroupModel, err error) { return g.database.FindGroupsByID(ctx, groupIDs) } -func (g *GroupController) CreateGroup(ctx context.Context, groups []*relation.Group, groupMember []*relation.GroupMember) error { +func (g *GroupController) CreateGroup(ctx context.Context, groups []*table.GroupModel, groupMember []*table.GroupModel) error { return g.database.CreateGroup(ctx, groups, groupMember) } @@ -151,7 +152,7 @@ func (g *GroupController) DeleteGroupByIDs(ctx context.Context, groupIDs []strin return g.database.DeleteGroupByIDs(ctx, groupIDs) } -func (g *GroupController) TakeGroupByID(ctx context.Context, groupID string) (group *relation.Group, err error) { +func (g *GroupController) TakeGroupByID(ctx context.Context, groupID string) (group *table.GroupModel, err error) { return g.database.TakeGroupByID(ctx, groupID) } @@ -164,18 +165,18 @@ func (g *GroupController) CreateSuperGroup(ctx context.Context, groupID string, } type GroupDataBaseInterface interface { - FindGroupsByID(ctx context.Context, groupIDs []string) (groups []*relation.Group, err error) - CreateGroup(ctx context.Context, groups []*relation.Group, groupMember []*relation.GroupMember) error + FindGroupsByID(ctx context.Context, groupIDs []string) (groups []*table.GroupModel, err error) + CreateGroup(ctx context.Context, groups []*table.GroupModel, groupMember []*table.GroupModel) error DeleteGroupByIDs(ctx context.Context, groupIDs []string) error - TakeGroupByID(ctx context.Context, groupID string) (group *relation.Group, err error) + TakeGroupByID(ctx context.Context, groupID string) (group *table.GroupModel, err error) GetSuperGroupByID(ctx context.Context, groupID string) (superGroup *unrelation.SuperGroup, err error) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error } type GroupDataBase struct { - groupDB *relation.Group - groupMemberDB *relation.GroupMember - groupRequestDB *relation.GroupRequest + groupDB *relation.GroupGorm + groupMemberDB *relation.GroupMemberGorm + groupRequestDB *relation.GroupRequestGorm db *gorm.DB cache *cache.GroupCache @@ -204,11 +205,11 @@ func newGroupDatabase(db *gorm.DB, rdb redis.UniversalClient, mgoClient *mongo.C return database } -func (g *GroupDataBase) FindGroupsByID(ctx context.Context, groupIDs []string) (groups []*relation.Group, err error) { +func (g *GroupDataBase) FindGroupsByID(ctx context.Context, groupIDs []string) (groups []*table.GroupModel, err error) { return g.cache.GetGroupsInfo(ctx, groupIDs) } -func (g *GroupDataBase) CreateGroup(ctx context.Context, groups []*relation.Group, groupMembers []*relation.GroupMember) error { +func (g *GroupDataBase) CreateGroup(ctx context.Context, groups []*table.GroupModel, groupMembers []*table.GroupMemberModel) error { return g.db.Transaction(func(tx *gorm.DB) error { if len(groups) > 0 { if err := g.groupDB.Create(ctx, groups, tx); err != nil { @@ -236,11 +237,11 @@ func (g *GroupDataBase) DeleteGroupByIDs(ctx context.Context, groupIDs []string) }) } -func (g *GroupDataBase) TakeGroupByID(ctx context.Context, groupID string) (group *relation.Group, err error) { +func (g *GroupDataBase) TakeGroupByID(ctx context.Context, groupID string) (group *table.GroupModel, err error) { return g.cache.GetGroupInfo(ctx, groupID) } -func (g *GroupDataBase) Update(ctx context.Context, groups []*relation.Group) error { +func (g *GroupDataBase) Update(ctx context.Context, groups []*table.GroupModel) error { return g.db.Transaction(func(tx *gorm.DB) error { if err := g.groupDB.Update(ctx, groups, tx); err != nil { return err @@ -256,7 +257,7 @@ func (g *GroupDataBase) Update(ctx context.Context, groups []*relation.Group) er }) } -func (g *GroupDataBase) GetJoinedGroupList(ctx context.Context, userID string) ([]*relation.Group, error) { +func (g *GroupDataBase) GetJoinedGroupList(ctx context.Context, userID string) ([]*table.GroupModel, error) { return nil, nil } diff --git a/pkg/common/db/relation/group_member_model_k.go b/pkg/common/db/relation/group_member_model_k.go index c02474eea..5f7bd33b3 100644 --- a/pkg/common/db/relation/group_member_model_k.go +++ b/pkg/common/db/relation/group_member_model_k.go @@ -2,62 +2,48 @@ package relation import ( "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db/table" "Open_IM/pkg/common/tracelog" "Open_IM/pkg/utils" "context" - "fmt" "gorm.io/gorm" - "time" ) -var GroupMemberDB *gorm.DB - -type GroupMember struct { - GroupID string `gorm:"column:group_id;primary_key;size:64"` - UserID string `gorm:"column:user_id;primary_key;size:64"` - Nickname string `gorm:"column:nickname;size:255"` - FaceURL string `gorm:"column:user_group_face_url;size:255"` - RoleLevel int32 `gorm:"column:role_level"` - JoinTime time.Time `gorm:"column:join_time"` - JoinSource int32 `gorm:"column:join_source"` - InviterUserID string `gorm:"column:inviter_user_id;size:64"` - OperatorUserID string `gorm:"column:operator_user_id;size:64"` - MuteEndTime time.Time `gorm:"column:mute_end_time"` - Ex string `gorm:"column:ex;size:1024"` - DB *gorm.DB `gorm:"-" json:"-"` +type GroupMemberGorm struct { + DB *gorm.DB } -func NewGroupMemberDB(db *gorm.DB) *GroupMember { - return &GroupMember{DB: db} +func NewGroupMemberDB(db *gorm.DB) *GroupMemberGorm { + return &GroupMemberGorm{DB: db} } -func (g *GroupMember) Create(ctx context.Context, groupMemberList []*GroupMember, tx ...*gorm.DB) (err error) { +func (g *GroupMemberGorm) Create(ctx context.Context, groupMemberList []*table.GroupMemberModel, tx ...*gorm.DB) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupMemberList", groupMemberList) }() return utils.Wrap(getDBConn(g.DB, tx).Create(&groupMemberList).Error, "") } -func (g *GroupMember) Delete(ctx context.Context, groupMembers []*GroupMember, tx ...*gorm.DB) (err error) { +func (g *GroupMemberGorm) Delete(ctx context.Context, groupMembers []*table.GroupMemberModel, tx ...*gorm.DB) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupMembers", groupMembers) }() return utils.Wrap(getDBConn(g.DB, tx).Delete(groupMembers).Error, "") } -func (g *GroupMember) UpdateByMap(ctx context.Context, groupID string, userID string, args map[string]interface{}, tx ...*gorm.DB) (err error) { +func (g *GroupMemberGorm) UpdateByMap(ctx context.Context, groupID string, userID string, args map[string]interface{}, tx ...*gorm.DB) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "args", args) }() - return utils.Wrap(getDBConn(g.DB, tx).Model(&GroupMember{}).Where("group_id = ? and user_id = ?", groupID, userID).Updates(args).Error, "") + return utils.Wrap(getDBConn(g.DB, tx).Model(&table.GroupMemberModel{}).Where("group_id = ? and user_id = ?", groupID, userID).Updates(args).Error, "") } -func (g *GroupMember) Update(ctx context.Context, groupMembers []*GroupMember, tx ...*gorm.DB) (err error) { +func (g *GroupMemberGorm) Update(ctx context.Context, groupMembers []*table.GroupMemberModel, tx ...*gorm.DB) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupMembers", groupMembers) }() return utils.Wrap(getDBConn(g.DB, tx).Updates(&groupMembers).Error, "") } -func (g *GroupMember) Find(ctx context.Context, groupMembers []*GroupMember, tx ...*gorm.DB) (groupList []*GroupMember, err error) { +func (g *GroupMemberGorm) Find(ctx context.Context, groupMembers []*table.GroupMemberModel, tx ...*gorm.DB) (groupList []*table.GroupMemberModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupMembers", groupMembers, "groupList", groupList) }() @@ -68,230 +54,230 @@ func (g *GroupMember) Find(ctx context.Context, groupMembers []*GroupMember, tx return groupList, utils.Wrap(getDBConn(g.DB, tx).Where("(group_id, user_id) in ?", where).Find(&groupList).Error, "") } -func (g *GroupMember) Take(ctx context.Context, groupID string, userID string, tx ...*gorm.DB) (groupMember *GroupMember, err error) { +func (g *GroupMemberGorm) Take(ctx context.Context, groupID string, userID string, tx ...*gorm.DB) (groupMember *table.GroupMemberModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "groupMember", *groupMember) }() - groupMember = &GroupMember{} + groupMember = &table.GroupMemberModel{} return groupMember, utils.Wrap(getDBConn(g.DB, tx).Where("group_id = ? and user_id = ?", groupID, userID).Take(groupMember).Error, "") } -func (g *GroupMember) TakeOwnerInfo(ctx context.Context, groupID string, tx ...*gorm.DB) (groupMember *GroupMember, err error) { +func (g *GroupMemberGorm) TakeOwnerInfo(ctx context.Context, groupID string, tx ...*gorm.DB) (groupMember *table.GroupMemberModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "groupMember", *groupMember) }() - groupMember = &GroupMember{} + groupMember = &table.GroupMemberModel{} return groupMember, utils.Wrap(getDBConn(g.DB, tx).Where("group_id = ? and role_level = ?", groupID, constant.GroupOwner).Take(groupMember).Error, "") } -func InsertIntoGroupMember(toInsertInfo GroupMember) error { - toInsertInfo.JoinTime = time.Now() - if toInsertInfo.RoleLevel == 0 { - toInsertInfo.RoleLevel = constant.GroupOrdinaryUsers - } - toInsertInfo.MuteEndTime = time.Unix(int64(time.Now().Second()), 0) - err := GroupMemberDB.Table("group_members").Create(toInsertInfo).Error - if err != nil { - return err - } - return nil -} - -func BatchInsertIntoGroupMember(toInsertInfoList []*GroupMember) error { - for _, toInsertInfo := range toInsertInfoList { - toInsertInfo.JoinTime = time.Now() - if toInsertInfo.RoleLevel == 0 { - toInsertInfo.RoleLevel = constant.GroupOrdinaryUsers - } - toInsertInfo.MuteEndTime = time.Unix(int64(time.Now().Second()), 0) - } - return GroupMemberDB.Create(toInsertInfoList).Error - -} - -func GetGroupMemberListByUserID(userID string) ([]GroupMember, error) { - var groupMemberList []GroupMember - err := GroupMemberDB.Table("group_members").Where("user_id=?", userID).Find(&groupMemberList).Error - if err != nil { - return nil, err - } - return groupMemberList, nil -} - -func GetGroupMemberListByGroupID(groupID string) ([]GroupMember, error) { - var groupMemberList []GroupMember - err := GroupMemberDB.Table("group_members").Where("group_id=?", groupID).Find(&groupMemberList).Error - if err != nil { - return nil, err - } - return groupMemberList, nil -} - -func GetGroupMemberIDListByGroupID(groupID string) ([]string, error) { - var groupMemberIDList []string - err := GroupMemberDB.Table("group_members").Where("group_id=?", groupID).Pluck("user_id", &groupMemberIDList).Error - if err != nil { - return nil, err - } - return groupMemberIDList, nil -} - -func GetGroupMemberListByGroupIDAndRoleLevel(groupID string, roleLevel int32) ([]GroupMember, error) { - var groupMemberList []GroupMember - err := GroupMemberDB.Table("group_members").Where("group_id=? and role_level=?", groupID, roleLevel).Find(&groupMemberList).Error - if err != nil { - return nil, err - } - return groupMemberList, nil -} - -func GetGroupMemberInfoByGroupIDAndUserID(groupID, userID string) (*GroupMember, error) { - var groupMember GroupMember - err := GroupMemberDB.Table("group_members").Where("group_id=? and user_id=? ", groupID, userID).Limit(1).Take(&groupMember).Error - if err != nil { - return nil, err - } - return &groupMember, nil -} - -func DeleteGroupMemberByGroupIDAndUserID(groupID, userID string) error { - return GroupMemberDB.Table("group_members").Where("group_id=? and user_id=? ", groupID, userID).Delete(GroupMember{}).Error -} - -func DeleteGroupMemberByGroupID(groupID string) error { - return GroupMemberDB.Table("group_members").Where("group_id=? ", groupID).Delete(GroupMember{}).Error -} - -func UpdateGroupMemberInfo(groupMemberInfo GroupMember) error { - return GroupMemberDB.Table("group_members").Where("group_id=? and user_id=?", groupMemberInfo.GroupID, groupMemberInfo.UserID).Updates(&groupMemberInfo).Error -} - -func UpdateGroupMemberInfoByMap(groupMemberInfo GroupMember, m map[string]interface{}) error { - return GroupMemberDB.Table("group_members").Where("group_id=? and user_id=?", groupMemberInfo.GroupID, groupMemberInfo.UserID).Updates(m).Error -} - -func GetOwnerManagerByGroupID(groupID string) ([]GroupMember, error) { - var groupMemberList []GroupMember - err := GroupMemberDB.Table("group_members").Where("group_id=? and role_level>?", groupID, constant.GroupOrdinaryUsers).Find(&groupMemberList).Error - if err != nil { - return nil, err - } - return groupMemberList, nil -} - -func GetGroupMemberNumByGroupID(groupID string) (int64, error) { - var number int64 - err := GroupMemberDB.Table("group_members").Where("group_id=?", groupID).Count(&number).Error - if err != nil { - return 0, utils.Wrap(err, "") - } - return number, nil -} - -func GetGroupOwnerInfoByGroupID(groupID string) (*GroupMember, error) { - omList, err := GetOwnerManagerByGroupID(groupID) - if err != nil { - return nil, err - } - for _, v := range omList { - if v.RoleLevel == constant.GroupOwner { - return &v, nil - } - } - return nil, utils.Wrap(constant.ErrGroupNoOwner, "") -} - -func IsExistGroupMember(groupID, userID string) bool { - var number int64 - err := GroupMemberDB.Table("group_members").Where("group_id = ? and user_id = ?", groupID, userID).Count(&number).Error - if err != nil { - return false - } - if number != 1 { - return false - } - return true -} - -func CheckIsExistGroupMember(ctx context.Context, groupID, userID string) error { - var number int64 - err := GroupMemberDB.Table("group_members").Where("group_id = ? and user_id = ?", groupID, userID).Count(&number).Error - if err != nil { - return constant.ErrDB.Wrap() - } - if number != 1 { - return constant.ErrData.Wrap() - } - return nil -} - -func GetGroupMemberByGroupID(groupID string, filter int32, begin int32, maxNumber int32) ([]GroupMember, error) { - var memberList []GroupMember - var err error - if filter >= 0 { - memberList, err = GetGroupMemberListByGroupIDAndRoleLevel(groupID, filter) //sorted by join time - } else { - memberList, err = GetGroupMemberListByGroupID(groupID) - } - - if err != nil { - return nil, err - } - if begin >= int32(len(memberList)) { - return nil, nil - } - - var end int32 - if begin+int32(maxNumber) < int32(len(memberList)) { - end = begin + maxNumber - } else { - end = int32(len(memberList)) - } - return memberList[begin:end], nil -} - -func GetJoinedGroupIDListByUserID(userID string) ([]string, error) { - memberList, err := GetGroupMemberListByUserID(userID) - if err != nil { - return nil, err - } - var groupIDList []string - for _, v := range memberList { - groupIDList = append(groupIDList, v.GroupID) - } - return groupIDList, nil -} - -func IsGroupOwnerAdmin(groupID, UserID string) bool { - groupMemberList, err := GetOwnerManagerByGroupID(groupID) - if err != nil { - return false - } - for _, v := range groupMemberList { - if v.UserID == UserID && v.RoleLevel > constant.GroupOrdinaryUsers { - return true - } - } - return false -} - -func GetGroupMembersByGroupIdCMS(groupId string, userName string, showNumber, pageNumber int32) ([]GroupMember, error) { - var groupMembers []GroupMember - err := GroupMemberDB.Table("group_members").Where("group_id=?", groupId).Where(fmt.Sprintf(" nickname like '%%%s%%' ", userName)).Limit(int(showNumber)).Offset(int(showNumber * (pageNumber - 1))).Find(&groupMembers).Error - if err != nil { - return nil, err - } - return groupMembers, nil -} - -func GetGroupMembersCount(groupID, userName string) (int64, error) { - var count int64 - if err := GroupMemberDB.Table("group_members").Where("group_id=?", groupID).Where(fmt.Sprintf(" nickname like '%%%s%%' ", userName)).Count(&count).Error; err != nil { - return count, err - } - return count, nil -} - -func UpdateGroupMemberInfoDefaultZero(groupMemberInfo GroupMember, args map[string]interface{}) error { - return GroupMemberDB.Model(groupMemberInfo).Updates(args).Error -} +//func InsertIntoGroupMember(toInsertInfo GroupMemberModel) error { +// toInsertInfo.JoinTime = time.Now() +// if toInsertInfo.RoleLevel == 0 { +// toInsertInfo.RoleLevel = constant.GroupOrdinaryUsers +// } +// toInsertInfo.MuteEndTime = time.Unix(int64(time.Now().Second()), 0) +// err := GroupMemberDB.Table("group_members").Create(toInsertInfo).Error +// if err != nil { +// return err +// } +// return nil +//} +// +//func BatchInsertIntoGroupMember(toInsertInfoList []*GroupMemberModel) error { +// for _, toInsertInfo := range toInsertInfoList { +// toInsertInfo.JoinTime = time.Now() +// if toInsertInfo.RoleLevel == 0 { +// toInsertInfo.RoleLevel = constant.GroupOrdinaryUsers +// } +// toInsertInfo.MuteEndTime = time.Unix(int64(time.Now().Second()), 0) +// } +// return GroupMemberDB.Create(toInsertInfoList).Error +// +//} +// +//func GetGroupMemberListByUserID(userID string) ([]GroupMemberModel, error) { +// var groupMemberList []GroupMemberModel +// err := GroupMemberDB.Table("group_members").Where("user_id=?", userID).Find(&groupMemberList).Error +// if err != nil { +// return nil, err +// } +// return groupMemberList, nil +//} +// +//func GetGroupMemberListByGroupID(groupID string) ([]GroupMemberModel, error) { +// var groupMemberList []GroupMemberModel +// err := GroupMemberDB.Table("group_members").Where("group_id=?", groupID).Find(&groupMemberList).Error +// if err != nil { +// return nil, err +// } +// return groupMemberList, nil +//} +// +//func GetGroupMemberIDListByGroupID(groupID string) ([]string, error) { +// var groupMemberIDList []string +// err := GroupMemberDB.Table("group_members").Where("group_id=?", groupID).Pluck("user_id", &groupMemberIDList).Error +// if err != nil { +// return nil, err +// } +// return groupMemberIDList, nil +//} +// +//func GetGroupMemberListByGroupIDAndRoleLevel(groupID string, roleLevel int32) ([]GroupMemberModel, error) { +// var groupMemberList []GroupMemberModel +// err := GroupMemberDB.Table("group_members").Where("group_id=? and role_level=?", groupID, roleLevel).Find(&groupMemberList).Error +// if err != nil { +// return nil, err +// } +// return groupMemberList, nil +//} +// +//func GetGroupMemberInfoByGroupIDAndUserID(groupID, userID string) (*GroupMemberModel, error) { +// var groupMember GroupMemberModel +// err := GroupMemberDB.Table("group_members").Where("group_id=? and user_id=? ", groupID, userID).Limit(1).Take(&groupMember).Error +// if err != nil { +// return nil, err +// } +// return &groupMember, nil +//} +// +//func DeleteGroupMemberByGroupIDAndUserID(groupID, userID string) error { +// return GroupMemberDB.Table("group_members").Where("group_id=? and user_id=? ", groupID, userID).Delete(GroupMemberModel{}).Error +//} +// +//func DeleteGroupMemberByGroupID(groupID string) error { +// return GroupMemberDB.Table("group_members").Where("group_id=? ", groupID).Delete(GroupMemberModel{}).Error +//} +// +//func UpdateGroupMemberInfo(groupMemberInfo GroupMemberModel) error { +// return GroupMemberDB.Table("group_members").Where("group_id=? and user_id=?", groupMemberInfo.GroupID, groupMemberInfo.UserID).Updates(&groupMemberInfo).Error +//} +// +//func UpdateGroupMemberInfoByMap(groupMemberInfo GroupMemberModel, m map[string]interface{}) error { +// return GroupMemberDB.Table("group_members").Where("group_id=? and user_id=?", groupMemberInfo.GroupID, groupMemberInfo.UserID).Updates(m).Error +//} +// +//func GetOwnerManagerByGroupID(groupID string) ([]GroupMemberModel, error) { +// var groupMemberList []GroupMemberModel +// err := GroupMemberDB.Table("group_members").Where("group_id=? and role_level>?", groupID, constant.GroupOrdinaryUsers).Find(&groupMemberList).Error +// if err != nil { +// return nil, err +// } +// return groupMemberList, nil +//} +// +//func GetGroupMemberNumByGroupID(groupID string) (int64, error) { +// var number int64 +// err := GroupMemberDB.Table("group_members").Where("group_id=?", groupID).Count(&number).Error +// if err != nil { +// return 0, utils.Wrap(err, "") +// } +// return number, nil +//} +// +//func GetGroupOwnerInfoByGroupID(groupID string) (*GroupMemberModel, error) { +// omList, err := GetOwnerManagerByGroupID(groupID) +// if err != nil { +// return nil, err +// } +// for _, v := range omList { +// if v.RoleLevel == constant.GroupOwner { +// return &v, nil +// } +// } +// return nil, utils.Wrap(constant.ErrGroupNoOwner, "") +//} +// +//func IsExistGroupMember(groupID, userID string) bool { +// var number int64 +// err := GroupMemberDB.Table("group_members").Where("group_id = ? and user_id = ?", groupID, userID).Count(&number).Error +// if err != nil { +// return false +// } +// if number != 1 { +// return false +// } +// return true +//} +// +//func CheckIsExistGroupMember(ctx context.Context, groupID, userID string) error { +// var number int64 +// err := GroupMemberDB.Table("group_members").Where("group_id = ? and user_id = ?", groupID, userID).Count(&number).Error +// if err != nil { +// return constant.ErrDB.Wrap() +// } +// if number != 1 { +// return constant.ErrData.Wrap() +// } +// return nil +//} +// +//func GetGroupMemberByGroupID(groupID string, filter int32, begin int32, maxNumber int32) ([]GroupMember, error) { +// var memberList []GroupMember +// var err error +// if filter >= 0 { +// memberList, err = GetGroupMemberListByGroupIDAndRoleLevel(groupID, filter) //sorted by join time +// } else { +// memberList, err = GetGroupMemberListByGroupID(groupID) +// } +// +// if err != nil { +// return nil, err +// } +// if begin >= int32(len(memberList)) { +// return nil, nil +// } +// +// var end int32 +// if begin+int32(maxNumber) < int32(len(memberList)) { +// end = begin + maxNumber +// } else { +// end = int32(len(memberList)) +// } +// return memberList[begin:end], nil +//} +// +//func GetJoinedGroupIDListByUserID(userID string) ([]string, error) { +// memberList, err := GetGroupMemberListByUserID(userID) +// if err != nil { +// return nil, err +// } +// var groupIDList []string +// for _, v := range memberList { +// groupIDList = append(groupIDList, v.GroupID) +// } +// return groupIDList, nil +//} +// +//func IsGroupOwnerAdmin(groupID, UserID string) bool { +// groupMemberList, err := GetOwnerManagerByGroupID(groupID) +// if err != nil { +// return false +// } +// for _, v := range groupMemberList { +// if v.UserID == UserID && v.RoleLevel > constant.GroupOrdinaryUsers { +// return true +// } +// } +// return false +//} +// +//func GetGroupMembersByGroupIdCMS(groupId string, userName string, showNumber, pageNumber int32) ([]GroupMember, error) { +// var groupMembers []GroupMember +// err := GroupMemberDB.Table("group_members").Where("group_id=?", groupId).Where(fmt.Sprintf(" nickname like '%%%s%%' ", userName)).Limit(int(showNumber)).Offset(int(showNumber * (pageNumber - 1))).Find(&groupMembers).Error +// if err != nil { +// return nil, err +// } +// return groupMembers, nil +//} +// +//func GetGroupMembersCount(groupID, userName string) (int64, error) { +// var count int64 +// if err := GroupMemberDB.Table("group_members").Where("group_id=?", groupID).Where(fmt.Sprintf(" nickname like '%%%s%%' ", userName)).Count(&count).Error; err != nil { +// return count, err +// } +// return count, nil +//} +// +//func UpdateGroupMemberInfoDefaultZero(groupMemberInfo GroupMember, args map[string]interface{}) error { +// return GroupMemberDB.Model(groupMemberInfo).Updates(args).Error +//} diff --git a/pkg/common/db/relation/group_model_k.go b/pkg/common/db/relation/group_model_k.go index d2f9c839e..dd9902146 100644 --- a/pkg/common/db/relation/group_model_k.go +++ b/pkg/common/db/relation/group_model_k.go @@ -1,75 +1,58 @@ package relation import ( + "Open_IM/pkg/common/db/table" "Open_IM/pkg/common/tracelog" "Open_IM/pkg/utils" "context" "gorm.io/gorm" - "time" ) -type Group struct { - GroupID string `gorm:"column:group_id;primary_key;size:64" json:"groupID" binding:"required"` - GroupName string `gorm:"column:name;size:255" json:"groupName"` - Notification string `gorm:"column:notification;size:255" json:"notification"` - Introduction string `gorm:"column:introduction;size:255" json:"introduction"` - FaceURL string `gorm:"column:face_url;size:255" json:"faceURL"` - CreateTime time.Time `gorm:"column:create_time;index:create_time"` - Ex string `gorm:"column:ex" json:"ex;size:1024" json:"ex"` - Status int32 `gorm:"column:status"` - CreatorUserID string `gorm:"column:creator_user_id;size:64"` - GroupType int32 `gorm:"column:group_type"` - NeedVerification int32 `gorm:"column:need_verification"` - LookMemberInfo int32 `gorm:"column:look_member_info" json:"lookMemberInfo"` - ApplyMemberFriend int32 `gorm:"column:apply_member_friend" json:"applyMemberFriend"` - NotificationUpdateTime time.Time `gorm:"column:notification_update_time"` - NotificationUserID string `gorm:"column:notification_user_id;size:64"` - DB *gorm.DB +type GroupGorm struct { + DB *gorm.DB } -func NewGroupDB(db *gorm.DB) *Group { - var group Group - group.DB = db - return &group +func NewGroupDB(db *gorm.DB) *GroupGorm { + return &GroupGorm{DB: db} } -func (g *Group) Create(ctx context.Context, groups []*Group, tx ...*gorm.DB) (err error) { +func (g *GroupGorm) Create(ctx context.Context, groups []*table.GroupModel, tx ...*gorm.DB) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groups", groups) }() return utils.Wrap(getDBConn(g.DB, tx).Create(&groups).Error, "") } -func (g *Group) Delete(ctx context.Context, groupIDs []string, tx ...*gorm.DB) (err error) { +func (g *GroupGorm) Delete(ctx context.Context, groupIDs []string, tx ...*gorm.DB) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupIDs", groupIDs) }() - return utils.Wrap(getDBConn(g.DB, tx).Where("group_id in (?)", groupIDs).Delete(&Group{}).Error, "") + return utils.Wrap(getDBConn(g.DB, tx).Where("group_id in (?)", groupIDs).Delete(&table.GroupModel{}).Error, "") } -func (g *Group) UpdateByMap(ctx context.Context, groupID string, args map[string]interface{}, tx ...*gorm.DB) (err error) { +func (g *GroupGorm) UpdateByMap(ctx context.Context, groupID string, args map[string]interface{}, tx ...*gorm.DB) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "args", args) }() return utils.Wrap(getDBConn(g.DB, tx).Where("group_id = ?", groupID).Model(g).Updates(args).Error, "") } -func (g *Group) Update(ctx context.Context, groups []*Group, tx ...*gorm.DB) (err error) { +func (g *GroupGorm) Update(ctx context.Context, groups []*table.GroupModel, tx ...*gorm.DB) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groups", groups) }() return utils.Wrap(getDBConn(g.DB, tx).Updates(&groups).Error, "") } -func (g *Group) Find(ctx context.Context, groupIDs []string, tx ...*gorm.DB) (groups []*Group, err error) { +func (g *GroupGorm) Find(ctx context.Context, groupIDs []string, tx ...*gorm.DB) (groups []*table.GroupModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupIDs", groupIDs, "groups", groups) }() return groups, utils.Wrap(getDBConn(g.DB, tx).Where("group_id in (?)", groupIDs).Find(&groups).Error, "") } -func (g *Group) Take(ctx context.Context, groupID string, tx ...*gorm.DB) (group *Group, err error) { - group = &Group{} +func (g *GroupGorm) Take(ctx context.Context, groupID string, tx ...*gorm.DB) (group *table.GroupModel, err error) { + group = &table.GroupModel{} defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "group", *group) }() diff --git a/pkg/common/db/relation/group_request_model_k.go b/pkg/common/db/relation/group_request_model_k.go index 63014d06b..bc384b699 100644 --- a/pkg/common/db/relation/group_request_model_k.go +++ b/pkg/common/db/relation/group_request_model_k.go @@ -1,69 +1,52 @@ package relation import ( + "Open_IM/pkg/common/db/table" "Open_IM/pkg/common/tracelog" "Open_IM/pkg/utils" "context" "gorm.io/gorm" - "time" ) -var GroupRequestDB *gorm.DB - -type GroupRequest struct { - UserID string `gorm:"column:user_id;primary_key;size:64"` - GroupID string `gorm:"column:group_id;primary_key;size:64"` - HandleResult int32 `gorm:"column:handle_result"` - ReqMsg string `gorm:"column:req_msg;size:1024"` - HandledMsg string `gorm:"column:handle_msg;size:1024"` - ReqTime time.Time `gorm:"column:req_time"` - HandleUserID string `gorm:"column:handle_user_id;size:64"` - HandledTime time.Time `gorm:"column:handle_time"` - JoinSource int32 `gorm:"column:join_source"` - InviterUserID string `gorm:"column:inviter_user_id;size:64"` - Ex string `gorm:"column:ex;size:1024"` - DB *gorm.DB +type GroupRequestGorm struct { + DB *gorm.DB } -func NewGroupRequest(db *gorm.DB) *GroupRequest { - return &GroupRequest{ +func NewGroupRequest(db *gorm.DB) *GroupRequestGorm { + return &GroupRequestGorm{ DB: db, } } -func (GroupRequest) TableName() string { - return "friend_requests" -} - -func (*GroupRequest) Create(ctx context.Context, groupRequests []*GroupRequest) (err error) { +func (g *GroupRequestGorm) Create(ctx context.Context, groupRequests []*table.GroupRequestModel, tx ...*gorm.DB) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupRequests", groupRequests) }() - return utils.Wrap(GroupRequestDB.Create(&groupRequests).Error, utils.GetSelfFuncName()) + return utils.Wrap(getDBConn(g.DB, tx).Create(&groupRequests).Error, utils.GetSelfFuncName()) } -func (*GroupRequest) Delete(ctx context.Context, groupRequests []*GroupRequest) (err error) { +func (g *GroupRequestGorm) Delete(ctx context.Context, groupRequests []*table.GroupRequestModel, tx ...*gorm.DB) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupRequests", groupRequests) }() - return utils.Wrap(GroupRequestDB.Delete(&groupRequests).Error, utils.GetSelfFuncName()) + return utils.Wrap(getDBConn(g.DB, tx).Delete(&groupRequests).Error, utils.GetSelfFuncName()) } -func (*GroupRequest) UpdateByMap(ctx context.Context, groupID string, userID string, args map[string]interface{}) (err error) { +func (g *GroupRequestGorm) UpdateByMap(ctx context.Context, groupID string, userID string, args map[string]interface{}, tx ...*gorm.DB) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "args", args) }() - return utils.Wrap(GroupRequestDB.Where("group_id = ? and user_id = ? ", groupID, userID).Updates(args).Error, utils.GetSelfFuncName()) + return utils.Wrap(getDBConn(g.DB, tx).Where("group_id = ? and user_id = ? ", groupID, userID).Updates(args).Error, utils.GetSelfFuncName()) } -func (*GroupRequest) Update(ctx context.Context, groupRequests []*GroupRequest) (err error) { +func (g *GroupRequestGorm) Update(ctx context.Context, groupRequests []*table.GroupRequestModel, tx ...*gorm.DB) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupRequests", groupRequests) }() - return utils.Wrap(GroupRequestDB.Updates(&groupRequests).Error, utils.GetSelfFuncName()) + return utils.Wrap(getDBConn(g.DB, tx).Updates(&groupRequests).Error, utils.GetSelfFuncName()) } -func (*GroupRequest) Find(ctx context.Context, groupRequests []*GroupRequest) (resultGroupRequests []*GroupRequest, err error) { +func (g *GroupRequestGorm) Find(ctx context.Context, groupRequests []*table.GroupRequestModel, tx ...*gorm.DB) (resultGroupRequests []*table.GroupRequestModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupRequests", groupRequests, "resultGroupRequests", resultGroupRequests) }() @@ -71,13 +54,13 @@ func (*GroupRequest) Find(ctx context.Context, groupRequests []*GroupRequest) (r for _, groupMember := range groupRequests { where = append(where, []interface{}{groupMember.GroupID, groupMember.UserID}) } - return resultGroupRequests, utils.Wrap(GroupRequestDB.Where("(group_id, user_id) in ?", where).Find(&resultGroupRequests).Error, utils.GetSelfFuncName()) + return resultGroupRequests, utils.Wrap(getDBConn(g.DB, tx).Where("(group_id, user_id) in ?", where).Find(&resultGroupRequests).Error, utils.GetSelfFuncName()) } -func (*GroupRequest) Take(ctx context.Context, groupID string, userID string) (groupRequest *GroupRequest, err error) { - groupRequest = &GroupRequest{} +func (g *GroupRequestGorm) Take(ctx context.Context, groupID string, userID string, tx ...*gorm.DB) (groupRequest *table.GroupRequestModel, err error) { + groupRequest = &table.GroupRequestModel{} defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "groupRequest", *groupRequest) }() - return groupRequest, utils.Wrap(GroupRequestDB.Where("group_id = ? and user_id = ? ", groupID, userID).Take(groupRequest).Error, utils.GetSelfFuncName()) + return groupRequest, utils.Wrap(getDBConn(g.DB, tx).Where("group_id = ? and user_id = ? ", groupID, userID).Take(groupRequest).Error, utils.GetSelfFuncName()) } diff --git a/pkg/common/db/table/table.go b/pkg/common/db/table/table.go index 5ec125727..20b124bd8 100644 --- a/pkg/common/db/table/table.go +++ b/pkg/common/db/table/table.go @@ -1,6 +1,8 @@ package table -import "time" +import ( + "time" +) type FriendModel struct { OwnerUserID string `gorm:"column:owner_user_id;primary_key;size:64"` @@ -29,3 +31,49 @@ type ConversationModel struct { AttachedInfo string `gorm:"column:attached_info;type:varchar(1024)" json:"attachedInfo"` Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"` } + +type GroupModel struct { + GroupID string `gorm:"column:group_id;primary_key;size:64" json:"groupID" binding:"required"` + GroupName string `gorm:"column:name;size:255" json:"groupName"` + Notification string `gorm:"column:notification;size:255" json:"notification"` + Introduction string `gorm:"column:introduction;size:255" json:"introduction"` + FaceURL string `gorm:"column:face_url;size:255" json:"faceURL"` + CreateTime time.Time `gorm:"column:create_time;index:create_time"` + Ex string `gorm:"column:ex" json:"ex;size:1024" json:"ex"` + Status int32 `gorm:"column:status"` + CreatorUserID string `gorm:"column:creator_user_id;size:64"` + GroupType int32 `gorm:"column:group_type"` + NeedVerification int32 `gorm:"column:need_verification"` + LookMemberInfo int32 `gorm:"column:look_member_info" json:"lookMemberInfo"` + ApplyMemberFriend int32 `gorm:"column:apply_member_friend" json:"applyMemberFriend"` + NotificationUpdateTime time.Time `gorm:"column:notification_update_time"` + NotificationUserID string `gorm:"column:notification_user_id;size:64"` +} + +type GroupMemberModel struct { + GroupID string `gorm:"column:group_id;primary_key;size:64"` + UserID string `gorm:"column:user_id;primary_key;size:64"` + Nickname string `gorm:"column:nickname;size:255"` + FaceURL string `gorm:"column:user_group_face_url;size:255"` + RoleLevel int32 `gorm:"column:role_level"` + JoinTime time.Time `gorm:"column:join_time"` + JoinSource int32 `gorm:"column:join_source"` + InviterUserID string `gorm:"column:inviter_user_id;size:64"` + OperatorUserID string `gorm:"column:operator_user_id;size:64"` + MuteEndTime time.Time `gorm:"column:mute_end_time"` + Ex string `gorm:"column:ex;size:1024"` +} + +type GroupRequestModel struct { + UserID string `gorm:"column:user_id;primary_key;size:64"` + GroupID string `gorm:"column:group_id;primary_key;size:64"` + HandleResult int32 `gorm:"column:handle_result"` + ReqMsg string `gorm:"column:req_msg;size:1024"` + HandledMsg string `gorm:"column:handle_msg;size:1024"` + ReqTime time.Time `gorm:"column:req_time"` + HandleUserID string `gorm:"column:handle_user_id;size:64"` + HandledTime time.Time `gorm:"column:handle_time"` + JoinSource int32 `gorm:"column:join_source"` + InviterUserID string `gorm:"column:inviter_user_id;size:64"` + Ex string `gorm:"column:ex;size:1024"` +}