This commit is contained in:
eric
2025-12-17 06:55:36 -06:00
parent 1e1374f665
commit a7ba3b5375
3 changed files with 70 additions and 6 deletions

View File

@@ -136,10 +136,29 @@ const Index = () => {
},
});
} else {
let nowUrl = window.location.href;
// let nowUrl = window.location.href;
// window.localStorage.removeItem("openid");
// // let payUrl = `https://payjs.cn/api/openid?mchid=1561724891&callback_url=${nowUrl}`;
// let payUrl = `https://xorpay.com/api/openid/8220&callback_url=${nowUrl}`;
// window.location.href = payUrl;
// 清除旧 openid可选建议保留
window.localStorage.removeItem("openid");
let payUrl = `https://payjs.cn/api/openid?mchid=1561724891&callback_url=${nowUrl}`;
window.location.href = payUrl;
// 当前完整 URL包括 ? 参数和 # hash
let nowUrl = window.location.href;
// 正确构造 XorPay openid 获取地址
// 1. 参数名必须是 callback
// 2. 值必须 encodeURIComponent 编码
let payUrl = `https://xorpay.com/api/openid/8220?callback=${encodeURIComponent(
nowUrl
)}`;
console.log("跳转获取 openid 的 URL:", payUrl);
// 示例输出https://xorpay.com/api/openid/8220?callback=http%3A%2F%2F192.168.31.222%3A10086%2F%23%2Fpay
// window.location.href = payUrl;
}
};