Browse Source

处理腾讯电子签甲乙两方都手工签署时错误返回甲方签署URL的问题

zhou.xiaoning 1 year ago
parent
commit
0bf80c7109

+ 6 - 2
services/tencent/ess.go

@@ -121,8 +121,12 @@ func CreateFlowByTemplateDirectly(tmplateName string, userType int,
 		logger.GetLogger().Errorf("CreateFlowByTemplateDirectly, %v", err.Error())
 		logger.GetLogger().Errorf("CreateFlowByTemplateDirectly, %v", err.Error())
 		return
 		return
 	}
 	}
-	flowId = *resp["flowIds"][0]
-	signUrl = *resp["urls"][0]
+	if len(resp["flowIds"]) > 0 {
+		flowId = *resp["flowIds"][0]
+	}
+	if len(resp["urls"]) > 0 {
+		signUrl = *resp["urls"][0]
+	}
 
 
 	// 更新电子签记录表信息状态
 	// 更新电子签记录表信息状态
 	record.CONTRACTNO = flowId
 	record.CONTRACTNO = flowId

+ 8 - 4
services/tencent/essapi/CreateFlowByTemplateDirectly.go

@@ -1,6 +1,7 @@
 package essapi
 package essapi
 
 
 import (
 import (
+	"mtp2_if/config"
 	"mtp2_if/utils"
 	"mtp2_if/utils"
 
 
 	essbasic "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/essbasic/v20210526"
 	essbasic "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/essbasic/v20210526"
@@ -32,11 +33,14 @@ func CreateFlowByTemplateDirectly(flowName, templateId string, flowApproverInfos
 	if err != nil {
 	if err != nil {
 		return
 		return
 	}
 	}
-	if len(createSignUrlsResp.Response.SignUrlInfos) != 0 {
-		var urls []*string
-		urls = append(urls, createSignUrlsResp.Response.SignUrlInfos[0].SignUrl)
-		resp["urls"] = urls
+	// 目标只需要乙方签署地址
+	var urls []*string
+	for _, signUrlInfo := range createSignUrlsResp.Response.SignUrlInfos {
+		if signUrlInfo.OpenId != &config.SerCfg.TencentCfg.ProxyOperatorOpenId { // 不是甲方经办人
+			urls = append(urls, signUrlInfo.SignUrl)
+		}
 	}
 	}
+	resp["urls"] = urls
 
 
 	return
 	return
 }
 }