approveflow/app/http/module/flow_instance/api_instances_steps_cancel.go

35 lines
1.1 KiB
Go

package flow_instance
import (
"approveflow/app/http/base/res"
"approveflow/app/provider/flow_instance"
"approveflow/app/utils"
"github.com/Superdanda/hade/framework/gin"
)
type InstancesStepsCancelParam struct {
InstanceID int64 `json:"instance_id"`
}
// InstancesStepsCancel handler
// @Summary 审批取消
// @Description 根据实例号取消审批
// @ID instances-steps-cancel
// @Tags flow-instances
// @Accept json
// @Produce json
// @Param InstancesStepsCancelParam body InstancesStepsCancelParam true "审批取消参数"
// @Success 200 {object} base.Result "返回成功的流程定义数据"
// @Failure 500 {object} base.Result "返回失败的流程定义数据"
// @Router /instances/steps/cancel [post]
func (api *FlowInstanceApi) InstancesStepsCancel(context *gin.Context) {
param := utils.QuickBind[InstancesStepsCancelParam](context)
instanceService := context.MustMake(flow_instance.FlowInstanceKey).(flow_instance.Service)
err := instanceService.CancelInstance(context, param.InstanceID)
if err != nil {
res.FailWithErr(context, err)
return
}
res.Success(context)
}