|
|
|
@@ -0,0 +1,37 @@ |
|
|
|
package core |
|
|
|
|
|
|
|
import ( |
|
|
|
"PCM/common/tool" |
|
|
|
"context" |
|
|
|
"k8s.io/apimachinery/pkg/util/json" |
|
|
|
|
|
|
|
"PCM/adaptor/PCM-CORE/api/internal/svc" |
|
|
|
"PCM/adaptor/PCM-CORE/api/internal/types" |
|
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/logx" |
|
|
|
) |
|
|
|
|
|
|
|
type JobTotalLogic struct { |
|
|
|
logx.Logger |
|
|
|
ctx context.Context |
|
|
|
svcCtx *svc.ServiceContext |
|
|
|
} |
|
|
|
|
|
|
|
func NewJobTotalLogic(ctx context.Context, svcCtx *svc.ServiceContext) *JobTotalLogic { |
|
|
|
return &JobTotalLogic{ |
|
|
|
Logger: logx.WithContext(ctx), |
|
|
|
ctx: ctx, |
|
|
|
svcCtx: svcCtx, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func (l *JobTotalLogic) JobTotal() (resp *types.JobTotalResp, err error) { |
|
|
|
// todo: add your logic here and delete this line |
|
|
|
resp = &types.JobTotalResp{} |
|
|
|
bytes, err := tool.HttpGet("GET", "https://grampus.openi.org.cn/openapi/v1/sharescreen/computepower/alljobinfo") |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
json.Unmarshal(bytes, resp) |
|
|
|
return resp, nil |
|
|
|
} |