From f21e232e007e001f970bd87a28fe80220cac0233 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 15 Oct 2024 14:09:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pay/pay_by_own.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pay/pay_by_own.go b/pay/pay_by_own.go index d07a1ce..e408903 100644 --- a/pay/pay_by_own.go +++ b/pay/pay_by_own.go @@ -5,6 +5,7 @@ import ( local_wxpay "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/lib/local_wechat" "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/md" zhios_pay_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/utils" + "encoding/json" "fmt" "github.com/iGoogle-ink/gopay" "github.com/iGoogle-ink/gopay/wechat" @@ -82,6 +83,17 @@ func AlipayWap(args map[string]string) (string, error) { return zhios_pay_utils.AnyToString(param), nil } +type AlipayAppletData struct { + Code int `json:"code"` + Msg string `json:"msg"` + Data struct { + Code string `json:"code"` + Msg string `json:"msg"` + OutTradeNo string `json:"out_trade_no"` + TradeNo string `json:"trade_no"` + } `json:"data"` +} + func AlipayApplet(args map[string]string, isPrd bool) (string, error) { var url string if isPrd == true { @@ -109,7 +121,12 @@ func AlipayApplet(args map[string]string, isPrd bool) (string, error) { if err != nil { return "", err } - return string(bytes), nil + var data AlipayAppletData + err = json.Unmarshal(bytes, &data) + if err != nil { + return "", errors.New("支付失败") + } + return zhios_pay_utils.SerializeStr(data), nil } // 微信app支付v2