DengBiao преди 1 година
родител
ревизия
ff114e117e
променени са 2 файла, в които са добавени 6 реда и са изтрити 3 реда
  1. +2
    -2
      internal/logic/app/group_app.go
  2. +4
    -1
      internal/logic/domain/group/model/group.go

+ 2
- 2
internal/logic/app/group_app.go Целия файл

@@ -28,7 +28,7 @@ func (*groupApp) CreateGroup(ctx context.Context, userId int64, in *pb.CreateGro
return 0, err
}
in.MemberIds = append(in.MemberIds, userId)
err = group.PushAddMember(ctx, userId, in.MemberIds)
err = group.PushAddMember(ctx, userId, in.MemberIds, false)
return group.Id, nil
}

@@ -99,7 +99,7 @@ func (*groupApp) AddMembers(ctx context.Context, userId, groupId int64, userIds
return nil, err
}

err = group.PushAddMember(ctx, userId, addedIds)
err = group.PushAddMember(ctx, userId, addedIds, true)
if err != nil {
return nil, err
}


+ 4
- 1
internal/logic/domain/group/model/group.go Целия файл

@@ -402,7 +402,7 @@ func (g *Group) AddMembers(ctx context.Context, userIds []int64) ([]int64, []int
return existIds, addedIds, nil
}

func (g *Group) PushAddMember(ctx context.Context, optUserId int64, addedIds []int64) error {
func (g *Group) PushAddMember(ctx context.Context, optUserId int64, addedIds []int64, isFilterGroupLeader bool) error {
var addIdMap = make(map[int64]int32, len(addedIds))
for i := range addedIds {
addIdMap[addedIds[i]] = 0
@@ -415,6 +415,9 @@ func (g *Group) PushAddMember(ctx context.Context, optUserId int64, addedIds []i
}
var members []*pb.GroupMember
for k, _ := range addIdMap {
if isFilterGroupLeader && k == optUserId {
continue
}
member, ok := usersResp.Users[k]
if !ok {
continue


Зареждане…
Отказ
Запис