You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

instancecenterlogic.go 1.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package inference
  2. import (
  3. "context"
  4. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
  5. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
  6. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type InstanceCenterLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewInstanceCenterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *InstanceCenterLogic {
  15. return &InstanceCenterLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *InstanceCenterLogic) InstanceCenter(req *types.InstanceCenterReq) (*types.InstanceCenterResp, error) {
  22. // todo: add your logic here and delete this line
  23. var resp types.InstanceCenterResp
  24. var InstanceCenter *[]models.AiInstanceCenter
  25. var InstanceCenterLists []types.InstanceCenterList
  26. if req.InstanceType == 0 {
  27. l.svcCtx.DbEngin.Raw("select * from ai_instance_center").Scan(&InstanceCenter)
  28. } else {
  29. l.svcCtx.DbEngin.Raw("select * from ai_instance_center where instance_type = ?", req.InstanceType).Scan(&InstanceCenter)
  30. }
  31. var instanceCenter = *InstanceCenter
  32. for _, instanceCenter := range instanceCenter {
  33. var instanceCenterlist types.InstanceCenterList
  34. instanceCenterlist.InstanceName = instanceCenter.InstanceName
  35. instanceCenterlist.InstanceType = instanceCenter.InstanceType
  36. instanceCenterlist.InstanceClass = instanceCenter.InstanceClass
  37. instanceCenterlist.Description = instanceCenter.Description
  38. instanceCenterlist.InstanceClassChinese = instanceCenter.InstanceClassChinese
  39. instanceCenterlist.Version = instanceCenter.Version
  40. instanceCenterlist.LogoPath = instanceCenter.LogoPath
  41. InstanceCenterLists = append(InstanceCenterLists, instanceCenterlist)
  42. }
  43. resp.Code = 200
  44. resp.Msg = "success"
  45. resp.InstanceCenterList = InstanceCenterLists
  46. resp.TotalCount = len(InstanceCenterLists)
  47. return &resp, nil
  48. }

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.