代码拉取完成,页面将自动刷新
同步操作将从 afan/tfyun 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>微信支付</title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
</head>
<body>
</body>
<script>
(function (){
var url = new URL(window.location.href);
if(url.searchParams.get("code")){
//重定向到payUrl
var map = JSON.parse(localStorage.getItem("searchData"));
var str = "";
for (var key in map){
str += key+"="+encodeURIComponent(map[key])+"&";
}
window.location.href = "/webos/commercial?"+str+"code="+url.searchParams.get("code");
}else if(url.searchParams.get("prepayId")){
//执行支付
const appId = url.searchParams.get("appId");
const timeStamp = url.searchParams.get("timeStamp");
const prepayId = url.searchParams.get("prepayId");
const paySign = url.searchParams.get("paySign");
const nonceStr = url.searchParams.get("nonceStr");
function onBridgeReady() {
WeixinJSBridge.invoke('getBrandWCPayRequest', {
"appId": appId, //公众号ID,由商户传入
"timeStamp": timeStamp, //时间戳,自1970年以来的秒数
"nonceStr": nonceStr, //随机串
"package": "prepay_id="+prepayId,
"signType": "RSA", //微信签名方式:
"paySign": paySign //微信签名
},
function(res) {
if (res.err_msg == "get_brand_wcpay_request:ok") {
alert("支付成功");
}
});
}
if (typeof WeixinJSBridge == "undefined") {
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
} else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
}
} else {
onBridgeReady();
}
}else{
//获取code
var fields = ["id"];
var keys = url.searchParams.keys();
var map = {};
while (true){
var keyData = keys.next();
if(keyData.done){
break;
}
var key = keyData.value;
if(!fields.includes(key)){
continue;
}
var value = url.searchParams.get(key);
map[key] = decodeURIComponent(value);
}
localStorage.setItem("searchData",JSON.stringify(map));
var ru = window.location.origin+window.location.pathname;
var appid = url.searchParams.get("appid");
var nu = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appid+"&redirect_uri="+encodeURIComponent(ru)+"&response_type=code&scope=snsapi_base&state=1#wechat_redirect";
window.location.href = nu;
}
})()
</script>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。