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

37 lines
1.2 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 InstancesStepsRejectParam struct {
InstanceID int64 `json:"instance_id"`
StepID int64 `json:"step_id"`
Comments string `json:"comments"`
}
// InstancesStepsReject handler
// @Summary 审批驳回
// @Description 根据实例号和节点号驳回审批
// @ID instances-steps-reject
// @Tags flow-instances
// @Accept json
// @Produce json
// @Param InstancesStepsRejectParam body InstancesStepsRejectParam true "驳回参数"
// @Success 200 {object} base.Result "返回成功的流程定义数据"
// @Failure 500 {object} base.Result "返回失败的流程定义数据"
// @Router /instances/steps/reject [post]
func (api *FlowInstanceApi) InstancesStepsReject(context *gin.Context) {
param := utils.QuickBind[InstancesStepsRejectParam](context)
instanceService := context.MustMake(flow_instance.FlowInstanceKey).(flow_instance.Service)
err := instanceService.RejectStep(context, param.InstanceID, param.StepID, param.Comments)
if err != nil {
res.FailWithErr(context, err)
return
}
res.Success(context)
}