mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
group func name
This commit is contained in:
parent
1716de808f
commit
cfa5420d9d
@ -1375,7 +1375,7 @@ const docTemplate = `{
|
|||||||
"群组相关"
|
"群组相关"
|
||||||
],
|
],
|
||||||
"summary": "获取用户加入群列表",
|
"summary": "获取用户加入群列表",
|
||||||
"operationId": "GetJoinedGroupList",
|
"operationId": "FindJoinedGroup",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
@ -118,7 +118,7 @@ func main() {
|
|||||||
groupRouterGroup.POST("/get_user_req_group_applicationList", group.GetUserReqGroupApplicationList)
|
groupRouterGroup.POST("/get_user_req_group_applicationList", group.GetUserReqGroupApplicationList)
|
||||||
groupRouterGroup.POST("/get_groups_info", group.GetGroupsInfo) //1
|
groupRouterGroup.POST("/get_groups_info", group.GetGroupsInfo) //1
|
||||||
groupRouterGroup.POST("/kick_group", group.KickGroupMember) //1
|
groupRouterGroup.POST("/kick_group", group.KickGroupMember) //1
|
||||||
// groupRouterGroup.POST("/get_group_member_list", group.GetGroupMemberList) //no use
|
// groupRouterGroup.POST("/get_group_member_list", group.FindGroupMemberAll) //no use
|
||||||
groupRouterGroup.POST("/get_group_all_member_list", group.GetGroupAllMemberList) //1
|
groupRouterGroup.POST("/get_group_all_member_list", group.GetGroupAllMemberList) //1
|
||||||
groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo) //1
|
groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo) //1
|
||||||
groupRouterGroup.POST("/invite_user_to_group", group.InviteUserToGroup) //1
|
groupRouterGroup.POST("/invite_user_to_group", group.InviteUserToGroup) //1
|
||||||
|
@ -72,7 +72,7 @@ func KickGroupMember(c *gin.Context) {
|
|||||||
client := rpc.NewGroupClient(etcdConn)
|
client := rpc.NewGroupClient(etcdConn)
|
||||||
RpcResp, err := client.KickGroupMember(context.Background(), req)
|
RpcResp, err := client.KickGroupMember(context.Background(), req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(req.OperationID, "GetGroupMemberList failed ", err.Error(), req.String())
|
log.NewError(req.OperationID, "FindGroupMemberAll failed ", err.Error(), req.String())
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ func GetGroupMembersInfo(c *gin.Context) {
|
|||||||
|
|
||||||
RpcResp, err := client.GetGroupMembersInfo(context.Background(), req)
|
RpcResp, err := client.GetGroupMembersInfo(context.Background(), req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(req.OperationID, "GetGroupMemberList failed ", err.Error(), req.String())
|
log.NewError(req.OperationID, "FindGroupMemberAll failed ", err.Error(), req.String())
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -167,7 +167,7 @@ func GetGroupMemberList(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "GetGroupMemberList args ", req.String())
|
log.NewInfo(req.OperationID, "FindGroupMemberAll args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||||
if etcdConn == nil {
|
if etcdConn == nil {
|
||||||
@ -180,7 +180,7 @@ func GetGroupMemberList(c *gin.Context) {
|
|||||||
|
|
||||||
RpcResp, err := client.GetGroupMemberList(context.Background(), req)
|
RpcResp, err := client.GetGroupMemberList(context.Background(), req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(req.OperationID, "GetGroupMemberList failed, ", err.Error(), req.String())
|
log.NewError(req.OperationID, "FindGroupMemberAll failed, ", err.Error(), req.String())
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ func GetGroupMemberList(c *gin.Context) {
|
|||||||
memberListResp := api.GetGroupMemberListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, MemberList: RpcResp.MemberList, NextSeq: RpcResp.NextSeq}
|
memberListResp := api.GetGroupMemberListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, MemberList: RpcResp.MemberList, NextSeq: RpcResp.NextSeq}
|
||||||
memberListResp.Data = jsonData.JsonDataList(memberListResp.MemberList)
|
memberListResp.Data = jsonData.JsonDataList(memberListResp.MemberList)
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "GetGroupMemberList api return ", memberListResp)
|
log.NewInfo(req.OperationID, "FindGroupMemberAll api return ", memberListResp)
|
||||||
c.JSON(http.StatusOK, memberListResp)
|
c.JSON(http.StatusOK, memberListResp)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ func GetJoinedGroupList(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "GetJoinedGroupList args ", req.String())
|
log.NewInfo(req.OperationID, "FindJoinedGroup args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||||
if etcdConn == nil {
|
if etcdConn == nil {
|
||||||
@ -292,14 +292,14 @@ func GetJoinedGroupList(c *gin.Context) {
|
|||||||
client := rpc.NewGroupClient(etcdConn)
|
client := rpc.NewGroupClient(etcdConn)
|
||||||
RpcResp, err := client.GetJoinedGroupList(context.Background(), req)
|
RpcResp, err := client.GetJoinedGroupList(context.Background(), req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(req.OperationID, "GetJoinedGroupList failed ", err.Error(), req.String())
|
log.NewError(req.OperationID, "FindJoinedGroup failed ", err.Error(), req.String())
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupListResp := api.GetJoinedGroupListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, GroupInfoList: RpcResp.GroupList}
|
GroupListResp := api.GetJoinedGroupListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, GroupInfoList: RpcResp.GroupList}
|
||||||
GroupListResp.Data = jsonData.JsonDataList(GroupListResp.GroupInfoList)
|
GroupListResp.Data = jsonData.JsonDataList(GroupListResp.GroupInfoList)
|
||||||
log.NewInfo(req.OperationID, "GetJoinedGroupList api return ", GroupListResp)
|
log.NewInfo(req.OperationID, "FindJoinedGroup api return ", GroupListResp)
|
||||||
c.JSON(http.StatusOK, GroupListResp)
|
c.JSON(http.StatusOK, GroupListResp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ func (s *adminCMSServer) GetChatLogs(ctx context.Context, req *pbAdminCMS.GetCha
|
|||||||
pbChatLog.SenderNickname = recvUser.Nickname
|
pbChatLog.SenderNickname = recvUser.Nickname
|
||||||
|
|
||||||
case constant.GroupChatType, constant.SuperGroupChatType:
|
case constant.GroupChatType, constant.SuperGroupChatType:
|
||||||
group, err := s.groupInterface.TakeGroupByID(ctx, chatLog.RecvID)
|
group, err := s.groupInterface.TakeGroup(ctx, chatLog.RecvID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ func (s *groupServer) Run() {
|
|||||||
|
|
||||||
func (s *groupServer) CheckGroupAdmin(ctx context.Context, groupID string) error {
|
func (s *groupServer) CheckGroupAdmin(ctx context.Context, groupID string) error {
|
||||||
if !token_verify.IsAppManagerUid(ctx) {
|
if !token_verify.IsAppManagerUid(ctx) {
|
||||||
groupMember, err := s.GroupInterface.TakeGroupMemberByID(ctx, groupID, tracelog.GetOpUserID(ctx))
|
groupMember, err := s.GroupInterface.TakeGroupMember(ctx, groupID, tracelog.GetOpUserID(ctx))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -243,7 +243,7 @@ func (s *groupServer) GetJoinedGroupList(ctx context.Context, req *pbGroup.GetJo
|
|||||||
if err := token_verify.CheckAccessV3(ctx, req.FromUserID); err != nil {
|
if err := token_verify.CheckAccessV3(ctx, req.FromUserID); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
groups, err := s.GroupInterface.GetJoinedGroupList(ctx, req.FromUserID)
|
groups, err := s.GroupInterface.FindJoinedGroup(ctx, req.FromUserID, req.Pagination.PageNumber, req.Pagination.ShowNumber)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -253,11 +253,11 @@ func (s *groupServer) GetJoinedGroupList(ctx context.Context, req *pbGroup.GetJo
|
|||||||
groupIDs := utils.Slice(groups, func(e *relation2.GroupModel) string {
|
groupIDs := utils.Slice(groups, func(e *relation2.GroupModel) string {
|
||||||
return e.GroupID
|
return e.GroupID
|
||||||
})
|
})
|
||||||
groupMemberNum, err := s.GroupInterface.GetGroupMemberNum(ctx, groupIDs)
|
groupMemberNum, err := s.GroupInterface.MapGroupMemberNum(ctx, groupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
groupOwnerUserID, err := s.GroupInterface.GetGroupOwnerUserID(ctx, groupIDs)
|
groupOwnerUserID, err := s.GroupInterface.MapGroupOwnerUserID(ctx, groupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -279,14 +279,14 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
|
|||||||
if utils.Duplicate(req.InvitedUserIDs) {
|
if utils.Duplicate(req.InvitedUserIDs) {
|
||||||
return nil, constant.ErrArgs.Wrap("userID duplicate")
|
return nil, constant.ErrArgs.Wrap("userID duplicate")
|
||||||
}
|
}
|
||||||
group, err := s.GroupInterface.TakeGroupByID(ctx, req.GroupID)
|
group, err := s.GroupInterface.TakeGroup(ctx, req.GroupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if group.Status == constant.GroupStatusDismissed {
|
if group.Status == constant.GroupStatusDismissed {
|
||||||
return nil, constant.ErrDismissedAlready.Wrap()
|
return nil, constant.ErrDismissedAlready.Wrap()
|
||||||
}
|
}
|
||||||
members, err := s.GroupInterface.GetGroupMemberList(ctx, group.GroupID)
|
members, err := s.GroupInterface.FindGroupMemberAll(ctx, group.GroupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -367,14 +367,14 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
|
|||||||
|
|
||||||
func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGroupAllMemberReq) (*pbGroup.GetGroupAllMemberResp, error) {
|
func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGroupAllMemberReq) (*pbGroup.GetGroupAllMemberResp, error) {
|
||||||
resp := &pbGroup.GetGroupAllMemberResp{}
|
resp := &pbGroup.GetGroupAllMemberResp{}
|
||||||
group, err := s.GroupInterface.TakeGroupByID(ctx, req.GroupID)
|
group, err := s.GroupInterface.TakeGroup(ctx, req.GroupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if group.GroupType == constant.SuperGroup {
|
if group.GroupType == constant.SuperGroup {
|
||||||
return nil, constant.ErrArgs.Wrap("unsupported super group")
|
return nil, constant.ErrArgs.Wrap("unsupported super group")
|
||||||
}
|
}
|
||||||
members, err := s.GroupInterface.GetGroupMemberList(ctx, req.GroupID)
|
members, err := s.GroupInterface.FindGroupMemberAll(ctx, req.GroupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -386,7 +386,7 @@ func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGro
|
|||||||
|
|
||||||
func (s *groupServer) GetGroupMemberList(ctx context.Context, req *pbGroup.GetGroupMemberListReq) (*pbGroup.GetGroupMemberListResp, error) {
|
func (s *groupServer) GetGroupMemberList(ctx context.Context, req *pbGroup.GetGroupMemberListReq) (*pbGroup.GetGroupMemberListResp, error) {
|
||||||
resp := &pbGroup.GetGroupMemberListResp{}
|
resp := &pbGroup.GetGroupMemberListResp{}
|
||||||
members, err := s.GroupInterface.GetGroupMemberFilterList(ctx, req.GroupID, req.Filter, req.Pagination.PageNumber, req.Pagination.ShowNumber)
|
members, err := s.GroupInterface.FindGroupMemberFilterList(ctx, req.GroupID, req.Filter, req.Pagination.PageNumber, req.Pagination.ShowNumber)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -398,7 +398,7 @@ func (s *groupServer) GetGroupMemberList(ctx context.Context, req *pbGroup.GetGr
|
|||||||
|
|
||||||
func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGroupMemberReq) (*pbGroup.KickGroupMemberResp, error) {
|
func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGroupMemberReq) (*pbGroup.KickGroupMemberResp, error) {
|
||||||
resp := &pbGroup.KickGroupMemberResp{}
|
resp := &pbGroup.KickGroupMemberResp{}
|
||||||
group, err := s.GroupInterface.TakeGroupByID(ctx, req.GroupID)
|
group, err := s.GroupInterface.TakeGroup(ctx, req.GroupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -413,7 +413,7 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou
|
|||||||
return nil, constant.ErrArgs.Wrap("opUserID in KickedUserIDs")
|
return nil, constant.ErrArgs.Wrap("opUserID in KickedUserIDs")
|
||||||
}
|
}
|
||||||
if group.GroupType == constant.SuperGroup {
|
if group.GroupType == constant.SuperGroup {
|
||||||
if err := s.GroupInterface.DelSuperGroupMember(ctx, req.GroupID, req.KickedUserIDs); err != nil {
|
if err := s.GroupInterface.DeleteSuperGroupMember(ctx, req.GroupID, req.KickedUserIDs); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
@ -422,7 +422,7 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
} else {
|
} else {
|
||||||
members, err := s.GroupInterface.FindGroupMembersByID(ctx, req.GroupID, append(req.KickedUserIDs, opUserID))
|
members, err := s.GroupInterface.FindGroupMember(ctx, req.GroupID, append(req.KickedUserIDs, opUserID))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -455,7 +455,7 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou
|
|||||||
return nil, constant.ErrNoPermission.Wrap("opUserID is OrdinaryUser")
|
return nil, constant.ErrNoPermission.Wrap("opUserID is OrdinaryUser")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := s.GroupInterface.DelGroupMember(ctx, group.GroupID, req.KickedUserIDs); err != nil {
|
if err := s.GroupInterface.DeleteGroupMember(ctx, group.GroupID, req.KickedUserIDs); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
chat.MemberKickedNotification(req, req.KickedUserIDs)
|
chat.MemberKickedNotification(req, req.KickedUserIDs)
|
||||||
@ -465,7 +465,7 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou
|
|||||||
|
|
||||||
func (s *groupServer) GetGroupMembersInfo(ctx context.Context, req *pbGroup.GetGroupMembersInfoReq) (*pbGroup.GetGroupMembersInfoResp, error) {
|
func (s *groupServer) GetGroupMembersInfo(ctx context.Context, req *pbGroup.GetGroupMembersInfoReq) (*pbGroup.GetGroupMembersInfoResp, error) {
|
||||||
resp := &pbGroup.GetGroupMembersInfoResp{}
|
resp := &pbGroup.GetGroupMembersInfoResp{}
|
||||||
members, err := s.GroupInterface.GetGroupMemberListByUserID(ctx, req.GroupID, req.Members)
|
members, err := s.GroupInterface.FindGroupMember(ctx, req.GroupID, req.Members)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -501,7 +501,7 @@ func (s *groupServer) GetGroupApplicationList(ctx context.Context, req *pbGroup.
|
|||||||
if ids := utils.Single(utils.Keys(userMap), userIDs); len(ids) > 0 {
|
if ids := utils.Single(utils.Keys(userMap), userIDs); len(ids) > 0 {
|
||||||
return nil, constant.ErrUserIDNotFound.Wrap(strings.Join(ids, ","))
|
return nil, constant.ErrUserIDNotFound.Wrap(strings.Join(ids, ","))
|
||||||
}
|
}
|
||||||
groups, err := s.GroupInterface.FindGroupsByID(ctx, utils.Distinct(groupIDs))
|
groups, err := s.GroupInterface.FindGroup(ctx, utils.Distinct(groupIDs))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -511,11 +511,11 @@ func (s *groupServer) GetGroupApplicationList(ctx context.Context, req *pbGroup.
|
|||||||
if ids := utils.Single(utils.Keys(groupMap), groupIDs); len(ids) > 0 {
|
if ids := utils.Single(utils.Keys(groupMap), groupIDs); len(ids) > 0 {
|
||||||
return nil, constant.ErrGroupIDNotFound.Wrap(strings.Join(ids, ","))
|
return nil, constant.ErrGroupIDNotFound.Wrap(strings.Join(ids, ","))
|
||||||
}
|
}
|
||||||
groupMemberNumMap, err := s.GroupInterface.GetGroupMemberNum(ctx, groupIDs)
|
groupMemberNumMap, err := s.GroupInterface.MapGroupMemberNum(ctx, groupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
groupOwnerUserIDMap, err := s.GroupInterface.GetGroupOwnerUserID(ctx, groupIDs)
|
groupOwnerUserIDMap, err := s.GroupInterface.MapGroupOwnerUserID(ctx, groupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -530,15 +530,15 @@ func (s *groupServer) GetGroupsInfo(ctx context.Context, req *pbGroup.GetGroupsI
|
|||||||
if len(req.GroupIDs) == 0 {
|
if len(req.GroupIDs) == 0 {
|
||||||
return nil, constant.ErrArgs.Wrap("groupID is empty")
|
return nil, constant.ErrArgs.Wrap("groupID is empty")
|
||||||
}
|
}
|
||||||
groups, err := s.GroupInterface.FindGroupsByID(ctx, req.GroupIDs)
|
groups, err := s.GroupInterface.FindGroup(ctx, req.GroupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
groupMemberNumMap, err := s.GroupInterface.GetGroupMemberNum(ctx, req.GroupIDs)
|
groupMemberNumMap, err := s.GroupInterface.MapGroupMemberNum(ctx, req.GroupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
groupOwnerUserIDMap, err := s.GroupInterface.GetGroupOwnerUserID(ctx, req.GroupIDs)
|
groupOwnerUserIDMap, err := s.GroupInterface.MapGroupOwnerUserID(ctx, req.GroupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -554,7 +554,7 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup
|
|||||||
return nil, constant.ErrArgs.Wrap("HandleResult unknown")
|
return nil, constant.ErrArgs.Wrap("HandleResult unknown")
|
||||||
}
|
}
|
||||||
if !token_verify.IsAppManagerUid(ctx) {
|
if !token_verify.IsAppManagerUid(ctx) {
|
||||||
groupMember, err := s.GroupInterface.TakeGroupMemberByID(ctx, req.GroupID, req.FromUserID)
|
groupMember, err := s.GroupInterface.TakeGroupMember(ctx, req.GroupID, req.FromUserID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -562,7 +562,7 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup
|
|||||||
return nil, constant.ErrNoPermission.Wrap("no group owner or admin")
|
return nil, constant.ErrNoPermission.Wrap("no group owner or admin")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
group, err := s.GroupInterface.TakeGroupByID(ctx, req.GroupID)
|
group, err := s.GroupInterface.TakeGroup(ctx, req.GroupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -573,7 +573,7 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup
|
|||||||
if groupRequest.HandleResult != 0 {
|
if groupRequest.HandleResult != 0 {
|
||||||
return nil, constant.ErrArgs.Wrap("group request already processed")
|
return nil, constant.ErrArgs.Wrap("group request already processed")
|
||||||
}
|
}
|
||||||
if _, err := s.GroupInterface.TakeGroupMemberByID(ctx, req.GroupID, req.FromUserID); err != nil {
|
if _, err := s.GroupInterface.TakeGroupMember(ctx, req.GroupID, req.FromUserID); err != nil {
|
||||||
if !IsNotFound(err) {
|
if !IsNotFound(err) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -619,7 +619,7 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq)
|
|||||||
if _, err := GetPublicUserInfoOne(ctx, tracelog.GetOpUserID(ctx)); err != nil {
|
if _, err := GetPublicUserInfoOne(ctx, tracelog.GetOpUserID(ctx)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
group, err := s.GroupInterface.TakeGroupByID(ctx, req.GroupID)
|
group, err := s.GroupInterface.TakeGroup(ctx, req.GroupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -665,17 +665,17 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq)
|
|||||||
|
|
||||||
func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq) (*pbGroup.QuitGroupResp, error) {
|
func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq) (*pbGroup.QuitGroupResp, error) {
|
||||||
resp := &pbGroup.QuitGroupResp{}
|
resp := &pbGroup.QuitGroupResp{}
|
||||||
group, err := s.GroupInterface.TakeGroupByID(ctx, req.GroupID)
|
group, err := s.GroupInterface.TakeGroup(ctx, req.GroupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if group.GroupType == constant.SuperGroup {
|
if group.GroupType == constant.SuperGroup {
|
||||||
if err := s.GroupInterface.DelSuperGroupMember(ctx, req.GroupID, []string{tracelog.GetOpUserID(ctx)}); err != nil {
|
if err := s.GroupInterface.DeleteSuperGroupMember(ctx, req.GroupID, []string{tracelog.GetOpUserID(ctx)}); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
chat.SuperGroupNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), tracelog.GetOpUserID(ctx))
|
chat.SuperGroupNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), tracelog.GetOpUserID(ctx))
|
||||||
} else {
|
} else {
|
||||||
_, err := s.GroupInterface.TakeGroupMemberByID(ctx, req.GroupID, tracelog.GetOpUserID(ctx))
|
_, err := s.GroupInterface.TakeGroupMember(ctx, req.GroupID, tracelog.GetOpUserID(ctx))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -687,7 +687,7 @@ func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq)
|
|||||||
func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInfoReq) (*pbGroup.SetGroupInfoResp, error) {
|
func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInfoReq) (*pbGroup.SetGroupInfoResp, error) {
|
||||||
resp := &pbGroup.SetGroupInfoResp{}
|
resp := &pbGroup.SetGroupInfoResp{}
|
||||||
if !token_verify.IsAppManagerUid(ctx) {
|
if !token_verify.IsAppManagerUid(ctx) {
|
||||||
groupMember, err := s.GroupInterface.TakeGroupMemberByID(ctx, req.GroupInfoForSet.GroupID, tracelog.GetOpUserID(ctx))
|
groupMember, err := s.GroupInterface.TakeGroupMember(ctx, req.GroupInfoForSet.GroupID, tracelog.GetOpUserID(ctx))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -695,7 +695,7 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
|
|||||||
return nil, constant.ErrNoPermission.Wrap("no group owner or admin")
|
return nil, constant.ErrNoPermission.Wrap("no group owner or admin")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
group, err := s.TakeGroupByID(ctx, req.GroupInfoForSet.GroupID)
|
group, err := s.TakeGroup(ctx, req.GroupInfoForSet.GroupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -709,7 +709,7 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
|
|||||||
if err := s.GroupInterface.UpdateGroup(ctx, group.GroupID, data); err != nil {
|
if err := s.GroupInterface.UpdateGroup(ctx, group.GroupID, data); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
group, err = s.TakeGroupByID(ctx, req.GroupInfoForSet.GroupID)
|
group, err = s.TakeGroup(ctx, req.GroupInfoForSet.GroupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -722,7 +722,7 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
|
|||||||
|
|
||||||
func (s *groupServer) TransferGroupOwner(ctx context.Context, req *pbGroup.TransferGroupOwnerReq) (*pbGroup.TransferGroupOwnerResp, error) {
|
func (s *groupServer) TransferGroupOwner(ctx context.Context, req *pbGroup.TransferGroupOwnerReq) (*pbGroup.TransferGroupOwnerResp, error) {
|
||||||
resp := &pbGroup.TransferGroupOwnerResp{}
|
resp := &pbGroup.TransferGroupOwnerResp{}
|
||||||
group, err := s.GroupInterface.TakeGroupByID(ctx, req.GroupID)
|
group, err := s.GroupInterface.TakeGroup(ctx, req.GroupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -732,7 +732,7 @@ func (s *groupServer) TransferGroupOwner(ctx context.Context, req *pbGroup.Trans
|
|||||||
if req.OldOwnerUserID == req.NewOwnerUserID {
|
if req.OldOwnerUserID == req.NewOwnerUserID {
|
||||||
return nil, constant.ErrArgs.Wrap("OldOwnerUserID == NewOwnerUserID")
|
return nil, constant.ErrArgs.Wrap("OldOwnerUserID == NewOwnerUserID")
|
||||||
}
|
}
|
||||||
members, err := s.GroupInterface.GetGroupMemberListByUserID(ctx, req.GroupID, []string{req.OldOwnerUserID, req.NewOwnerUserID})
|
members, err := s.GroupInterface.FindGroupMember(ctx, req.GroupID, []string{req.OldOwnerUserID, req.NewOwnerUserID})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -747,7 +747,7 @@ func (s *groupServer) TransferGroupOwner(ctx context.Context, req *pbGroup.Trans
|
|||||||
oldOwner := memberMap[req.OldOwnerUserID]
|
oldOwner := memberMap[req.OldOwnerUserID]
|
||||||
if token_verify.IsAppManagerUid(ctx) {
|
if token_verify.IsAppManagerUid(ctx) {
|
||||||
if oldOwner == nil {
|
if oldOwner == nil {
|
||||||
oldOwner, err = s.GroupInterface.GetGroupOwnerUser(ctx, req.OldOwnerUserID)
|
oldOwner, err = s.GroupInterface.TakeGroupOwner(ctx, req.OldOwnerUserID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -774,10 +774,10 @@ func (s *groupServer) GetGroups(ctx context.Context, req *pbGroup.GetGroupsReq)
|
|||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
if req.GroupID != "" {
|
if req.GroupID != "" {
|
||||||
groups, err = s.GroupInterface.FindGroupsByID(ctx, []string{req.GroupID})
|
groups, err = s.GroupInterface.FindGroup(ctx, []string{req.GroupID})
|
||||||
resp.GroupNum = int32(len(groups))
|
resp.GroupNum = int32(len(groups))
|
||||||
} else {
|
} else {
|
||||||
resp.GroupNum, groups, err = s.GroupInterface.FindSearchGroup(ctx, req.GroupName, req.Pagination.PageNumber, req.Pagination.ShowNumber)
|
resp.GroupNum, groups, err = s.GroupInterface.SearchGroup(ctx, req.GroupName, req.Pagination.PageNumber, req.Pagination.ShowNumber)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -795,7 +795,7 @@ func (s *groupServer) GetGroups(ctx context.Context, req *pbGroup.GetGroupsReq)
|
|||||||
if ids := utils.Single(groupIDs, utils.Keys(ownerMemberMap)); len(ids) > 0 {
|
if ids := utils.Single(groupIDs, utils.Keys(ownerMemberMap)); len(ids) > 0 {
|
||||||
return nil, constant.ErrDB.Wrap("group not owner " + strings.Join(ids, ","))
|
return nil, constant.ErrDB.Wrap("group not owner " + strings.Join(ids, ","))
|
||||||
}
|
}
|
||||||
groupMemberNumMap, err := s.GroupInterface.GetGroupMemberNum(ctx, groupIDs)
|
groupMemberNumMap, err := s.GroupInterface.MapGroupMemberNum(ctx, groupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -808,7 +808,7 @@ func (s *groupServer) GetGroups(ctx context.Context, req *pbGroup.GetGroupsReq)
|
|||||||
|
|
||||||
func (s *groupServer) GetGroupMembersCMS(ctx context.Context, req *pbGroup.GetGroupMembersCMSReq) (*pbGroup.GetGroupMembersCMSResp, error) {
|
func (s *groupServer) GetGroupMembersCMS(ctx context.Context, req *pbGroup.GetGroupMembersCMSReq) (*pbGroup.GetGroupMembersCMSResp, error) {
|
||||||
resp := &pbGroup.GetGroupMembersCMSResp{}
|
resp := &pbGroup.GetGroupMembersCMSResp{}
|
||||||
total, members, err := s.GroupInterface.FindSearchGroupMember(ctx, req.GroupID, req.UserName, req.Pagination.PageNumber, req.Pagination.ShowNumber)
|
total, members, err := s.GroupInterface.SearchGroupMember(ctx, req.GroupID, req.UserName, req.Pagination.PageNumber, req.Pagination.ShowNumber)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -836,7 +836,7 @@ func (s *groupServer) GetUserReqApplicationList(ctx context.Context, req *pbGrou
|
|||||||
groupIDs := utils.Distinct(utils.Slice(requests, func(e *relation2.GroupRequestModel) string {
|
groupIDs := utils.Distinct(utils.Slice(requests, func(e *relation2.GroupRequestModel) string {
|
||||||
return e.GroupID
|
return e.GroupID
|
||||||
}))
|
}))
|
||||||
groups, err := s.GroupInterface.FindGroupsByID(ctx, groupIDs)
|
groups, err := s.GroupInterface.FindGroup(ctx, groupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -856,7 +856,7 @@ func (s *groupServer) GetUserReqApplicationList(ctx context.Context, req *pbGrou
|
|||||||
if ids := utils.Single(groupIDs, utils.Keys(ownerMap)); len(ids) > 0 {
|
if ids := utils.Single(groupIDs, utils.Keys(ownerMap)); len(ids) > 0 {
|
||||||
return nil, constant.ErrData.Wrap("group no owner", strings.Join(ids, ","))
|
return nil, constant.ErrData.Wrap("group no owner", strings.Join(ids, ","))
|
||||||
}
|
}
|
||||||
groupMemberNum, err := s.GroupInterface.GetGroupMemberNum(ctx, groupIDs)
|
groupMemberNum, err := s.GroupInterface.MapGroupMemberNum(ctx, groupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -871,7 +871,7 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou
|
|||||||
if err := s.CheckGroupAdmin(ctx, req.GroupID); err != nil {
|
if err := s.CheckGroupAdmin(ctx, req.GroupID); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
group, err := s.GroupInterface.TakeGroupByID(ctx, req.GroupID)
|
group, err := s.GroupInterface.TakeGroup(ctx, req.GroupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -893,12 +893,12 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou
|
|||||||
|
|
||||||
func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGroupMemberReq) (*pbGroup.MuteGroupMemberResp, error) {
|
func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGroupMemberReq) (*pbGroup.MuteGroupMemberResp, error) {
|
||||||
resp := &pbGroup.MuteGroupMemberResp{}
|
resp := &pbGroup.MuteGroupMemberResp{}
|
||||||
member, err := s.GroupInterface.TakeGroupMemberByID(ctx, req.GroupID, req.UserID)
|
member, err := s.GroupInterface.TakeGroupMember(ctx, req.GroupID, req.UserID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if !(tracelog.GetOpUserID(ctx) == req.UserID || token_verify.IsAppManagerUid(ctx)) {
|
if !(tracelog.GetOpUserID(ctx) == req.UserID || token_verify.IsAppManagerUid(ctx)) {
|
||||||
opMember, err := s.GroupInterface.TakeGroupMemberByID(ctx, req.GroupID, req.UserID)
|
opMember, err := s.GroupInterface.TakeGroupMember(ctx, req.GroupID, req.UserID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -916,12 +916,12 @@ func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGrou
|
|||||||
|
|
||||||
func (s *groupServer) CancelMuteGroupMember(ctx context.Context, req *pbGroup.CancelMuteGroupMemberReq) (*pbGroup.CancelMuteGroupMemberResp, error) {
|
func (s *groupServer) CancelMuteGroupMember(ctx context.Context, req *pbGroup.CancelMuteGroupMemberReq) (*pbGroup.CancelMuteGroupMemberResp, error) {
|
||||||
resp := &pbGroup.CancelMuteGroupMemberResp{}
|
resp := &pbGroup.CancelMuteGroupMemberResp{}
|
||||||
member, err := s.GroupInterface.TakeGroupMemberByID(ctx, req.GroupID, req.UserID)
|
member, err := s.GroupInterface.TakeGroupMember(ctx, req.GroupID, req.UserID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if !(tracelog.GetOpUserID(ctx) == req.UserID || token_verify.IsAppManagerUid(ctx)) {
|
if !(tracelog.GetOpUserID(ctx) == req.UserID || token_verify.IsAppManagerUid(ctx)) {
|
||||||
opMember, err := s.GroupInterface.TakeGroupMemberByID(ctx, req.GroupID, tracelog.GetOpUserID(ctx))
|
opMember, err := s.GroupInterface.TakeGroupMember(ctx, req.GroupID, tracelog.GetOpUserID(ctx))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -974,14 +974,14 @@ func (s *groupServer) SetGroupMemberInfo(ctx context.Context, req *pbGroup.SetGr
|
|||||||
if req.RoleLevel != nil && req.RoleLevel.Value == constant.GroupOwner {
|
if req.RoleLevel != nil && req.RoleLevel.Value == constant.GroupOwner {
|
||||||
return nil, constant.ErrNoPermission.Wrap("set group owner")
|
return nil, constant.ErrNoPermission.Wrap("set group owner")
|
||||||
}
|
}
|
||||||
group, err := s.GroupInterface.TakeGroupByID(ctx, req.GroupID)
|
group, err := s.GroupInterface.TakeGroup(ctx, req.GroupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if group.Status == constant.GroupStatusDismissed {
|
if group.Status == constant.GroupStatusDismissed {
|
||||||
return nil, constant.ErrArgs.Wrap("group status is dismissed")
|
return nil, constant.ErrArgs.Wrap("group status is dismissed")
|
||||||
}
|
}
|
||||||
member, err := s.GroupInterface.TakeGroupMemberByID(ctx, req.GroupID, req.UserID)
|
member, err := s.GroupInterface.TakeGroupMember(ctx, req.GroupID, req.UserID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -990,7 +990,7 @@ func (s *groupServer) SetGroupMemberInfo(ctx context.Context, req *pbGroup.SetGr
|
|||||||
return nil, constant.ErrArgs.Wrap("update role level")
|
return nil, constant.ErrArgs.Wrap("update role level")
|
||||||
}
|
}
|
||||||
} else if !token_verify.IsAppManagerUid(ctx) {
|
} else if !token_verify.IsAppManagerUid(ctx) {
|
||||||
opMember, err := s.GroupInterface.TakeGroupMemberByID(ctx, req.GroupID, tracelog.GetOpUserID(ctx))
|
opMember, err := s.GroupInterface.TakeGroupMember(ctx, req.GroupID, tracelog.GetOpUserID(ctx))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -1016,15 +1016,15 @@ func (s *groupServer) GetGroupAbstractInfo(ctx context.Context, req *pbGroup.Get
|
|||||||
if utils.Duplicate(req.GroupIDs) {
|
if utils.Duplicate(req.GroupIDs) {
|
||||||
return nil, constant.ErrArgs.Wrap("groupIDs duplicate")
|
return nil, constant.ErrArgs.Wrap("groupIDs duplicate")
|
||||||
}
|
}
|
||||||
groups, err := s.GroupInterface.FindGroupsByID(ctx, req.GroupIDs)
|
groups, err := s.GroupInterface.FindGroup(ctx, req.GroupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
numMap, err := s.GroupInterface.GetGroupMemberNum(ctx, req.GroupIDs)
|
numMap, err := s.GroupInterface.MapGroupMemberNum(ctx, req.GroupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
hashMap, err := s.GroupInterface.GetGroupHash(ctx, req.GroupIDs)
|
hashMap, err := s.GroupInterface.MapGroupHash(ctx, req.GroupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -1039,7 +1039,7 @@ func (s *groupServer) GetUserInGroupMembers(ctx context.Context, req *pbGroup.Ge
|
|||||||
if len(req.GroupIDs) == 0 {
|
if len(req.GroupIDs) == 0 {
|
||||||
return nil, constant.ErrArgs.Wrap("groupIDs empty")
|
return nil, constant.ErrArgs.Wrap("groupIDs empty")
|
||||||
}
|
}
|
||||||
members, err := s.GroupInterface.FindUserInGroup(ctx, req.UserID, req.GroupIDs)
|
members, err := s.GroupInterface.FindGroupMemberByUserID(ctx, req.UserID, req.GroupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
func (s *groupServer) GetJoinedSuperGroupList(ctx context.Context, req *pbGroup.GetJoinedSuperGroupListReq) (*pbGroup.GetJoinedSuperGroupListResp, error) {
|
func (s *groupServer) GetJoinedSuperGroupList(ctx context.Context, req *pbGroup.GetJoinedSuperGroupListReq) (*pbGroup.GetJoinedSuperGroupListResp, error) {
|
||||||
resp := &pbGroup.GetJoinedSuperGroupListResp{}
|
resp := &pbGroup.GetJoinedSuperGroupListResp{}
|
||||||
total, groupIDs, err := s.GroupInterface.GetJoinSuperGroupByID(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber)
|
total, groupIDs, err := s.GroupInterface.FindJoinSuperGroup(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -19,15 +19,15 @@ func (s *groupServer) GetJoinedSuperGroupList(ctx context.Context, req *pbGroup.
|
|||||||
if len(groupIDs) == 0 {
|
if len(groupIDs) == 0 {
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
numMap, err := s.GroupInterface.GetSuperGroupMemberNum(ctx, groupIDs)
|
numMap, err := s.GroupInterface.MapSuperGroupMemberNum(ctx, groupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ownerIdMap, err := s.GroupInterface.GetGroupOwnerUserID(ctx, groupIDs)
|
ownerIdMap, err := s.GroupInterface.MapGroupOwnerUserID(ctx, groupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
groups, err := s.GroupInterface.FindGroupsByID(ctx, groupIDs)
|
groups, err := s.GroupInterface.FindGroup(ctx, groupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -45,15 +45,15 @@ func (s *groupServer) GetSuperGroupsInfo(ctx context.Context, req *pbGroup.GetSu
|
|||||||
if len(req.GroupIDs) == 0 {
|
if len(req.GroupIDs) == 0 {
|
||||||
return nil, constant.ErrArgs.Wrap("groupIDs empty")
|
return nil, constant.ErrArgs.Wrap("groupIDs empty")
|
||||||
}
|
}
|
||||||
groups, err := s.GroupInterface.FindGroupsByID(ctx, req.GroupIDs)
|
groups, err := s.GroupInterface.FindGroup(ctx, req.GroupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
numMap, err := s.GroupInterface.GetSuperGroupMemberNum(ctx, req.GroupIDs)
|
numMap, err := s.GroupInterface.MapSuperGroupMemberNum(ctx, req.GroupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ownerIdMap, err := s.GroupInterface.GetGroupOwnerUserID(ctx, req.GroupIDs)
|
ownerIdMap, err := s.GroupInterface.MapGroupOwnerUserID(ctx, req.GroupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -15,46 +15,44 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type GroupInterface interface {
|
type GroupInterface interface {
|
||||||
FindGroupsByID(ctx context.Context, groupIDs []string) (groups []*relation2.GroupModel, err error)
|
// group
|
||||||
FindSearchGroup(ctx context.Context, name string, pageNumber, showNumber int32) (int32, []*relation2.GroupModel, error)
|
FindGroup(ctx context.Context, groupIDs []string) (groups []*relation2.GroupModel, err error)
|
||||||
CreateGroup(ctx context.Context, groups []*relation2.GroupModel, groupMember []*relation2.GroupMemberModel) error
|
SearchGroup(ctx context.Context, name string, pageNumber, showNumber int32) (int32, []*relation2.GroupModel, error)
|
||||||
DeleteGroupByIDs(ctx context.Context, groupIDs []string) error
|
TakeGroup(ctx context.Context, groupID string) (group *relation2.GroupModel, err error)
|
||||||
TakeGroupByID(ctx context.Context, groupID string) (group *relation2.GroupModel, err error)
|
FindJoinedGroup(ctx context.Context, userID string, pageNumber, showNumber int32) ([]*relation2.GroupModel, error)
|
||||||
TakeGroupMemberByID(ctx context.Context, groupID string, userID string) (groupMember *relation2.GroupMemberModel, err error)
|
|
||||||
GetJoinedGroupList(ctx context.Context, userID string) ([]*relation2.GroupModel, error)
|
|
||||||
GetGroupMemberList(ctx context.Context, groupID string) ([]*relation2.GroupMemberModel, error)
|
|
||||||
GetGroupMemberListByUserID(ctx context.Context, groupID string, userIDs []string) ([]*relation2.GroupMemberModel, error)
|
|
||||||
GetGroupMemberFilterList(ctx context.Context, groupID string, filter int32, begin int32, maxNumber int32) ([]*relation2.GroupMemberModel, error) // relation.GetGroupMemberByGroupID(req.GroupID, req.Filter, req.NextSeq, 30)
|
|
||||||
FindGroupMembersByID(ctx context.Context, groupID string, userIDs []string) (groups []*relation2.GroupMemberModel, err error)
|
|
||||||
FindUserInGroup(ctx context.Context, groupID string, userIDs []string) ([]*relation2.GroupMemberModel, error)
|
|
||||||
DelGroupMember(ctx context.Context, groupID string, userIDs []string) error
|
|
||||||
GetGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]int, error)
|
|
||||||
GetGroupHash(ctx context.Context, groupIDs []string) (map[string]uint64, error)
|
|
||||||
GetGroupOwnerUserID(ctx context.Context, groupIDs []string) (map[string]string, error)
|
|
||||||
GetGroupOwnerUser(ctx context.Context, groupID string) (*relation2.GroupMemberModel, error)
|
|
||||||
FindGroupOwnerUser(ctx context.Context, groupID []string) ([]*relation2.GroupMemberModel, error)
|
|
||||||
TransferGroupOwner(ctx context.Context, groupID string, oldOwnerUserID, newOwnerUserID string) error
|
|
||||||
FindSearchGroupMember(ctx context.Context, groupID, name string, pageNumber, showNumber int32) (int32, []*relation2.GroupMemberModel, error)
|
|
||||||
GetGroupRecvApplicationList(ctx context.Context, userID string) ([]*relation2.GroupRequestModel, error)
|
|
||||||
UpdateGroup(ctx context.Context, groupID string, data map[string]any) error
|
UpdateGroup(ctx context.Context, groupID string, data map[string]any) error
|
||||||
|
DismissGroup(ctx context.Context, groupID string) error // 解散群,并删除群成员
|
||||||
|
// groupMember
|
||||||
|
CreateGroup(ctx context.Context, groups []*relation2.GroupModel, groupMember []*relation2.GroupMemberModel) error
|
||||||
|
TakeGroupMember(ctx context.Context, groupID string, userID string) (groupMember *relation2.GroupMemberModel, err error)
|
||||||
|
FindGroupMember(ctx context.Context, groupID string, userIDs []string) ([]*relation2.GroupMemberModel, error)
|
||||||
|
FindGroupMemberAll(ctx context.Context, groupID string) ([]*relation2.GroupMemberModel, error)
|
||||||
|
FindGroupMemberFilterList(ctx context.Context, groupID string, filter int32, begin int32, maxNumber int32) ([]*relation2.GroupMemberModel, error) // relation.GetGroupMemberByGroupID(req.GroupID, req.Filter, req.NextSeq, 30)
|
||||||
|
SearchGroupMember(ctx context.Context, groupID, name string, pageNumber, showNumber int32) (int32, []*relation2.GroupMemberModel, error)
|
||||||
|
FindGroupMemberByUserID(ctx context.Context, groupID string, userIDs []string) ([]*relation2.GroupMemberModel, error)
|
||||||
|
TakeGroupOwner(ctx context.Context, groupID string) (*relation2.GroupMemberModel, error)
|
||||||
|
FindGroupOwnerUser(ctx context.Context, groupID []string) ([]*relation2.GroupMemberModel, error)
|
||||||
|
CreateGroupMember(ctx context.Context, groupMember []*relation2.GroupMemberModel) error
|
||||||
|
HandlerGroupRequest(ctx context.Context, groupID string, userID string, handledMsg string, handleResult int32, member *relation2.GroupMemberModel) error
|
||||||
|
DeleteGroupMember(ctx context.Context, groupID string, userIDs []string) error
|
||||||
|
MapGroupHash(ctx context.Context, groupIDs []string) (map[string]uint64, error)
|
||||||
|
MapGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]int, error)
|
||||||
|
MapGroupOwnerUserID(ctx context.Context, groupIDs []string) (map[string]string, error)
|
||||||
|
TransferGroupOwner(ctx context.Context, groupID string, oldOwnerUserID, newOwnerUserID string) error // 转让群
|
||||||
UpdateGroupMember(ctx context.Context, groupID, userID string, data map[string]any) error
|
UpdateGroupMember(ctx context.Context, groupID, userID string, data map[string]any) error
|
||||||
|
|
||||||
CreateGroupMember(ctx context.Context, groupMember []*relation2.GroupMemberModel) error
|
|
||||||
CreateGroupRequest(ctx context.Context, requests []*relation2.GroupRequestModel) error
|
CreateGroupRequest(ctx context.Context, requests []*relation2.GroupRequestModel) error
|
||||||
DismissGroup(ctx context.Context, groupID string) error // 设置状态,并清楚群成员
|
GetGroupRecvApplicationList(ctx context.Context, userID string) ([]*relation2.GroupRequestModel, error) // ?
|
||||||
|
|
||||||
HandlerGroupRequest(ctx context.Context, groupID string, userID string, handledMsg string, handleResult int32, member *relation2.GroupMemberModel) error
|
|
||||||
TakeGroupRequest(ctx context.Context, groupID string, userID string) (*relation2.GroupRequestModel, error)
|
TakeGroupRequest(ctx context.Context, groupID string, userID string) (*relation2.GroupRequestModel, error)
|
||||||
FindUserGroupRequest(ctx context.Context, userID string, pageNumber, showNumber int32) (int32, []*relation2.GroupRequestModel, error)
|
FindUserGroupRequest(ctx context.Context, userID string, pageNumber, showNumber int32) (int32, []*relation2.GroupRequestModel, error)
|
||||||
|
// superGroup
|
||||||
//mongo
|
TakeSuperGroup(ctx context.Context, groupID string) (superGroup *unrelation2.SuperGroupModel, err error)
|
||||||
CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error
|
CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error
|
||||||
DeleteSuperGroup(ctx context.Context, groupID string) error
|
DeleteSuperGroup(ctx context.Context, groupID string) error
|
||||||
DelSuperGroupMember(ctx context.Context, groupID string, userIDs []string) error
|
DeleteSuperGroupMember(ctx context.Context, groupID string, userIDs []string) error
|
||||||
AddUserToSuperGroup(ctx context.Context, groupID string, userIDs []string) error
|
AddUserToSuperGroup(ctx context.Context, groupID string, userIDs []string) error
|
||||||
GetSuperGroupByID(ctx context.Context, groupID string) (superGroup *unrelation2.SuperGroupModel, err error)
|
FindJoinSuperGroup(ctx context.Context, userID string, pageNumber, showNumber int32) (total int32, groupIDs []string, err error)
|
||||||
GetJoinSuperGroupByID(ctx context.Context, userID string, pageNumber, showNumber int32) (total int32, groupIDs []string, err error)
|
MapSuperGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]uint32, error)
|
||||||
GetSuperGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]uint32, error)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ GroupInterface = (*GroupController)(nil)
|
var _ GroupInterface = (*GroupController)(nil)
|
||||||
@ -63,82 +61,122 @@ type GroupController struct {
|
|||||||
database GroupDataBaseInterface
|
database GroupDataBaseInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupController) TakeGroupMemberByID(ctx context.Context, groupID string, userID string) (groupMember *relation2.GroupModel, err error) {
|
func (g *GroupController) FindGroup(ctx context.Context, groupIDs []string) (groups []*relation2.GroupModel, err error) {
|
||||||
//TODO implement me
|
//TODO implement me
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupController) FindGroupMembersByID(ctx context.Context, groupID string, userIDs []string) (groups []*relation2.GroupModel, err error) {
|
func (g *GroupController) SearchGroup(ctx context.Context, name string, pageNumber, showNumber int32) (int32, []*relation2.GroupModel, error) {
|
||||||
//TODO implement me
|
//TODO implement me
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupController) DelGroupMember(ctx context.Context, groupID string, userIDs []string) error {
|
func (g *GroupController) TakeGroup(ctx context.Context, groupID string) (group *relation2.GroupModel, err error) {
|
||||||
//TODO implement me
|
//TODO implement me
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupController) GetGroupRecvApplicationList(ctx context.Context, userID string) ([]*relation2.GroupRequestModel, error) {
|
func (g *GroupController) FindJoinedGroup(ctx context.Context, userID string, pageNumber, showNumber int32) ([]*relation2.GroupModel, 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
|
//TODO implement me
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupController) DelSuperGroupMember(ctx context.Context, groupID string, userIDs []string) error {
|
func (g *GroupController) UpdateGroup(ctx context.Context, groupID string, data map[string]any) error {
|
||||||
//TODO implement me
|
//TODO implement me
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupController) GetJoinedGroupList(ctx context.Context, userID string) ([]*relation2.GroupModel, error) {
|
func (g *GroupController) DismissGroup(ctx context.Context, groupID string) error {
|
||||||
//TODO implement me
|
//TODO implement me
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupController) GetGroupMemberList(ctx context.Context, groupID string) ([]*relation2.GroupModel, error) {
|
func (g *GroupController) CreateGroup(ctx context.Context, groups []*relation2.GroupModel, groupMember []*relation2.GroupMemberModel) error {
|
||||||
//TODO implement me
|
//TODO implement me
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupController) GetGroupMemberListByUserID(ctx context.Context, groupID string, userIDs []string) ([]*relation2.GroupModel, error) {
|
func (g *GroupController) TakeGroupMember(ctx context.Context, groupID string, userID string) (groupMember *relation2.GroupMemberModel, err error) {
|
||||||
//TODO implement me
|
//TODO implement me
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupController) GetGroupMemberFilterList(ctx context.Context, groupID string, filter int32, begin int32, maxNumber int32) ([]*relation2.GroupModel, error) {
|
func (g *GroupController) FindGroupMember(ctx context.Context, groupID string, userIDs []string) ([]*relation2.GroupMemberModel, error) {
|
||||||
//TODO implement me
|
//TODO implement me
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupController) GetGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]int, error) {
|
func (g *GroupController) FindGroupMemberAll(ctx context.Context, groupID string) ([]*relation2.GroupMemberModel, error) {
|
||||||
//TODO implement me
|
//TODO implement me
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupController) GetGroupOwnerUserID(ctx context.Context, groupIDs []string) (map[string]string, error) {
|
func (g *GroupController) FindGroupMemberFilterList(ctx context.Context, groupID string, filter int32, begin int32, maxNumber int32) ([]*relation2.GroupMemberModel, error) {
|
||||||
//TODO implement me
|
//TODO implement me
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupController) CreateGroupMember(ctx context.Context, groupMember []*relation2.GroupModel) error {
|
func (g *GroupController) FindGroupMembersByID(ctx context.Context, groupID string, userIDs []string) (groups []*relation2.GroupMemberModel, err error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupController) SearchGroupMember(ctx context.Context, groupID, name string, pageNumber, showNumber int32) (int32, []*relation2.GroupMemberModel, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupController) FindGroupMemberByUserID(ctx context.Context, groupID string, userIDs []string) ([]*relation2.GroupMemberModel, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupController) TakeGroupOwner(ctx context.Context, groupID string) (*relation2.GroupMemberModel, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupController) FindGroupOwnerUser(ctx context.Context, groupID []string) ([]*relation2.GroupMemberModel, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupController) CreateGroupMember(ctx context.Context, groupMember []*relation2.GroupMemberModel) error {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupController) HandlerGroupRequest(ctx context.Context, groupID string, userID string, handledMsg string, handleResult int32, member *relation2.GroupMemberModel) error {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupController) DeleteGroupMember(ctx context.Context, groupID string, userIDs []string) error {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupController) MapGroupHash(ctx context.Context, groupIDs []string) (map[string]uint64, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupController) MapGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]int, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupController) MapGroupOwnerUserID(ctx context.Context, groupIDs []string) (map[string]string, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupController) TransferGroupOwner(ctx context.Context, groupID string, oldOwnerUserID, newOwnerUserID string) error {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupController) UpdateGroupMember(ctx context.Context, groupID, userID string, data map[string]any) error {
|
||||||
//TODO implement me
|
//TODO implement me
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
@ -148,49 +186,99 @@ func (g *GroupController) CreateGroupRequest(ctx context.Context, requests []*re
|
|||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *GroupController) GetGroupRecvApplicationList(ctx context.Context, userID string) ([]*relation2.GroupRequestModel, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupController) TakeGroupRequest(ctx context.Context, groupID string, userID string) (*relation2.GroupRequestModel, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupController) FindUserGroupRequest(ctx context.Context, userID string, pageNumber, showNumber int32) (int32, []*relation2.GroupRequestModel, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupController) TakeSuperGroup(ctx context.Context, groupID string) (superGroup *unrelation2.SuperGroupModel, err error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupController) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupController) DeleteSuperGroup(ctx context.Context, groupID string) error {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupController) DeleteSuperGroupMember(ctx context.Context, groupID string, userIDs []string) error {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
func (g *GroupController) AddUserToSuperGroup(ctx context.Context, groupID string, userIDs []string) error {
|
func (g *GroupController) AddUserToSuperGroup(ctx context.Context, groupID string, userIDs []string) error {
|
||||||
//TODO implement me
|
//TODO implement me
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGroupController(db *gorm.DB, rdb redis.UniversalClient, mgoClient *mongo.Client) GroupInterface {
|
func (g *GroupController) FindJoinSuperGroup(ctx context.Context, userID string, pageNumber, showNumber int32) (total int32, groupIDs []string, err error) {
|
||||||
groupController := &GroupController{database: newGroupDatabase(db, rdb, mgoClient)}
|
//TODO implement me
|
||||||
return groupController
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupController) FindGroupsByID(ctx context.Context, groupIDs []string) (groups []*relation2.GroupModel, err error) {
|
func (g *GroupController) MapSuperGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]uint32, error) {
|
||||||
return g.database.FindGroupsByID(ctx, groupIDs)
|
//TODO implement me
|
||||||
}
|
panic("implement me")
|
||||||
|
|
||||||
func (g *GroupController) CreateGroup(ctx context.Context, groups []*relation2.GroupModel, groupMember []*relation2.GroupModel) error {
|
|
||||||
return g.database.CreateGroup(ctx, groups, groupMember)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *GroupController) DeleteGroupByIDs(ctx context.Context, groupIDs []string) error {
|
|
||||||
return g.database.DeleteGroupByIDs(ctx, groupIDs)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *GroupController) TakeGroupByID(ctx context.Context, groupID string) (group *relation2.GroupModel, err error) {
|
|
||||||
return g.database.TakeGroupByID(ctx, groupID)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *GroupController) GetSuperGroupByID(ctx context.Context, groupID string) (superGroup *unrelation.SuperGroup, err error) {
|
|
||||||
return g.database.GetSuperGroupByID(ctx, groupID)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *GroupController) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error {
|
|
||||||
return g.database.CreateSuperGroup(ctx, groupID, initMemberIDList)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type GroupDataBaseInterface interface {
|
type GroupDataBaseInterface interface {
|
||||||
FindGroupsByID(ctx context.Context, groupIDs []string) (groups []*relation2.GroupModel, err error)
|
// group
|
||||||
CreateGroup(ctx context.Context, groups []*relation2.GroupModel, groupMember []*relation2.GroupModel) error
|
FindGroup(ctx context.Context, groupIDs []string) (groups []*relation2.GroupModel, err error)
|
||||||
DeleteGroupByIDs(ctx context.Context, groupIDs []string) error
|
SearchGroup(ctx context.Context, name string, pageNumber, showNumber int32) (int32, []*relation2.GroupModel, error)
|
||||||
TakeGroupByID(ctx context.Context, groupID string) (group *relation2.GroupModel, err error)
|
TakeGroup(ctx context.Context, groupID string) (group *relation2.GroupModel, err error)
|
||||||
GetSuperGroupByID(ctx context.Context, groupID string) (superGroup *unrelation.SuperGroup, err error)
|
FindJoinedGroup(ctx context.Context, userID string, pageNumber, showNumber int32) ([]*relation2.GroupModel, error)
|
||||||
|
UpdateGroup(ctx context.Context, groupID string, data map[string]any) error
|
||||||
|
DismissGroup(ctx context.Context, groupID string) error // 解散群,并删除群成员
|
||||||
|
// groupMember
|
||||||
|
CreateGroup(ctx context.Context, groups []*relation2.GroupModel, groupMember []*relation2.GroupMemberModel) error
|
||||||
|
TakeGroupMember(ctx context.Context, groupID string, userID string) (groupMember *relation2.GroupMemberModel, err error)
|
||||||
|
FindGroupMember(ctx context.Context, groupID string, userIDs []string) ([]*relation2.GroupMemberModel, error)
|
||||||
|
FindGroupMemberAll(ctx context.Context, groupID string) ([]*relation2.GroupMemberModel, error)
|
||||||
|
FindGroupMemberFilterList(ctx context.Context, groupID string, filter int32, begin int32, maxNumber int32) ([]*relation2.GroupMemberModel, error) // relation.GetGroupMemberByGroupID(req.GroupID, req.Filter, req.NextSeq, 30)
|
||||||
|
SearchGroupMember(ctx context.Context, groupID, name string, pageNumber, showNumber int32) (int32, []*relation2.GroupMemberModel, error)
|
||||||
|
FindGroupMemberByUserID(ctx context.Context, groupID string, userIDs []string) ([]*relation2.GroupMemberModel, error)
|
||||||
|
TakeGroupOwner(ctx context.Context, groupID string) (*relation2.GroupMemberModel, error)
|
||||||
|
FindGroupOwnerUser(ctx context.Context, groupID []string) ([]*relation2.GroupMemberModel, error)
|
||||||
|
CreateGroupMember(ctx context.Context, groupMember []*relation2.GroupMemberModel) error
|
||||||
|
HandlerGroupRequest(ctx context.Context, groupID string, userID string, handledMsg string, handleResult int32, member *relation2.GroupMemberModel) error
|
||||||
|
DeleteGroupMember(ctx context.Context, groupID string, userIDs []string) error
|
||||||
|
MapGroupHash(ctx context.Context, groupIDs []string) (map[string]uint64, error)
|
||||||
|
MapGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]int, error)
|
||||||
|
MapGroupOwnerUserID(ctx context.Context, groupIDs []string) (map[string]string, error)
|
||||||
|
TransferGroupOwner(ctx context.Context, groupID string, oldOwnerUserID, newOwnerUserID string) error // 转让群
|
||||||
|
UpdateGroupMember(ctx context.Context, groupID, userID string, data map[string]any) error
|
||||||
|
|
||||||
|
CreateGroupRequest(ctx context.Context, requests []*relation2.GroupRequestModel) error
|
||||||
|
GetGroupRecvApplicationList(ctx context.Context, userID string) ([]*relation2.GroupRequestModel, error) // ?
|
||||||
|
TakeGroupRequest(ctx context.Context, groupID string, userID string) (*relation2.GroupRequestModel, error)
|
||||||
|
FindUserGroupRequest(ctx context.Context, userID string, pageNumber, showNumber int32) (int32, []*relation2.GroupRequestModel, error)
|
||||||
|
// superGroup
|
||||||
|
TakeSuperGroup(ctx context.Context, groupID string) (superGroup *unrelation2.SuperGroupModel, err error)
|
||||||
CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error
|
CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error
|
||||||
|
DeleteSuperGroup(ctx context.Context, groupID string) error
|
||||||
|
DeleteSuperGroupMember(ctx context.Context, groupID string, userIDs []string) error
|
||||||
|
AddUserToSuperGroup(ctx context.Context, groupID string, userIDs []string) error
|
||||||
|
FindJoinSuperGroup(ctx context.Context, userID string, pageNumber, showNumber int32) (total int32, groupIDs []string, err error)
|
||||||
|
MapSuperGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]uint32, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ *GroupDataBase = (GroupDataBaseInterface)(nil)
|
||||||
|
|
||||||
type GroupDataBase struct {
|
type GroupDataBase struct {
|
||||||
groupDB *relation.GroupGorm
|
groupDB *relation.GroupGorm
|
||||||
groupMemberDB *relation.GroupMemberGorm
|
groupMemberDB *relation.GroupMemberGorm
|
||||||
@ -223,82 +311,257 @@ func newGroupDatabase(db *gorm.DB, rdb redis.UniversalClient, mgoClient *mongo.C
|
|||||||
return database
|
return database
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupDataBase) FindGroupsByID(ctx context.Context, groupIDs []string) (groups []*relation2.GroupModel, err error) {
|
//func (g *GroupDataBase) FindGroupsByID(ctx context.Context, groupIDs []string) (groups []*relation2.GroupModel, err error) {
|
||||||
return g.cache.GetGroupsInfo(ctx, groupIDs)
|
// return g.cache.GetGroupsInfo(ctx, groupIDs)
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//func (g *GroupDataBase) CreateGroup(ctx context.Context, groups []*relation2.GroupModel, groupMembers []*relation2.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 {
|
||||||
|
// return err
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if len(groupMembers) > 0 {
|
||||||
|
// if err := g.groupMemberDB.Create(ctx, groupMembers, tx); err != nil {
|
||||||
|
// return err
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return nil
|
||||||
|
// })
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//func (g *GroupDataBase) DeleteGroupByIDs(ctx context.Context, groupIDs []string) error {
|
||||||
|
// return g.groupDB.DB.Transaction(func(tx *gorm.DB) error {
|
||||||
|
// if err := g.groupDB.Delete(ctx, groupIDs, tx); err != nil {
|
||||||
|
// return err
|
||||||
|
// }
|
||||||
|
// if err := g.cache.DelGroupsInfo(ctx, groupIDs); err != nil {
|
||||||
|
// return err
|
||||||
|
// }
|
||||||
|
// return nil
|
||||||
|
// })
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//func (g *GroupDataBase) TakeGroupByID(ctx context.Context, groupID string) (group *relation2.GroupModel, err error) {
|
||||||
|
// return g.cache.GetGroupInfo(ctx, groupID)
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//func (g *GroupDataBase) Update(ctx context.Context, groups []*relation2.GroupModel) error {
|
||||||
|
// return g.db.Transaction(func(tx *gorm.DB) error {
|
||||||
|
// if err := g.groupDB.Update(ctx, groups, tx); err != nil {
|
||||||
|
// return err
|
||||||
|
// }
|
||||||
|
// var groupIDs []string
|
||||||
|
// for _, group := range groups {
|
||||||
|
// groupIDs = append(groupIDs, group.GroupID)
|
||||||
|
// }
|
||||||
|
// if err := g.cache.DelGroupsInfo(ctx, groupIDs); err != nil {
|
||||||
|
// return err
|
||||||
|
// }
|
||||||
|
// return nil
|
||||||
|
// })
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//func (g *GroupDataBase) GetJoinedGroupList(ctx context.Context, userID string) ([]*relation2.GroupModel, error) {
|
||||||
|
//
|
||||||
|
// return nil, nil
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//func (g *GroupDataBase) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error {
|
||||||
|
// sess, err := g.mongoDB.MgoClient.StartSession()
|
||||||
|
// if err != nil {
|
||||||
|
// return err
|
||||||
|
// }
|
||||||
|
// defer sess.EndSession(ctx)
|
||||||
|
// sCtx := mongo.NewSessionContext(ctx, sess)
|
||||||
|
// if err = g.mongoDB.CreateSuperGroup(sCtx, groupID, initMemberIDList); err != nil {
|
||||||
|
// _ = sess.AbortTransaction(ctx)
|
||||||
|
// return err
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if err = g.cache.BatchDelJoinedSuperGroupIDs(ctx, initMemberIDList); err != nil {
|
||||||
|
// _ = sess.AbortTransaction(ctx)
|
||||||
|
// return err
|
||||||
|
// }
|
||||||
|
// return sess.CommitTransaction(ctx)
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//func (g *GroupDataBase) GetSuperGroupByID(ctx context.Context, groupID string) (superGroup *unrelation.SuperGroup, err error) {
|
||||||
|
// return g.mongoDB.GetSuperGroup(ctx, groupID)
|
||||||
|
//}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) FindGroup(ctx context.Context, groupIDs []string) (groups []*relation2.GroupModel, err error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupDataBase) CreateGroup(ctx context.Context, groups []*relation2.GroupModel, groupMembers []*relation2.GroupMemberModel) error {
|
func (g *GroupDataBase) SearchGroup(ctx context.Context, name string, pageNumber, showNumber int32) (int32, []*relation2.GroupModel, error) {
|
||||||
return g.db.Transaction(func(tx *gorm.DB) error {
|
//TODO implement me
|
||||||
if len(groups) > 0 {
|
panic("implement me")
|
||||||
if err := g.groupDB.Create(ctx, groups, tx); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(groupMembers) > 0 {
|
|
||||||
if err := g.groupMemberDB.Create(ctx, groupMembers, tx); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupDataBase) DeleteGroupByIDs(ctx context.Context, groupIDs []string) error {
|
func (g *GroupDataBase) TakeGroup(ctx context.Context, groupID string) (group *relation2.GroupModel, err error) {
|
||||||
return g.groupDB.DB.Transaction(func(tx *gorm.DB) error {
|
//TODO implement me
|
||||||
if err := g.groupDB.Delete(ctx, groupIDs, tx); err != nil {
|
panic("implement me")
|
||||||
return err
|
|
||||||
}
|
|
||||||
if err := g.cache.DelGroupsInfo(ctx, groupIDs); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupDataBase) TakeGroupByID(ctx context.Context, groupID string) (group *relation2.GroupModel, err error) {
|
func (g *GroupDataBase) FindJoinedGroup(ctx context.Context, userID string, pageNumber, showNumber int32) ([]*relation2.GroupModel, error) {
|
||||||
return g.cache.GetGroupInfo(ctx, groupID)
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupDataBase) Update(ctx context.Context, groups []*relation2.GroupModel) error {
|
func (g *GroupDataBase) UpdateGroup(ctx context.Context, groupID string, data map[string]any) error {
|
||||||
return g.db.Transaction(func(tx *gorm.DB) error {
|
//TODO implement me
|
||||||
if err := g.groupDB.Update(ctx, groups, tx); err != nil {
|
panic("implement me")
|
||||||
return err
|
|
||||||
}
|
|
||||||
var groupIDs []string
|
|
||||||
for _, group := range groups {
|
|
||||||
groupIDs = append(groupIDs, group.GroupID)
|
|
||||||
}
|
|
||||||
if err := g.cache.DelGroupsInfo(ctx, groupIDs); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupDataBase) GetJoinedGroupList(ctx context.Context, userID string) ([]*relation2.GroupModel, error) {
|
func (g *GroupDataBase) DismissGroup(ctx context.Context, groupID string) error {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
return nil, nil
|
func (g *GroupDataBase) CreateGroup(ctx context.Context, groups []*relation2.GroupModel, groupMember []*relation2.GroupMemberModel) error {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) TakeGroupMember(ctx context.Context, groupID string, userID string) (groupMember *relation2.GroupMemberModel, err error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) FindGroupMember(ctx context.Context, groupID string, userIDs []string) ([]*relation2.GroupMemberModel, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) FindGroupMemberAll(ctx context.Context, groupID string) ([]*relation2.GroupMemberModel, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) FindGroupMemberFilterList(ctx context.Context, groupID string, filter int32, begin int32, maxNumber int32) ([]*relation2.GroupMemberModel, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) FindGroupMembersByID(ctx context.Context, groupID string, userIDs []string) (groups []*relation2.GroupMemberModel, err error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) SearchGroupMember(ctx context.Context, groupID, name string, pageNumber, showNumber int32) (int32, []*relation2.GroupMemberModel, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) FindGroupMemberByUserID(ctx context.Context, groupID string, userIDs []string) ([]*relation2.GroupMemberModel, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) TakeGroupOwner(ctx context.Context, groupID string) (*relation2.GroupMemberModel, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) FindGroupOwnerUser(ctx context.Context, groupID []string) ([]*relation2.GroupMemberModel, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) CreateGroupMember(ctx context.Context, groupMember []*relation2.GroupMemberModel) error {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) HandlerGroupRequest(ctx context.Context, groupID string, userID string, handledMsg string, handleResult int32, member *relation2.GroupMemberModel) error {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) DeleteGroupMember(ctx context.Context, groupID string, userIDs []string) error {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) MapGroupHash(ctx context.Context, groupIDs []string) (map[string]uint64, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) MapGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]int, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) MapGroupOwnerUserID(ctx context.Context, groupIDs []string) (map[string]string, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) TransferGroupOwner(ctx context.Context, groupID string, oldOwnerUserID, newOwnerUserID string) error {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) UpdateGroupMember(ctx context.Context, groupID, userID string, data map[string]any) error {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) CreateGroupRequest(ctx context.Context, requests []*relation2.GroupRequestModel) error {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) GetGroupRecvApplicationList(ctx context.Context, userID string) ([]*relation2.GroupRequestModel, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) TakeGroupRequest(ctx context.Context, groupID string, userID string) (*relation2.GroupRequestModel, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) FindUserGroupRequest(ctx context.Context, userID string, pageNumber, showNumber int32) (int32, []*relation2.GroupRequestModel, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) TakeSuperGroup(ctx context.Context, groupID string) (superGroup *unrelation2.SuperGroupModel, err error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupDataBase) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error {
|
func (g *GroupDataBase) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error {
|
||||||
sess, err := g.mongoDB.MgoClient.StartSession()
|
//TODO implement me
|
||||||
if err != nil {
|
panic("implement me")
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer sess.EndSession(ctx)
|
|
||||||
sCtx := mongo.NewSessionContext(ctx, sess)
|
|
||||||
if err = g.mongoDB.CreateSuperGroup(sCtx, groupID, initMemberIDList); err != nil {
|
|
||||||
_ = sess.AbortTransaction(ctx)
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = g.cache.BatchDelJoinedSuperGroupIDs(ctx, initMemberIDList); err != nil {
|
func (g *GroupDataBase) DeleteSuperGroup(ctx context.Context, groupID string) error {
|
||||||
_ = sess.AbortTransaction(ctx)
|
//TODO implement me
|
||||||
return err
|
panic("implement me")
|
||||||
}
|
|
||||||
return sess.CommitTransaction(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupDataBase) GetSuperGroupByID(ctx context.Context, groupID string) (superGroup *unrelation.SuperGroup, err error) {
|
func (g *GroupDataBase) DeleteSuperGroupMember(ctx context.Context, groupID string, userIDs []string) error {
|
||||||
return g.mongoDB.GetSuperGroup(ctx, groupID)
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) AddUserToSuperGroup(ctx context.Context, groupID string, userIDs []string) error {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) FindJoinSuperGroup(ctx context.Context, userID string, pageNumber, showNumber int32) (total int32, groupIDs []string, err error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GroupDataBase) MapSuperGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]uint32, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ package relation
|
|||||||
//
|
//
|
||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
//func GetGroupMemberListByUserID(userID string) ([]GroupMember, error) {
|
//func FindGroupMember(userID string) ([]GroupMember, error) {
|
||||||
// var groupMemberList []GroupMember
|
// var groupMemberList []GroupMember
|
||||||
// err := DB.DB.MysqlDB.DefaultGormDB().Table("group_members").Where("user_id=?", userID).Find(&groupMemberList).Error
|
// err := DB.DB.MysqlDB.DefaultGormDB().Table("group_members").Where("user_id=?", userID).Find(&groupMemberList).Error
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
@ -167,7 +167,7 @@ package relation
|
|||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
//func GetJoinedGroupIDListByUserID(userID string) ([]string, error) {
|
//func GetJoinedGroupIDListByUserID(userID string) ([]string, error) {
|
||||||
// memberList, err := GetGroupMemberListByUserID(userID)
|
// memberList, err := FindGroupMember(userID)
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
// return nil, err
|
// return nil, err
|
||||||
// }
|
// }
|
||||||
|
@ -95,7 +95,7 @@ func (g *GroupMemberGorm) TakeOwnerInfo(ctx context.Context, groupID string, tx
|
|||||||
//
|
//
|
||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
//func GetGroupMemberListByUserID(userID string) ([]GroupMemberModel, error) {
|
//func FindGroupMember(userID string) ([]GroupMemberModel, error) {
|
||||||
// var groupMemberList []GroupMemberModel
|
// var groupMemberList []GroupMemberModel
|
||||||
// err := GroupMemberDB.Table("group_members").Where("user_id=?", userID).Find(&groupMemberList).Error
|
// err := GroupMemberDB.Table("group_members").Where("user_id=?", userID).Find(&groupMemberList).Error
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
@ -237,7 +237,7 @@ func (g *GroupMemberGorm) TakeOwnerInfo(ctx context.Context, groupID string, tx
|
|||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
//func GetJoinedGroupIDListByUserID(userID string) ([]string, error) {
|
//func GetJoinedGroupIDListByUserID(userID string) ([]string, error) {
|
||||||
// memberList, err := GetGroupMemberListByUserID(userID)
|
// memberList, err := FindGroupMember(userID)
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
// return nil, err
|
// return nil, err
|
||||||
// }
|
// }
|
||||||
|
@ -55,7 +55,7 @@ package relation
|
|||||||
//received
|
//received
|
||||||
//func GetRecvGroupApplicationList(userID string) ([]GroupRequest, error) {
|
//func GetRecvGroupApplicationList(userID string) ([]GroupRequest, error) {
|
||||||
// var groupRequestList []GroupRequest
|
// var groupRequestList []GroupRequest
|
||||||
// memberList, err := GetGroupMemberListByUserID(userID)
|
// memberList, err := FindGroupMember(userID)
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
// return nil, utils.Wrap(err, utils.GetSelfFuncName())
|
// return nil, utils.Wrap(err, utils.GetSelfFuncName())
|
||||||
// }
|
// }
|
||||||
|
@ -3158,7 +3158,7 @@ func _Group_GetGroupMemberList_Handler(srv interface{}, ctx context.Context, dec
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: "/group.group/GetGroupMemberList",
|
FullMethod: "/group.group/FindGroupMemberAll",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(GroupServer).GetGroupMemberList(ctx, req.(*GetGroupMemberListReq))
|
return srv.(GroupServer).GetGroupMemberList(ctx, req.(*GetGroupMemberListReq))
|
||||||
@ -3212,7 +3212,7 @@ func _Group_GetJoinedGroupList_Handler(srv interface{}, ctx context.Context, dec
|
|||||||
}
|
}
|
||||||
info := &grpc.UnaryServerInfo{
|
info := &grpc.UnaryServerInfo{
|
||||||
Server: srv,
|
Server: srv,
|
||||||
FullMethod: "/group.group/GetJoinedGroupList",
|
FullMethod: "/group.group/FindJoinedGroup",
|
||||||
}
|
}
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
return srv.(GroupServer).GetJoinedGroupList(ctx, req.(*GetJoinedGroupListReq))
|
return srv.(GroupServer).GetJoinedGroupList(ctx, req.(*GetJoinedGroupListReq))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user