# 使用延时组件实现接口延时调用

来源快照：`result_data_new_260518.json`

- 来源 ID：`1243027010994110499`
- 模块：低代码平台e-builder
- 目录：专题学习 - 场景专题 - 动作流专题
- space ID：`1157961794811633670`
- 原文链接：未提供
- 产品基线：未提供

## 正文

# 编写目的

      调用用友U8api接口新增凭证接口[https://api.yonyouup.com/api/voucher/add，](https://api.yonyouup.com/api/voucher/add，)接口执行成功后响应信息包含新增结果等待时间ping_after、交易唯一标识tradeid和新增结果查询接口url；需要等待ping_after指定秒数后再调用接[https://api.yonyouup.com/resultrequestid=tradeid](https://api.yonyouup.com/result?requestid=tradeid)。获取真正的凭证新增结果。[点击查看U8新增一条凭证接口文档](https://open.yonyouup.com/apiCenter/voucher_add "点击查看U8新增一条凭证接口文档")  
  本文档将会为您讲解如何通过动作流实现接口延时调用。  


![](https://weapp.eteams.cn/papi/file/preview?fileId=1243028402477088770&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1243027083800903695&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

# 核心思路

20251201基线发布的执行组件【延时】，支持一个执行事件结束后延迟指定时间再执行后续动作。

![](https://weapp.eteams.cn/papi/file/preview?fileId=1243027075453034501&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

# 操作步骤

1）

## 在连接器添加自建连接器，维护新增凭证接口和新增结果查询接口

新增自建连接器：

![](https://weapp.eteams.cn/papi/file/preview?fileId=1243027075240747019&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

添加连接信息，维护接口域名和端口即可：

![](https://weapp.eteams.cn/papi/file/preview?fileId=1243027075462627337&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

添加接口信息，URL参数需要在接口地址后手动添加?参数名称1=${变量名称1}&参数名称2=${变

量名称2}……url参数列表会自动解析到请求参数中：

![](https://weapp.eteams.cn/papi/file/preview?fileId=1243027079762206726&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1243027079761379330&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

body参数较多可以直接复制接口文档的请求示例内容自动解析生成请求参数列表：

![](https://weapp.eteams.cn/papi/file/preview?fileId=1243027083964899331&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

添加响应参数和成功失败条件：

![](https://weapp.eteams.cn/papi/file/preview?fileId=1243027083964899329&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1243027088226312193&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

2）

## 新建动作流，添加两个接口执行组件

凭证上传流程归档时触发，执行新增凭证接口和凭证新增结果查询接口：![](https://weapp.eteams.cn/papi/file/preview?fileId=1243027075240747013&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

凭证新增结果的url参数requestid即新增凭证结果的响应参数tradeid，可以从上下文参数中动态赋值：

![](https://weapp.eteams.cn/papi/file/preview?fileId=1243027083808088068&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1243027079762206724&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

3）

## 两个组件间添加延时组件

从数据操作-综合分类下添加延时组件，延长时间等于新增凭证组件的响应参数ping_after：

![](https://weapp.eteams.cn/papi/file/preview?fileId=1243027079589822468&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1243027079555063821&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)
