package storelink import ( "context" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/storeLink" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models" "github.com/zeromicro/go-zero/core/logx" ) type DeleteLinkTaskLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewDeleteLinkTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteLinkTaskLogic { return &DeleteLinkTaskLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *DeleteLinkTaskLogic) DeleteLinkTask(req *types.DeleteLinkTaskReq) (resp *types.DeleteLinkTaskResp, err error) { participant := storeLink.GetParticipantById(req.PartId, l.svcCtx.DbEngin) if *participant == (models.StorelinkCenter{}) { resp = &types.DeleteLinkTaskResp{} resp.Success = false resp.ErrorMsg = "partId不存在" return resp, nil } storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant) task, err := storelink.ILinkage.DeleteTask(req.TaskId) if err != nil { return nil, err } taskResp := task.(types.DeleteLinkTaskResp) return &taskResp, nil }