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