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