package essapi import ( "mtp2_if/config" "mtp2_if/logger" "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) (resp map[string][]*string, err error) { agent := utils.SetAgent() resp = make(map[string][]*string) // 创建签署流程 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 } // 目标只需要乙方签署地址 var urls []*string for _, signUrlInfo := range createSignUrlsResp.Response.SignUrlInfos { logger.GetLogger().Debugf("signUrlInfo: %v\n", signUrlInfo) if signUrlInfo.OpenId != &config.SerCfg.TencentCfg.ProxyOperatorOpenId { // 不是甲方经办人 urls = append(urls, signUrlInfo.SignUrl) } } resp["urls"] = urls return }