From c005b8ab9cca7f8a8cd4882614e4990ebd5602d2 Mon Sep 17 00:00:00 2001 From: qiwang <1364512070@qq.com> Date: Wed, 9 Oct 2024 09:10:25 +0800 Subject: [PATCH] fix: update instance center of ai --- desc/inference/inference.api | 3 ++- internal/logic/inference/instancecenterlogic.go | 5 +++-- internal/types/types.go | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/desc/inference/inference.api b/desc/inference/inference.api index 3f12d5a1..87b9f7fd 100644 --- a/desc/inference/inference.api +++ b/desc/inference/inference.api @@ -35,7 +35,8 @@ type ( /******************image inference*************************/ /******************instance center*************************/ InstanceCenterReq{ - InstanceType int32 `form:"instance_type"` + InstanceType int32 `json:"instance_type"` + InstanceClass string `json:"instance_class"` } InstanceCenterResp { InstanceCenterList []InstanceCenterList `json:"instanceCenterList" copier:"InstanceCenterList"` diff --git a/internal/logic/inference/instancecenterlogic.go b/internal/logic/inference/instancecenterlogic.go index dd0d90ec..dd7deacf 100644 --- a/internal/logic/inference/instancecenterlogic.go +++ b/internal/logic/inference/instancecenterlogic.go @@ -33,9 +33,10 @@ func (l *InstanceCenterLogic) InstanceCenter(req *types.InstanceCenterReq) (*typ if req.InstanceType == 0 { l.svcCtx.DbEngin.Raw("select * from ai_instance_center").Scan(&InstanceCenter) + } else if req.InstanceType != 0 && req.InstanceClass == "" { + l.svcCtx.DbEngin.Raw("select * from ai_instance_center where instance_type = ? ", req.InstanceType).Scan(&InstanceCenter) } else { - l.svcCtx.DbEngin.Raw("select * from ai_instance_center where instance_type = ?", req.InstanceType).Scan(&InstanceCenter) - + l.svcCtx.DbEngin.Raw("select * from ai_instance_center where instance_type = ? and instance_class = ?", req.InstanceType, req.InstanceClass).Scan(&InstanceCenter) } var instanceCenter = *InstanceCenter diff --git a/internal/types/types.go b/internal/types/types.go index 8183e7fa..271fcb36 100644 --- a/internal/types/types.go +++ b/internal/types/types.go @@ -3666,7 +3666,8 @@ type InstanceCenterList struct { } type InstanceCenterReq struct { - InstanceType int32 `form:"instance_type"` + InstanceType int32 `json:"instance_type"` + InstanceClass string `json:"instance_class"` } type InstanceCenterResp struct {