mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 07:50:25 +08:00 
			
		
		
		
	增加服务之间拷贝配置的API(开源版本只有定义,没有完全实现)
This commit is contained in:
		@@ -1299,6 +1299,16 @@ func (this *ServerService) CountAllEnabledServersWithServerGroupId(ctx context.C
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var tx = this.NullTx()
 | 
			
		||||
	if userId <= 0 {
 | 
			
		||||
		// 指定用户ID可以加快查询速度
 | 
			
		||||
		groupUserId, err := models.SharedServerGroupDAO.FindGroupUserId(tx, req.ServerGroupId)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return nil, err
 | 
			
		||||
		}
 | 
			
		||||
		if groupUserId > 0 {
 | 
			
		||||
			userId = groupUserId
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	count, err := models.SharedServerDAO.CountAllEnabledServersWithGroupId(tx, req.ServerGroupId, userId)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
@@ -1562,11 +1572,29 @@ func (this *ServerService) FindEnabledUserServerBasic(ctx context.Context, req *
 | 
			
		||||
		return &pb.FindEnabledUserServerBasicResponse{Server: nil}, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 集群
 | 
			
		||||
	clusterName, err := models.SharedNodeClusterDAO.FindNodeClusterName(tx, int64(server.ClusterId))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 分组
 | 
			
		||||
	var pbGroups = []*pb.ServerGroup{}
 | 
			
		||||
	for _, groupId := range server.DecodeGroupIds() {
 | 
			
		||||
		group, err := models.SharedServerGroupDAO.FindEnabledServerGroup(tx, groupId)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return nil, err
 | 
			
		||||
		}
 | 
			
		||||
		if group == nil {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		pbGroups = append(pbGroups, &pb.ServerGroup{
 | 
			
		||||
			Id:     groupId,
 | 
			
		||||
			Name:   group.Name,
 | 
			
		||||
			UserId: int64(group.UserId),
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &pb.FindEnabledUserServerBasicResponse{Server: &pb.Server{
 | 
			
		||||
		Id:          int64(server.Id),
 | 
			
		||||
		Name:        server.Name,
 | 
			
		||||
@@ -1578,6 +1606,7 @@ func (this *ServerService) FindEnabledUserServerBasic(ctx context.Context, req *
 | 
			
		||||
			Id:   int64(server.ClusterId),
 | 
			
		||||
			Name: clusterName,
 | 
			
		||||
		},
 | 
			
		||||
		ServerGroups: pbGroups,
 | 
			
		||||
	}}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user