diff --git a/internal/logic/app/group_app.go b/internal/logic/app/group_app.go index adc41b7..f0d9994 100644 --- a/internal/logic/app/group_app.go +++ b/internal/logic/app/group_app.go @@ -174,6 +174,8 @@ func (*groupApp) DeleteMember(ctx context.Context, groupId int64, userId int64, if err != nil { return err } + + group.UserNum-- //群组人数减一 err = repo.GroupRepo.Save(group) if err != nil { return err diff --git a/internal/logic/domain/group/model/group.go b/internal/logic/domain/group/model/group.go index e4c5608..25d0441 100644 --- a/internal/logic/domain/group/model/group.go +++ b/internal/logic/domain/group/model/group.go @@ -93,6 +93,7 @@ func CreateGroup(userId, masterId int64, in *pb.CreateGroupReq) *Group { Extra: in.Extra, Members: make([]GroupUser, 0, len(in.MemberIds)+1), IsAllMemberBanned: 2, + UserNum: int32(len(in.MemberIds)) + 1, CreateTime: now, UpdateTime: now, }