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.

deletelinktasklogic.go 1.2 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package storelink
  2. import (
  3. "context"
  4. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/storeLink"
  5. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
  6. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
  7. "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type DeleteLinkTaskLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewDeleteLinkTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteLinkTaskLogic {
  16. return &DeleteLinkTaskLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *DeleteLinkTaskLogic) DeleteLinkTask(req *types.DeleteLinkTaskReq) (resp *types.DeleteLinkTaskResp, err error) {
  23. participant := storeLink.GetParticipantById(req.PartId, l.svcCtx.DbEngin)
  24. if *participant == (models.StorelinkCenter{}) {
  25. resp = &types.DeleteLinkTaskResp{}
  26. resp.Success = false
  27. resp.ErrorMsg = "partId不存在"
  28. return resp, nil
  29. }
  30. storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant)
  31. task, err := storelink.ILinkage.DeleteTask(req.TaskId)
  32. if err != nil {
  33. return nil, err
  34. }
  35. taskResp := task.(types.DeleteLinkTaskResp)
  36. return &taskResp, nil
  37. }

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.