35 lines
1.1 KiB
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 InstancesStartRuleParam struct {
|
||
|
InstanceID int64 `json:"instance_id"`
|
||
|
}
|
||
|
|
||
|
// InstancesStartRule handler
|
||
|
// @Summary 启动审批流自动规则
|
||
|
// @Description 启动审批流自动规则
|
||
|
// @ID instances-start-rule
|
||
|
// @Tags flow-instances
|
||
|
// @Accept json
|
||
|
// @Produce json
|
||
|
// @Param InstancesStartRuleParam body InstancesStartRuleParam true "启动实例ID"
|
||
|
// @Success 200 {object} base.Result "返回成功的流程定义数据"
|
||
|
// @Failure 500 {object} base.Result "返回失败的流程定义数据"
|
||
|
// @Router /instances/start/rule [post]
|
||
|
func (api *FlowInstanceApi) InstancesStartRule(context *gin.Context) {
|
||
|
param := utils.QuickBind[InstancesStartParam](context)
|
||
|
instanceService := context.MustMake(flow_instance.FlowInstanceKey).(flow_instance.Service)
|
||
|
_, err := instanceService.StartInstanceRule(context, param.InstanceID)
|
||
|
if err != nil {
|
||
|
res.FailWithErr(context, err)
|
||
|
return
|
||
|
}
|
||
|
res.Success(context)
|
||
|
}
|