mirror of
https://github.com/APIParkLab/APIPark.git
synced 2026-06-04 10:13:53 +08:00
Fix: Issue where API portal's service list fails to retrieve when Influxdb is not initialized
This commit is contained in:
@@ -200,11 +200,13 @@ func (i *imlAuthorizationModule) initGateway(ctx context.Context, partitionId st
|
||||
}
|
||||
|
||||
func (i *imlAuthorizationModule) online(ctx context.Context, s *service.Service) error {
|
||||
|
||||
clusters, err := i.clusterService.List(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(clusters) < 1 {
|
||||
return nil
|
||||
}
|
||||
authorizations, err := i.authorizationService.ListByApp(ctx, s.Id)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -181,8 +181,16 @@ func (i *imlCatalogueModule) genCommonWheres(ctx context.Context, clusterIds ...
|
||||
}
|
||||
|
||||
func (i *imlCatalogueModule) ProviderStatistics(ctx context.Context, start, end time.Time, serviceIds ...string) (map[string]int64, error) {
|
||||
// 判断是否配置influxdb
|
||||
clusterId := cluster.DefaultClusterID
|
||||
_, err := i.clusterService.Get(ctx, clusterId)
|
||||
_, err := i.monitorService.Get(ctx, clusterId)
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return make(map[string]int64), nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
_, err = i.clusterService.Get(ctx, clusterId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -268,6 +269,8 @@ func (i *imlMcpModule) Invoke(ctx context.Context, req mcp.CallToolRequest) (*mc
|
||||
for _, value := range v {
|
||||
queryParam.Add(k, value)
|
||||
}
|
||||
case float64:
|
||||
queryParam.Add(k, strconv.FormatFloat(v, 'e', -1, 64))
|
||||
default:
|
||||
return nil, fmt.Errorf("invalid query param type: %T", v)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user