Ver a proveniência

update

master
DengBiao há 1 ano
ascendente
cometimento
ff114e117e
2 ficheiros alterados com 6 adições e 3 eliminações
  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 Ver ficheiro

@@ -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 Ver ficheiro

@@ -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


Carregando…
Cancelar
Guardar