From 330bf1782eb398db44c233cb1ebdbc11ac94dac6 Mon Sep 17 00:00:00 2001
From: wangp <wangpei@gmail.com>
Date: Fri, 25 Aug 2023 18:12:46 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8B=89=E5=8D=A1=E6=8B=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 repository/pay/pay.go | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/repository/pay/pay.go b/repository/pay/pay.go
index 658ad2b..d8dd0bd 100755
--- a/repository/pay/pay.go
+++ b/repository/pay/pay.go
@@ -111,9 +111,11 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
 
 	//source_code 1: 微信 Native 2:微信小程序 3:微信内支付 4:h5 跳微信
 	//5:支付宝(web)-扫码或登录支付宝账户 6:alipay(mobile) 7:alipay(app)
-	//9: B2C 10:bk支付宝web 11:bk 支付宝手机 15:快捷支付(银行卡)
-	if input.SourceCode==4 || input.SourceCode==6 ||input.SourceCode==1 || input.SourceCode==5 || input.SourceCode==15 {
+	//9: B2C 10:bk支付宝web 11:bk 支付宝手机 15:快捷支付(银行卡) 16:微信小程序-必康自营
+	if input.SourceCode==4 || input.SourceCode==6 ||input.SourceCode==1 ||
+		input.SourceCode==5 || input.SourceCode==15 || input.SourceCode==16 {
 		//聚合收银台(微信H5、支付宝H5、微信扫码、支付宝扫码)
+		//聚合收银台(微信小程序-必康自营)
 		//url = "https://test.wsmsd.cn/sit/api/v3/ccss/counter/order/create" //聚合收银台
 		url = setting.Conf.Lakala.UrlCreate //聚合收银台
 
@@ -134,7 +136,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
 		if input.SourceCode==15 {
 			//快捷支付
 			data2["counter_param"] = "{\"pay_mode\":\"QUICK_PAY\"}"
-		} else if input.SourceCode < 5 {
+		} else if input.SourceCode < 5 || input.SourceCode==16 {
 			//微信
 			data2["counter_param"] = "{\"pay_mode\":\"WECHAT\"}"
 		} else {
@@ -228,7 +230,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
 		data["req_data"] = data2
 
 	} else {
-		return nil, errors.New("输入参数「source_code」错误,有效值为[1-6,9,15]")
+		return nil, errors.New("输入参数「source_code」错误,有效值为[1-6,9,15,16]")
 	}
 	//数据重组 - end
 	fmt.Println("拉卡拉输入参数")
@@ -319,14 +321,16 @@ func lakala_post(input *models.PlaceAnOrderParamInput, url string, data_json []b
 	//return nil, temp["resp_data"]["counter_url"]
 
 	response := make(map[string]string)
-	if source_code==4 || source_code==6 || source_code==1 || source_code==5 || source_code==15 {
+	if source_code==4 || source_code==6 || source_code==1 || source_code==5 || source_code==15 || input.SourceCode==16 {
 		//聚合收银台(微信H5、支付宝H5、微信扫码、支付宝扫码、快捷支付(银行卡))
+		//聚合收银台(微信小程序-必康自营)
 		temp2, _ := temp["resp_data"].(map[string]interface{})
 		if temp2["counter_url"]=="" {
 			return errors.New("拉卡拉返回值「counter_url」为空错误"), "", temp
 		}
-		if source_code==4 || source_code==6 || source_code==15 {
+		if source_code==4 || source_code==6 || source_code==15 || input.SourceCode==16 {
 			//微信H5、支付宝H5、快捷支付(银行卡)
+			//聚合收银台(微信小程序-必康自营)
 			response["m_web_url"] = temp2["counter_url"].(string)
 		} else {
 			//微信扫码、支付宝扫码
@@ -764,7 +768,7 @@ func selectRefundBill(tx *sql.Tx, input *models.RefundParamInput) (string, strin
 	}
 
 	if source_code==0 {
-		return "", "", 0, 0, errors.New("「source_code」错误,有效值为[1-6,9,15]")
+		return "", "", 0, 0, errors.New("「source_code」错误,有效值为[1-6,9,15,16]")
 	}
 
 	// 获取「对账单流水号」和「交易终端号」,退款用
-- 
2.18.1