| 477 | } |
| 478 | |
| 479 | func (i *imlPublishModule) Stop(ctx context.Context, serviceId string, id string) error { |
| 480 | _, err := i.serviceService.Check(ctx, serviceId, asServer) |
| 481 | if err != nil { |
| 482 | return err |
| 483 | } |
| 484 | flow, err := i.publishService.Get(ctx, id) |
| 485 | if err != nil { |
| 486 | return err |
| 487 | } |
| 488 | if flow.Service != serviceId { |
| 489 | return errors.New("项目不一致") |
| 490 | } |
| 491 | |
| 492 | if flow.Status != publish.StatusApply && flow.Status != publish.StatusAccept { |
| 493 | return errors.New("只有发布中状态才能停止") |
| 494 | } |
| 495 | status := publish.StatusStop |
| 496 | if flow.Status == publish.StatusApply { |
| 497 | status = publish.StatusClose |
| 498 | } |
| 499 | return i.publishService.SetStatus(ctx, serviceId, id, status) |
| 500 | } |
| 501 | |
| 502 | func (i *imlPublishModule) Refuse(ctx context.Context, serviceId string, id string, commits string) error { |
| 503 | _, err := i.serviceService.Check(ctx, serviceId, asServer) |