fix:增加大屏数据代码到2.0分支

This commit is contained in:
qiwang 2023-04-27 10:09:38 +08:00
parent fdbe177c63
commit 49338393b0
5 changed files with 8 additions and 18 deletions

View File

@ -1,9 +1,6 @@
package config package config
import ( 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/core/logx"
"github.com/zeromicro/go-zero/zrpc" "github.com/zeromicro/go-zero/zrpc"
) )
@ -15,15 +12,15 @@ type Config struct {
PcmCoreRpcConf zrpc.RpcClientConf 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() var Cfg = getConfig()
/*
func getConfig() Config { func getConfig() Config {
var c Config var c Config
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
return c return c
}*/ }
func getConfig() Config { func getConfig() Config {
var bootstrapConfig commonConfig.BootstrapConfig var bootstrapConfig commonConfig.BootstrapConfig
@ -49,4 +46,4 @@ func getConfig() Config {
nacosConfig.Discovery(&c.RpcServerConf) nacosConfig.Discovery(&c.RpcServerConf)
return c return c
} }*/

View File

@ -1,5 +1,5 @@
package config package config
type ScreenConfig struct { type ScreenConfig struct {
ScreenUrl string ScreenUrl string `json:"ScreenUrl"`
} }

View File

@ -1,7 +1,6 @@
package logic package logic
import ( import (
"PCM/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/config"
"PCM/common/tool" "PCM/common/tool"
"context" "context"
"fmt" "fmt"
@ -31,8 +30,7 @@ func NewDailyPowerScreenLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
func (l *DailyPowerScreenLogic) DailyPowerScreen(in *ceph.DailyPowerScreenReq) (*ceph.DailyPowerScreenResp, error) { func (l *DailyPowerScreenLogic) DailyPowerScreen(in *ceph.DailyPowerScreenReq) (*ceph.DailyPowerScreenResp, error) {
// todo: add your logic here and delete this line // todo: add your logic here and delete this line
var resp ceph.DailyPowerScreenResp var resp ceph.DailyPowerScreenResp
screenConfig := config.Cfg screenUrl := l.svcCtx.Config.ScreenUrl
screenUrl := screenConfig.ScreenConfig.ScreenUrl
statusCode, body, err := tool.HttpClientWithScreen(tool.GET, screenUrl+"computepower/dailytrend", strings.NewReader(``)) statusCode, body, err := tool.HttpClientWithScreen(tool.GET, screenUrl+"computepower/dailytrend", strings.NewReader(``))
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -1,7 +1,6 @@
package logic package logic
import ( import (
"PCM/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/config"
"PCM/common/tool" "PCM/common/tool"
"context" "context"
"fmt" "fmt"
@ -31,8 +30,7 @@ func NewPerCenterComputerPowerScreenLogic(ctx context.Context, svcCtx *svc.Servi
func (l *PerCenterComputerPowerScreenLogic) PerCenterComputerPowerScreen(in *ceph.PerCenterComputerPowersReq) (*ceph.PerCenterComputerPowersResp, error) { func (l *PerCenterComputerPowerScreenLogic) PerCenterComputerPowerScreen(in *ceph.PerCenterComputerPowersReq) (*ceph.PerCenterComputerPowersResp, error) {
// todo: add your logic here and delete this line // todo: add your logic here and delete this line
var resp ceph.PerCenterComputerPowersResp var resp ceph.PerCenterComputerPowersResp
screenConfig := config.Cfg screenUrl := l.svcCtx.Config.ScreenUrl
screenUrl := screenConfig.ScreenConfig.ScreenUrl
statusCode, body, err := tool.HttpClientWithScreen(tool.GET, screenUrl+"computepower/percenter", strings.NewReader(``)) statusCode, body, err := tool.HttpClientWithScreen(tool.GET, screenUrl+"computepower/percenter", strings.NewReader(``))
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -1,7 +1,6 @@
package logic package logic
import ( import (
"PCM/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/config"
"PCM/common/tool" "PCM/common/tool"
"context" "context"
"fmt" "fmt"
@ -61,9 +60,7 @@ func NewStorageScreenLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Sto
func (l *StorageScreenLogic) StorageScreen(in *ceph.StorageScreenReq) (*ceph.StorageScreenResp, error) { func (l *StorageScreenLogic) StorageScreen(in *ceph.StorageScreenReq) (*ceph.StorageScreenResp, error) {
// todo: add your logic here and delete this line // todo: add your logic here and delete this line
var resp ceph.StorageScreenResp var resp ceph.StorageScreenResp
//var storageArg StorageArg screenUrl := l.svcCtx.Config.ScreenUrl
screenConfig := config.Cfg
screenUrl := screenConfig.ScreenConfig.ScreenUrl
statusCode, body, err := tool.HttpClientWithScreen(tool.GET, screenUrl+"aicenter?sortBy=weight&orderBy=asc", strings.NewReader(``)) statusCode, body, err := tool.HttpClientWithScreen(tool.GET, screenUrl+"aicenter?sortBy=weight&orderBy=asc", strings.NewReader(``))
if err != nil { if err != nil {
return nil, err return nil, err