|
|
@ -225,15 +225,16 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbgroup.CreateGroupR
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
joinGroup := func(userID string, roleLevel int32) error {
|
|
|
|
joinGroup := func(userID string, roleLevel int32) error {
|
|
|
|
groupMember := convert.Pb2DbGroupMember(userMap[userID])
|
|
|
|
groupMember := &relationtb.GroupMemberModel{
|
|
|
|
groupMember.Nickname = ""
|
|
|
|
GroupID: group.GroupID,
|
|
|
|
groupMember.GroupID = group.GroupID
|
|
|
|
UserID: userID,
|
|
|
|
groupMember.RoleLevel = roleLevel
|
|
|
|
RoleLevel: roleLevel,
|
|
|
|
groupMember.OperatorUserID = mcontext.GetOpUserID(ctx)
|
|
|
|
OperatorUserID: opUserID,
|
|
|
|
groupMember.JoinSource = constant.JoinByInvitation
|
|
|
|
JoinSource: constant.JoinByInvitation,
|
|
|
|
groupMember.InviterUserID = mcontext.GetOpUserID(ctx)
|
|
|
|
InviterUserID: opUserID,
|
|
|
|
groupMember.JoinTime = time.Now()
|
|
|
|
JoinTime: time.Now(),
|
|
|
|
groupMember.MuteEndTime = time.Unix(0, 0)
|
|
|
|
MuteEndTime: time.UnixMilli(0),
|
|
|
|
|
|
|
|
}
|
|
|
|
if err := CallbackBeforeMemberJoinGroup(ctx, groupMember, group.Ex); err != nil {
|
|
|
|
if err := CallbackBeforeMemberJoinGroup(ctx, groupMember, group.Ex); err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -359,6 +360,9 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbgroup.Invite
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(userMap) != len(req.InvitedUserIDs) {
|
|
|
|
|
|
|
|
return nil, errs.ErrRecordNotFound.Wrap("user not found")
|
|
|
|
|
|
|
|
}
|
|
|
|
var groupMember *relationtb.GroupMemberModel
|
|
|
|
var groupMember *relationtb.GroupMemberModel
|
|
|
|
var opUserID string
|
|
|
|
var opUserID string
|
|
|
|
if !authverify.IsAppManagerUid(ctx) {
|
|
|
|
if !authverify.IsAppManagerUid(ctx) {
|
|
|
@ -416,15 +420,16 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbgroup.Invite
|
|
|
|
opUserID := mcontext.GetOpUserID(ctx)
|
|
|
|
opUserID := mcontext.GetOpUserID(ctx)
|
|
|
|
var groupMembers []*relationtb.GroupMemberModel
|
|
|
|
var groupMembers []*relationtb.GroupMemberModel
|
|
|
|
for _, userID := range req.InvitedUserIDs {
|
|
|
|
for _, userID := range req.InvitedUserIDs {
|
|
|
|
member := convert.Pb2DbGroupMember(userMap[userID])
|
|
|
|
member := &relationtb.GroupMemberModel{
|
|
|
|
member.Nickname = ""
|
|
|
|
GroupID: req.GroupID,
|
|
|
|
member.GroupID = req.GroupID
|
|
|
|
UserID: userID,
|
|
|
|
member.RoleLevel = constant.GroupOrdinaryUsers
|
|
|
|
RoleLevel: constant.GroupOrdinaryUsers,
|
|
|
|
member.OperatorUserID = opUserID
|
|
|
|
OperatorUserID: opUserID,
|
|
|
|
member.InviterUserID = opUserID
|
|
|
|
InviterUserID: opUserID,
|
|
|
|
member.JoinSource = constant.JoinByInvitation
|
|
|
|
JoinSource: constant.JoinByInvitation,
|
|
|
|
member.JoinTime = time.Now()
|
|
|
|
JoinTime: time.Now(),
|
|
|
|
member.MuteEndTime = time.Unix(0, 0)
|
|
|
|
MuteEndTime: time.UnixMilli(0),
|
|
|
|
|
|
|
|
}
|
|
|
|
if err := CallbackBeforeMemberJoinGroup(ctx, member, group.Ex); err != nil {
|
|
|
|
if err := CallbackBeforeMemberJoinGroup(ctx, member, group.Ex); err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -800,14 +805,15 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbgroup.JoinGroupReq)
|
|
|
|
if group.GroupType == constant.SuperGroup {
|
|
|
|
if group.GroupType == constant.SuperGroup {
|
|
|
|
return nil, errs.ErrGroupTypeNotSupport.Wrap()
|
|
|
|
return nil, errs.ErrGroupTypeNotSupport.Wrap()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
groupMember := convert.Pb2DbGroupMember(user)
|
|
|
|
groupMember := &relationtb.GroupMemberModel{
|
|
|
|
groupMember.GroupID = group.GroupID
|
|
|
|
GroupID: group.GroupID,
|
|
|
|
groupMember.RoleLevel = constant.GroupOrdinaryUsers
|
|
|
|
UserID: user.UserID,
|
|
|
|
groupMember.OperatorUserID = mcontext.GetOpUserID(ctx)
|
|
|
|
RoleLevel: constant.GroupOrdinaryUsers,
|
|
|
|
groupMember.JoinSource = constant.JoinByInvitation
|
|
|
|
OperatorUserID: mcontext.GetOpUserID(ctx),
|
|
|
|
groupMember.InviterUserID = req.InviterUserID
|
|
|
|
InviterUserID: req.InviterUserID,
|
|
|
|
groupMember.JoinTime = time.Now()
|
|
|
|
JoinTime: time.Now(),
|
|
|
|
groupMember.MuteEndTime = time.Unix(0, 0)
|
|
|
|
MuteEndTime: time.UnixMilli(0),
|
|
|
|
|
|
|
|
}
|
|
|
|
if err := CallbackBeforeMemberJoinGroup(ctx, groupMember, group.Ex); err != nil {
|
|
|
|
if err := CallbackBeforeMemberJoinGroup(ctx, groupMember, group.Ex); err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1272,6 +1278,9 @@ func (s *groupServer) SetGroupMemberInfo(ctx context.Context, req *pbgroup.SetGr
|
|
|
|
if len(req.Members) == 0 {
|
|
|
|
if len(req.Members) == 0 {
|
|
|
|
return nil, errs.ErrArgs.Wrap("members empty")
|
|
|
|
return nil, errs.ErrArgs.Wrap("members empty")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for i := range req.Members {
|
|
|
|
|
|
|
|
req.Members[i].FaceURL = nil
|
|
|
|
|
|
|
|
}
|
|
|
|
duplicateMap := make(map[[2]string]struct{})
|
|
|
|
duplicateMap := make(map[[2]string]struct{})
|
|
|
|
userIDMap := make(map[string]struct{})
|
|
|
|
userIDMap := make(map[string]struct{})
|
|
|
|
groupIDMap := make(map[string]struct{})
|
|
|
|
groupIDMap := make(map[string]struct{})
|
|
|
|