Browse Source

test

master
用户名 3 years ago
parent
commit
e94dd2a80d
  1. 78
      mobile/plugins/payment/wxpay.php

78
mobile/plugins/payment/wxpay.php

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

Loading…
Cancel
Save