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.

startappbyappnamelogic.go 1.2 kB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package apps
  2. import (
  3. "context"
  4. "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/constants"
  5. "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models"
  6. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
  7. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type StartAppByAppNameLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewStartAppByAppNameLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StartAppByAppNameLogic {
  16. return &StartAppByAppNameLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *StartAppByAppNameLogic) StartAppByAppName(req *types.DeleteAppReq) (resp *types.AppResp, err error) {
  23. resp = &types.AppResp{}
  24. var task = &Task{}
  25. //查询应用的yamlString
  26. l.svcCtx.DbEngin.Raw(`select * from task where ns_id= ? and name= ? AND deleted_at IS NULL`, req.NsID, req.Name).Scan(&task)
  27. if task.Id == 0 {
  28. resp.Code = 500
  29. resp.Msg = "App not fount"
  30. return resp, err
  31. }
  32. // 将子任务状态修改为待启动
  33. l.svcCtx.DbEngin.Model(&models.Cloud{}).Where("task_id", task.Id).Update("status", constants.WaitStart)
  34. return
  35. }

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.