diff --git a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/config/config.go b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/config/config.go index bd94ad84..0834dbeb 100644 --- a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/config/config.go +++ b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/config/config.go @@ -1,9 +1,6 @@ package config import ( - commonConfig "PCM/common/config" - "flag" - "github.com/zeromicro/go-zero/core/conf" "github.com/zeromicro/go-zero/core/logx" "github.com/zeromicro/go-zero/zrpc" ) @@ -15,15 +12,15 @@ type Config struct { PcmCoreRpcConf zrpc.RpcClientConf } -var configFile = flag.String("o", "adaptor/PCM-STORAGE/PCM-CEPH/rpc/etc/pcmceph.yaml", "the config file") +/*var configFile = flag.String("o", "adaptor/PCM-STORAGE/PCM-CEPH/rpc/etc/pcmceph.yaml", "the config file") var Cfg = getConfig() -/* + func getConfig() Config { var c Config conf.MustLoad(*configFile, &c) return c -}*/ +} func getConfig() Config { var bootstrapConfig commonConfig.BootstrapConfig @@ -49,4 +46,4 @@ func getConfig() Config { nacosConfig.Discovery(&c.RpcServerConf) return c -} +}*/ diff --git a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/config/screenConfig.go b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/config/screenConfig.go index 7e398510..078c9649 100644 --- a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/config/screenConfig.go +++ b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/config/screenConfig.go @@ -1,5 +1,5 @@ package config type ScreenConfig struct { - ScreenUrl string + ScreenUrl string `json:"ScreenUrl"` } diff --git a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/logic/dailypowerscreenlogic.go b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/logic/dailypowerscreenlogic.go index 96a1b7f9..242fce6c 100644 --- a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/logic/dailypowerscreenlogic.go +++ b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/logic/dailypowerscreenlogic.go @@ -1,7 +1,6 @@ package logic import ( - "PCM/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/config" "PCM/common/tool" "context" "fmt" @@ -31,8 +30,7 @@ func NewDailyPowerScreenLogic(ctx context.Context, svcCtx *svc.ServiceContext) * func (l *DailyPowerScreenLogic) DailyPowerScreen(in *ceph.DailyPowerScreenReq) (*ceph.DailyPowerScreenResp, error) { // todo: add your logic here and delete this line var resp ceph.DailyPowerScreenResp - screenConfig := config.Cfg - screenUrl := screenConfig.ScreenConfig.ScreenUrl + screenUrl := l.svcCtx.Config.ScreenUrl statusCode, body, err := tool.HttpClientWithScreen(tool.GET, screenUrl+"computepower/dailytrend", strings.NewReader(``)) if err != nil { return nil, err diff --git a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/logic/percentercomputerpowerscreenlogic.go b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/logic/percentercomputerpowerscreenlogic.go index edc385af..46cf9553 100644 --- a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/logic/percentercomputerpowerscreenlogic.go +++ b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/logic/percentercomputerpowerscreenlogic.go @@ -1,7 +1,6 @@ package logic import ( - "PCM/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/config" "PCM/common/tool" "context" "fmt" @@ -31,8 +30,7 @@ func NewPerCenterComputerPowerScreenLogic(ctx context.Context, svcCtx *svc.Servi func (l *PerCenterComputerPowerScreenLogic) PerCenterComputerPowerScreen(in *ceph.PerCenterComputerPowersReq) (*ceph.PerCenterComputerPowersResp, error) { // todo: add your logic here and delete this line var resp ceph.PerCenterComputerPowersResp - screenConfig := config.Cfg - screenUrl := screenConfig.ScreenConfig.ScreenUrl + screenUrl := l.svcCtx.Config.ScreenUrl statusCode, body, err := tool.HttpClientWithScreen(tool.GET, screenUrl+"computepower/percenter", strings.NewReader(``)) if err != nil { return nil, err diff --git a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/logic/storagescreenlogic.go b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/logic/storagescreenlogic.go index 1aea8635..2f3feba8 100644 --- a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/logic/storagescreenlogic.go +++ b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/logic/storagescreenlogic.go @@ -1,7 +1,6 @@ package logic import ( - "PCM/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/config" "PCM/common/tool" "context" "fmt" @@ -61,9 +60,7 @@ func NewStorageScreenLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Sto func (l *StorageScreenLogic) StorageScreen(in *ceph.StorageScreenReq) (*ceph.StorageScreenResp, error) { // todo: add your logic here and delete this line var resp ceph.StorageScreenResp - //var storageArg StorageArg - screenConfig := config.Cfg - screenUrl := screenConfig.ScreenConfig.ScreenUrl + screenUrl := l.svcCtx.Config.ScreenUrl statusCode, body, err := tool.HttpClientWithScreen(tool.GET, screenUrl+"aicenter?sortBy=weight&orderBy=asc", strings.NewReader(``)) if err != nil { return nil, err