瀏覽代碼

update

master
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


Loading…
取消
儲存