123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <!doctype html>
- <html>
- <head>
- <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
- <meta http-equiv="Expires" CONTENT="0">
- <meta http-equiv="Cache-Control" CONTENT="no-cache">
- <meta http-equiv="Pragma" CONTENT="no-cache">
- <title>微信支付</title>
- </head>
- <style>
- body iframe{
- display: none;
- opacity: 0;
- }
- </style>
- <body style="width:100%;height:100%;text-align: center;">
- <div style="color:#FFF;margin-top:40px;">
- </div>
- <script type="text/javascript">
-
- //删除所有非法url
-
- window.alert = function(name){
- var iframe = document.createElement("IFRAME");
- iframe.style.display="none";
- iframe.setAttribute("src", 'data:text/plain,');
- document.documentElement.appendChild(iframe);
- window.frames[0].window.alert(name);
- iframe.parentNode.removeChild(iframe);
- };
- var is_pay = false;
- //调用微信JS api 支付
- function jsApiCall()
- {
- WeixinJSBridge.invoke(
- 'getBrandWCPayRequest',<?php echo $jsApiParameters; ?>,
- function(res){
- if (res.err_msg == 'get_brand_wcpay_request:ok') {//支付成功
- goNotice('success');
- } else if (res.err_msg == 'get_brand_wcpay_request:cancel') {//支付过程中用户取消
- alert('取消支付/(ㄒoㄒ)/~~');
- goNotice('cancel');
- } else if (res.err_msg == 'get_brand_wcpay_request:fail') {//支付失败
- alert('支付失败/(ㄒoㄒ)/~~');
- goNotice('fail');
- }else{
- alert('支付失败/(ㄒoㄒ)/~~');
- goNotice('fail');
- }
- }
- );
- }
- function goNotice(status){
- var notifyUrl = '<?php echo $notify_url; ?>';
- if(notifyUrl.indexOf('?')==-1){
- //不存在的话
- notifyUrl += ('?_wxPay_='+status+"&_time_="+Math.random());
- }else{
- notifyUrl += ('&_wxPay_='+status+"&_time_="+Math.random());
- }
- window.location.href = notifyUrl;
- return false;
- }
- 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();
- }
- }
- function writeObj(obj){
- var description = "";
- for(var i in obj){
- var property=obj[i];
- description+=i+" = "+property+"\n";
- }
- alert(description);
- }
- callpay();
- </script>
- </body>
- </html>
- <?php exit;?>
|