|
|
@@ -4,9 +4,11 @@ import ( |
|
|
|
"context" |
|
|
|
"database/sql" |
|
|
|
"errors" |
|
|
|
"gim/internal/business/comm/utils" |
|
|
|
"gim/internal/logic/domain/group/model" |
|
|
|
"gim/internal/logic/domain/group/repo" |
|
|
|
"gim/pkg/db" |
|
|
|
"gim/pkg/grpclib" |
|
|
|
"gim/pkg/pb" |
|
|
|
) |
|
|
|
|
|
|
@@ -16,8 +18,12 @@ var GroupApp = new(groupApp) |
|
|
|
|
|
|
|
// CreateGroup 创建群组 |
|
|
|
func (*groupApp) CreateGroup(ctx context.Context, userId int64, in *pb.CreateGroupReq) (int64, error) { |
|
|
|
group := model.CreateGroup(userId, in) |
|
|
|
err := repo.GroupRepo.Save(group) |
|
|
|
masterId, err := grpclib.GetCtxMasterId(ctx) |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
group := model.CreateGroup(userId, utils.StrToInt64(masterId), in) |
|
|
|
err = repo.GroupRepo.Save(group) |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|