|
|
@@ -32,30 +32,45 @@ func (l *InstanceCenterLogic) InstanceCenter(req *types.InstanceCenterReq) (*typ |
|
|
var InstanceCenterLists []types.InstanceCenterList |
|
|
var InstanceCenterLists []types.InstanceCenterList |
|
|
|
|
|
|
|
|
if req.InstanceType == 0 { |
|
|
if req.InstanceType == 0 { |
|
|
l.svcCtx.DbEngin.Raw("select * from ai_instance_center").Scan(&InstanceCenter) |
|
|
|
|
|
|
|
|
tx := l.svcCtx.DbEngin.Raw("select * from ai_instance_center where instance_name like CONCAT(?, '%')", req.InstanceName).Scan(&InstanceCenter) |
|
|
|
|
|
if tx.Error == nil { |
|
|
|
|
|
logx.Error("find nil") |
|
|
|
|
|
} |
|
|
} else if req.InstanceType != 0 && req.InstanceClass == "" { |
|
|
} else if req.InstanceType != 0 && req.InstanceClass == "" { |
|
|
l.svcCtx.DbEngin.Raw("select * from ai_instance_center where instance_type = ? ", req.InstanceType).Scan(&InstanceCenter) |
|
|
|
|
|
|
|
|
tx := l.svcCtx.DbEngin.Raw("select * from ai_instance_center where instance_type = ? and instance_name like CONCAT(?, '%')", req.InstanceType, req.InstanceName).Scan(&InstanceCenter) |
|
|
|
|
|
if tx.Error == nil { |
|
|
|
|
|
logx.Error("find nil") |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
l.svcCtx.DbEngin.Raw("select * from ai_instance_center where instance_type = ? and instance_class = ?", req.InstanceType, req.InstanceClass).Scan(&InstanceCenter) |
|
|
|
|
|
|
|
|
tx := l.svcCtx.DbEngin.Raw("select * from ai_instance_center where instance_type = ? and instance_class = ? and instance_name like CONCAT(?, '%')", req.InstanceType, req.InstanceClass, req.InstanceName).Scan(&InstanceCenter) |
|
|
|
|
|
if tx.Error == nil { |
|
|
|
|
|
logx.Error("find nil") |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var instanceCenter = *InstanceCenter |
|
|
|
|
|
|
|
|
|
|
|
for _, instanceCenter := range instanceCenter { |
|
|
|
|
|
var instanceCenterlist types.InstanceCenterList |
|
|
|
|
|
instanceCenterlist.InstanceName = instanceCenter.InstanceName |
|
|
|
|
|
instanceCenterlist.InstanceType = instanceCenter.InstanceType |
|
|
|
|
|
instanceCenterlist.InstanceClass = instanceCenter.InstanceClass |
|
|
|
|
|
instanceCenterlist.Description = instanceCenter.Description |
|
|
|
|
|
instanceCenterlist.InstanceClassChinese = instanceCenter.InstanceClassChinese |
|
|
|
|
|
instanceCenterlist.Version = instanceCenter.Version |
|
|
|
|
|
instanceCenterlist.LogoPath = instanceCenter.LogoPath |
|
|
|
|
|
InstanceCenterLists = append(InstanceCenterLists, instanceCenterlist) |
|
|
|
|
|
|
|
|
if InstanceCenter == nil { |
|
|
|
|
|
resp.Code = 200 |
|
|
|
|
|
resp.Msg = "No content found" |
|
|
|
|
|
} else { |
|
|
|
|
|
var instanceCenter = *InstanceCenter |
|
|
|
|
|
|
|
|
|
|
|
for _, instanceCenter := range instanceCenter { |
|
|
|
|
|
var instanceCenterlist types.InstanceCenterList |
|
|
|
|
|
instanceCenterlist.InstanceName = instanceCenter.InstanceName |
|
|
|
|
|
instanceCenterlist.InstanceType = instanceCenter.InstanceType |
|
|
|
|
|
instanceCenterlist.InstanceClass = instanceCenter.InstanceClass |
|
|
|
|
|
instanceCenterlist.Description = instanceCenter.Description |
|
|
|
|
|
instanceCenterlist.InstanceClassChinese = instanceCenter.InstanceClassChinese |
|
|
|
|
|
instanceCenterlist.Version = instanceCenter.Version |
|
|
|
|
|
instanceCenterlist.LogoPath = instanceCenter.LogoPath |
|
|
|
|
|
InstanceCenterLists = append(InstanceCenterLists, instanceCenterlist) |
|
|
|
|
|
} |
|
|
|
|
|
resp.Code = 200 |
|
|
|
|
|
resp.Msg = "success" |
|
|
|
|
|
resp.InstanceCenterList = InstanceCenterLists |
|
|
|
|
|
resp.TotalCount = len(InstanceCenterLists) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
resp.Code = 200 |
|
|
|
|
|
resp.Msg = "success" |
|
|
|
|
|
resp.InstanceCenterList = InstanceCenterLists |
|
|
|
|
|
resp.TotalCount = len(InstanceCenterLists) |
|
|
|
|
|
return &resp, nil |
|
|
return &resp, nil |
|
|
} |
|
|
} |