Commit 25c285fd authored by renjie's avatar renjie

支付宝接口

parent b28528b7
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>1</title> <title>1</title>
<script src="https://www.fangguanlian.cn/home/js/plugin/jq.min.js"></script> <script src="https://www.fangguanlian.cn/home/js/plugin/jq.min.js"></script>
</head> </head>
<body> <body>
<div id="test"> <div id="buy">
</div> </div>
<script> <script>
test(); buy();
function test(str = location.href.split('?')[1]){ function buy(str = location.href.split('?')[1]){
let token = decodeURIComponent(str).split("token_get_pay=")[1].split("&html_get_pay=")[0] let token = decodeURIComponent(str).split("token_get_pay=")[1].split("&html_get_pay=")[0]
let html =decodeURIComponent(str).split("token_get_pay=")[1].split("&html_get_pay=")[1].split("&html_get_pay_money=")[0] let html =decodeURIComponent(str).split("token_get_pay=")[1].split("&html_get_pay=")[1].split("&html_get_pay_money=")[0]
let total =decodeURIComponent(str).split("token_get_pay=")[1].split("&html_get_pay=")[1].split("&html_get_pay_money=")[1] let total =decodeURIComponent(str).split("token_get_pay=")[1].split("&html_get_pay=")[1].split("&html_get_pay_money=")[1]
$("#test").append(html) $("#buy").append(html)
} }
function getUrlParams() { function getUrlParams() {
const bundleUrl = location.href; const bundleUrl = location.href;
let params = bundleUrl.split('?')[1]; let params = bundleUrl.split('?')[1];
params = params ? paramsToObj(params) : {}; params = params ? paramsToObj(params) : {};
return params; return params;
} }
function paramsToObj(str) { function paramsToObj(str) {
let obj = {}; let obj = {};
try { try {
obj = JSON.parse('{"' + decodeURI(str).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}'); obj = JSON.parse('{"' + decodeURI(str).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}');
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
return obj; return obj;
} }
</script> </script>
</body> </body>
</html> </html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment