From 49338393b0f81cf8e040bde1e40b8a6fd5e58b14 Mon Sep 17 00:00:00 2001 From: qiwang <1364512070@qq.com> Date: Thu, 27 Apr 2023 10:09:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=A2=9E=E5=8A=A0=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BB=A3=E7=A0=81=E5=88=B02.0=E5=88=86?= =?UTF-8?q?=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PCM-CEPH/rpc/internal/config/config.go | 11 ++++------- .../PCM-CEPH/rpc/internal/config/screenConfig.go | 2 +- .../rpc/internal/logic/dailypowerscreenlogic.go | 4 +--- .../logic/percentercomputerpowerscreenlogic.go | 4 +--- .../PCM-CEPH/rpc/internal/logic/storagescreenlogic.go | 5 +---- 5 files changed, 8 insertions(+), 18 deletions(-) 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