mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-07 18:50:26 +08:00
用户创建服务时刻自动添加到分组
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/messageconfigs"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||
"github.com/iwind/TeaGo/lists"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"github.com/iwind/TeaGo/types"
|
||||
timeutil "github.com/iwind/TeaGo/utils/time"
|
||||
@@ -71,6 +72,12 @@ func (this *ServerService) CreateServer(ctx context.Context, req *pb.CreateServe
|
||||
if nodeClusterId > 0 {
|
||||
req.NodeClusterId = nodeClusterId
|
||||
}
|
||||
|
||||
// 服务分组
|
||||
config, err := models.SharedSysSettingDAO.ReadUserServerConfig(tx)
|
||||
if err == nil && config.GroupId > 0 && !lists.ContainsInt64(req.ServerGroupIds, config.GroupId) {
|
||||
req.ServerGroupIds = append(req.ServerGroupIds, config.GroupId)
|
||||
}
|
||||
} else if req.UserId > 0 {
|
||||
// 集群
|
||||
nodeClusterId, err := models.SharedUserDAO.FindUserClusterId(tx, req.UserId)
|
||||
|
||||
Reference in New Issue
Block a user