|
|
@ -201,46 +201,46 @@ class wxpay |
|
|
$this->setParameter("notify_url", __URL__ . 'wxpay.php'); // 通知地址 |
|
|
$this->setParameter("notify_url", __URL__ . 'wxpay.php'); // 通知地址 |
|
|
$this->setParameter("trade_type", "JSAPI"); // 交易类型 |
|
|
$this->setParameter("trade_type", "JSAPI"); // 交易类型 |
|
|
|
|
|
|
|
|
$prepay_id = $this->getPrepayId(); |
|
|
// $prepay_id = $this->getPrepayId(); |
|
|
$jsApiParameters = $this->getParameters($prepay_id); |
|
|
// $jsApiParameters = $this->getParameters($prepay_id); |
|
|
// wxjsbridge |
|
|
// wxjsbridge |
|
|
$js = ' |
|
|
// $js = ' |
|
|
<script language="javascript"> |
|
|
// <script language="javascript"> |
|
|
function jsApiCall(){ |
|
|
// function jsApiCall(){ |
|
|
WeixinJSBridge.invoke("getBrandWCPayRequest", |
|
|
// WeixinJSBridge.invoke("getBrandWCPayRequest", |
|
|
' . $jsApiParameters . ', |
|
|
// ' . $jsApiParameters . ', |
|
|
function(res){ |
|
|
// function(res){ |
|
|
if(res.err_msg == "get_brand_wcpay_request:ok") |
|
|
// if(res.err_msg == "get_brand_wcpay_request:ok") |
|
|
{ |
|
|
// { |
|
|
location.href="' . return_url(basename(__FILE__, '.php')) . '" |
|
|
// location.href="' . return_url(basename(__FILE__, '.php')) . '" |
|
|
}else |
|
|
// }else |
|
|
{ |
|
|
// { |
|
|
|
|
|
|
|
|
} |
|
|
// } |
|
|
} |
|
|
// } |
|
|
) |
|
|
// ) |
|
|
}; |
|
|
// }; |
|
|
function callpay() |
|
|
// function callpay() |
|
|
{ |
|
|
// { |
|
|
if (typeof WeixinJSBridge == "undefined") |
|
|
// if (typeof WeixinJSBridge == "undefined") |
|
|
{ |
|
|
// { |
|
|
if( document.addEventListener ) |
|
|
// if( document.addEventListener ) |
|
|
{ |
|
|
// { |
|
|
document.addEventListener("WeixinJSBridgeReady", jsApiCall, false); |
|
|
// document.addEventListener("WeixinJSBridgeReady", jsApiCall, false); |
|
|
}else if (document.attachEvent) |
|
|
// }else if (document.attachEvent) |
|
|
{ |
|
|
// { |
|
|
document.attachEvent("WeixinJSBridgeReady", jsApiCall); |
|
|
// document.attachEvent("WeixinJSBridgeReady", jsApiCall); |
|
|
document.attachEvent("onWeixinJSBridgeReady", jsApiCall); |
|
|
// document.attachEvent("onWeixinJSBridgeReady", jsApiCall); |
|
|
} |
|
|
// } |
|
|
}else |
|
|
// }else |
|
|
{ |
|
|
// { |
|
|
jsApiCall(); |
|
|
// jsApiCall(); |
|
|
} |
|
|
// } |
|
|
} |
|
|
// } |
|
|
</script>'; |
|
|
// </script>'; |
|
|
|
|
|
|
|
|
$button = '<a class="box-flex btn-submit" type="button" onclick="callpay()">微信支付(测试)</a>' . $js; |
|
|
// $button = '<a class="box-flex btn-submit" type="button" onclick="callpay()">微信支付(测试)</a>' . $js; |
|
|
// $button = '<a class="box-flex btn-submit" type="button" onclick="$this->pay()">微信支付</a>'; |
|
|
$button = '<a class="box-flex btn-submit" type="button" onclick="">微信支付(测试)</a>'; |
|
|
|
|
|
|
|
|
return $button; |
|
|
return $button; |
|
|
|
|
|
|
|
|
|