Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27f941768a | ||
|
|
63ae9e7433 | ||
|
|
2d242988e1 | ||
|
|
c976264581 |
@@ -5,7 +5,7 @@
|
|||||||
<meta charset='UTF-8'>
|
<meta charset='UTF-8'>
|
||||||
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
|
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
|
||||||
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
||||||
<title>顺诚百宝箱</title>
|
<title>支付测试- 顺诚百宝箱</title>
|
||||||
<style>
|
<style>
|
||||||
* {
|
* {
|
||||||
margin: 10px auto;
|
margin: 10px auto;
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let response = await fetch('/pay/createOrder?n=' + n + '&t=test');
|
let response = await fetch('/pay/createOrder?n=' + n + '&t=test');
|
||||||
let res = eval("(" + await response.text() + ")");
|
let res = JSON.parse(await response.text());
|
||||||
|
|
||||||
if (res.code == 1) {
|
if (res.code == 1) {
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
alert('获取二维码失败');
|
alert('获取二维码失败');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$('.imgs').html("<img src='data:image/jpg;base64," + img + "'><br><a href='" + code + "'>手机点这里打开支付宝APP</a><br>使用支付宝扫一扫<br><button onclick='selectPay(" + id + ")'>查询支付状态</button> <button onclick='getPayQr()'>刷新二维码</button>");
|
$('.imgs').html("<img src='data:image/jpg;base64," + img + "'><br><a href='alipays://platformapi/startapp?saId=10000007&qrcode=" + code + "'>手机点这里打开支付宝APP</a><br>使用支付宝扫一扫<br><button onclick='selectPay(" + id + ")'>查询支付状态</button> <button onclick='getPayQr()'>刷新二维码</button>");
|
||||||
subscribe(id);
|
subscribe(id);
|
||||||
|
|
||||||
} else alert('遇到错误 ' + res.msg);
|
} else alert('遇到错误 ' + res.msg);
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
await subscribe(id);
|
await subscribe(id);
|
||||||
} else {
|
} else {
|
||||||
// 获取并显示消息
|
// 获取并显示消息
|
||||||
let message = eval("(" + await response.text() + ")");
|
let message = JSON.parse(await response.text());
|
||||||
|
|
||||||
// 再次调用 subscribe() 以获取下一条消息
|
// 再次调用 subscribe() 以获取下一条消息
|
||||||
if (message.msg == "已支付") {
|
if (message.msg == "已支付") {
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
*/
|
*/
|
||||||
async function selectPay(id) {
|
async function selectPay(id) {
|
||||||
let response = await fetch('/pay/queryPay?id=' + id);
|
let response = await fetch('/pay/queryPay?id=' + id);
|
||||||
let res = eval("(" + await response.text() + ")");
|
let res = JSON.parse(await response.text());
|
||||||
|
|
||||||
if (response.status == 200 && res.msg == "已支付") {
|
if (response.status == 200 && res.msg == "已支付") {
|
||||||
return okPay();
|
return okPay();
|
||||||
|
|||||||
@@ -359,7 +359,7 @@ public static String putImg(ServletContext servletContext,MultipartFile file,Str
|
|||||||
saveSql(realurl, towhere,fileName);
|
saveSql(realurl, towhere,fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(servletContext != null) return "/getFile/"+rid;
|
if(servletContext != null) return "/getImg/"+rid;
|
||||||
else return realurl;
|
else return realurl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -452,7 +452,7 @@ public static String putImgAsName(ServletContext servletContext,MultipartFile fi
|
|||||||
saveSql(realurl, towhere,fileName);
|
saveSql(realurl, towhere,fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(servletContext != null) return "/getFile/"+rid;
|
if(servletContext != null) return "/getImg/"+rid;
|
||||||
else return realurl;
|
else return realurl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -548,7 +548,7 @@ public static String putVideo(ServletContext servletContext,MultipartFile file,S
|
|||||||
saveSql(realurl, towhere,fileName);
|
saveSql(realurl, towhere,fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(servletContext != null) return "/getFile/"+rid;
|
if(servletContext != null) return "/getImg/"+rid;
|
||||||
else return realurl;
|
else return realurl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -669,8 +669,8 @@ public static void saveSql(String realurl, String towhere, String saveName) {
|
|||||||
String msid = towhere.split("#")[1];
|
String msid = towhere.split("#")[1];
|
||||||
String mstag = towhere.split("#")[2];
|
String mstag = towhere.split("#")[2];
|
||||||
|
|
||||||
if(realurl.indexOf("/getFile/")==0) {
|
if(realurl.indexOf("/getImg/")==0) {
|
||||||
realurl=realurl.replace("/getFile/", "");
|
realurl=realurl.replace("/getImg/", "");
|
||||||
if(db.execSql("select * from savefile where id = '"+realurl+"'", null)>0){//已存在
|
if(db.execSql("select * from savefile where id = '"+realurl+"'", null)>0){//已存在
|
||||||
db.execUpdate("update savefile set mstab=?,msid=?,mstag=?,savename=? where id=?", new String[]{mstab.trim(),msid.trim(),mstag.trim(),realurl.trim(),saveName==null?"":saveName.trim()});
|
db.execUpdate("update savefile set mstab=?,msid=?,mstag=?,savename=? where id=?", new String[]{mstab.trim(),msid.trim(),mstag.trim(),realurl.trim(),saveName==null?"":saveName.trim()});
|
||||||
}else{//不存在
|
}else{//不存在
|
||||||
@@ -780,8 +780,8 @@ public static void delfile(ServletContext servletContext, String path) {
|
|||||||
if(path.indexOf(":") <= 0)
|
if(path.indexOf(":") <= 0)
|
||||||
path1 = "D:\\" + path;
|
path1 = "D:\\" + path;
|
||||||
} else {
|
} else {
|
||||||
if(path.indexOf("/getFile/")==0){
|
if(path.indexOf("/getImg/")==0){
|
||||||
String rid = path.replace("/getFile/", "");
|
String rid = path.replace("/getImg/", "");
|
||||||
DBUtil db = new DBUtil();
|
DBUtil db = new DBUtil();
|
||||||
List<Map<String, Object>> rs = db.execQuery("select * from savefile where id ="+rid, null);
|
List<Map<String, Object>> rs = db.execQuery("select * from savefile where id ="+rid, null);
|
||||||
if(rs!=null&&rs.size()>0){
|
if(rs!=null&&rs.size()>0){
|
||||||
@@ -828,8 +828,8 @@ public static void delFileForStr(ServletContext servletContext, String str) {
|
|||||||
if(path.indexOf(":") <= 0)
|
if(path.indexOf(":") <= 0)
|
||||||
path1 = "D:\\" + path;
|
path1 = "D:\\" + path;
|
||||||
} else {
|
} else {
|
||||||
if(path.indexOf("/getFile/")==0){
|
if(path.indexOf("/getImg/")==0){
|
||||||
String rid = path.replace("/getFile/", "");
|
String rid = path.replace("/getImg/", "");
|
||||||
List<Map<String, Object>> rs = db.execQuery("select * from savefile where id ="+rid, null);
|
List<Map<String, Object>> rs = db.execQuery("select * from savefile where id ="+rid, null);
|
||||||
if(rs!=null&&rs.size()>0){
|
if(rs!=null&&rs.size()>0){
|
||||||
oldpath=rs.get(0).get("realurl")+"";
|
oldpath=rs.get(0).get("realurl")+"";
|
||||||
@@ -867,8 +867,8 @@ public static void intoSqlForStr(String str,String towhere,String saveName) {
|
|||||||
mstag = towhere.split("#")[2];
|
mstag = towhere.split("#")[2];
|
||||||
|
|
||||||
for (String path : imgs) {
|
for (String path : imgs) {
|
||||||
if(path.indexOf("/getFile/")==0){
|
if(path.indexOf("/getImg/")==0){
|
||||||
String rid = path.replace("/getFile/", "");
|
String rid = path.replace("/getImg/", "");
|
||||||
List<Map<String, Object>> rs = db.execQuery("select * from savefile where id ="+rid, null);
|
List<Map<String, Object>> rs = db.execQuery("select * from savefile where id ="+rid, null);
|
||||||
if(rs!=null&&rs.size()>0){
|
if(rs!=null&&rs.size()>0){
|
||||||
path=rs.get(0).get("realurl")+"";
|
path=rs.get(0).get("realurl")+"";
|
||||||
|
|||||||
Reference in New Issue
Block a user