| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package essapi
- import (
- "mtp2_if/utils"
- essbasic "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/essbasic/v20210526"
- )
- // CreateFlowByTemplateDirectly 通过合同名和模板Id直接发起签署流程
- // 本接口是对于发起合同几个接口的封装,详细参数需要根据自身业务进行调整
- // CreateFlowsByTemplates--CreateSignUrls
- func CreateFlowByTemplateDirectly(flowName, templateId string, flowApproverInfos []*essbasic.FlowApproverInfo, proxyOrganizationOpenId string) (resp map[string][]*string, err error) {
- resp = make(map[string][]*string)
- agent := utils.SetAgent(proxyOrganizationOpenId)
- // 创建签署流程
- var flowInfos []*essbasic.FlowInfo
- flowInfos = append(flowInfos, utils.FillFlowInfo(templateId, flowName, flowApproverInfos))
- // 构建内容控件填充结构(根据自己需求使用)
- // flowInfos[i].FormFields = []*v20210526.FormField{utils.BuildFormField("姓名", "张三")}
- // 发起签署
- flowResponse, err := CreateFlowsByTemplates(agent, flowInfos)
- if err != nil {
- return
- }
- flowIds := flowResponse.Response.FlowIds
- resp["flowIds"] = flowIds
- // 获取签署链接
- createSignUrlsResp, err := CreateSignUrls(flowIds, agent)
- if err != nil {
- return
- }
- if len(createSignUrlsResp.Response.SignUrlInfos) != 0 {
- var urls []*string
- urls = append(urls, createSignUrlsResp.Response.SignUrlInfos[0].SignUrl)
- resp["urls"] = urls
- }
- return
- }
|