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.

getlinktasklogic.go 1.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 GetLinkTaskLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewGetLinkTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetLinkTaskLogic {
  16. return &GetLinkTaskLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *GetLinkTaskLogic) GetLinkTask(req *types.GetLinkTaskReq) (resp *types.GetLinkTaskResp, err error) {
  23. participant := storeLink.GetParticipantById(req.PartId, l.svcCtx.DbEngin)
  24. if *participant == (models.StorelinkCenter{}) {
  25. resp = &types.GetLinkTaskResp{}
  26. resp.Success = false
  27. resp.Task = nil
  28. resp.ErrorMsg = "partId不存在"
  29. return resp, nil
  30. }
  31. storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant)
  32. task, err := storelink.ILinkage.QueryTask(req.TaskId)
  33. if err != nil {
  34. return nil, err
  35. }
  36. taskResp := task.(types.GetLinkTaskResp)
  37. return &taskResp, nil
  38. }

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.