4 Commits
r24 ... r28

Author SHA1 Message Date
admin
ab81cecff0 bug 2024-02-26 13:15:12 +08:00
麒麟
595e1a8c20 bug 2023-09-11 23:16:00 +08:00
麒麟
295e1771ab bug 2023-09-11 22:27:14 +08:00
麒麟
7638b8c5cd bug 2023-09-11 22:24:54 +08:00
7 changed files with 51 additions and 51 deletions

2
.idea/misc.xml generated
View File

@@ -8,7 +8,7 @@
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@@ -17,16 +17,16 @@ public class Interceptor implements HandlerInterceptor {
request.setCharacterEncoding("utf-8");
if(
(Utils.getPeoperties("aliNotifyUrl")+"").replace("null","").trim().length()<1
|| (Utils.getPeoperties("appid")+"").replace("null","").trim().length()<1
|| (Utils.getPeoperties("private_key")+"").replace("null","").trim().length()<1
|| (Utils.getPeoperties("public_key")+"").replace("null","").trim().length()<1
|| (Utils.getPeoperties("pwd")+"").replace("null","").trim().length()<1
|| (Utils.getPeoperties("dburl")+"").replace("null","").trim().length()<1
|| (Utils.getPeoperties("dbport")+"").replace("null","").trim().length()<1
|| (Utils.getPeoperties("dbname")+"").replace("null","").trim().length()<1
|| (Utils.getPeoperties("dbusername")+"").replace("null","").trim().length()<1
|| (Utils.getPeoperties("dbpassword")+"").replace("null","").trim().length()<1
Utils.getPeoperties("aliNotifyUrl").replace("null","").trim().length()<1
|| Utils.getPeoperties("appid").replace("null","").trim().length()<1
|| Utils.getPeoperties("private_key").replace("null","").trim().length()<1
|| Utils.getPeoperties("public_key").replace("null","").trim().length()<1
|| Utils.getPeoperties("pwd").replace("null","").trim().length()<1
|| Utils.getPeoperties("dburl").replace("null","").trim().length()<1
|| Utils.getPeoperties("dbport").replace("null","").trim().length()<1
|| Utils.getPeoperties("dbname").replace("null","").trim().length()<1
|| Utils.getPeoperties("dbusername").replace("null","").trim().length()<1
|| Utils.getPeoperties("dbpassword").replace("null","").trim().length()<1
){
response.sendRedirect("./install.html");
return false;

View File

@@ -22,7 +22,7 @@ import com.utils.Utils;
public class alipay_core {
AlipayClient client = null;
/**支付宝回调的接口地址*/
private static String aliNotifyUrl = Utils.getPeoperties("aliNotifyUrl")+"";
private static String aliNotifyUrl = Utils.getPeoperties("aliNotifyUrl");
/**
@@ -30,9 +30,9 @@ public class alipay_core {
*/
public void getConfig() {
String appid = Utils.getPeoperties("appid")+"";
String private_key = Utils.getPeoperties("private_key")+"";
String public_key = Utils.getPeoperties("public_key")+"";
String appid = Utils.getPeoperties("appid");
String private_key = Utils.getPeoperties("private_key");
String public_key = Utils.getPeoperties("public_key");
String sign_type="RSA2";
client =new DefaultAlipayClient("https://openapi.alipay.com/gateway.do",appid,private_key,"json","utf-8",public_key,sign_type);
@@ -46,7 +46,9 @@ public class alipay_core {
public static void main(String[] args) {
System.out.println(Utils.QrImgB64("aaa",200));
String s = Utils.getPeoperties("private_key");
System.out.println(s);
}
/**

View File

@@ -139,7 +139,7 @@ public class payController {
//检查数据是否已经初始化,若没有,先设置后台密码
String pwd = Utils.getPeoperties("pwd") + "";
String pwd = Utils.getPeoperties("pwd");
if(pwd.replace("null","").trim().length()>0){
Map<String,String> m = new HashMap<>();
m.put("code","1");
@@ -170,7 +170,9 @@ public class payController {
HttpServletResponse response
) {
String pwd = Utils.getPeoperties("pwd") + "";
System.out.println(v);
String pwd = Utils.getPeoperties("pwd");
if(pwd.replace("null","").trim().length()<1){
Map<String,String> m = new HashMap<>();
m.put("code","-1");
@@ -181,16 +183,16 @@ public class payController {
//获取配置
Map<String,String> m = new HashMap<>();
m.put("code","1");
m.put("pwd#后台密码",Utils.getPeoperties("pwd") + "");
m.put("dburl#数据库地址(不含http)",Utils.getPeoperties("dburl")+"");
m.put("dbname#数据库库名",Utils.getPeoperties("dbname")+"");
m.put("dbport#数据库端口",Utils.getPeoperties("dbport")+"");
m.put("dbusername#数据库用户名",Utils.getPeoperties("dbusername")+"");
m.put("dbpassword#数据库密码",Utils.getPeoperties("dbpassword")+"");
m.put("aliNotifyUrl#当面付回调地址",Utils.getPeoperties("aliNotifyUrl")+"");
m.put("appid#当面付APPID",Utils.getPeoperties("appid")+"");
m.put("private_key#当面付私钥",Utils.getPeoperties("private_key")+"");
m.put("public_key#当面付公钥",Utils.getPeoperties("public_key")+"");
m.put("pwd#后台密码",Utils.getPeoperties("pwd"));
m.put("dburl#数据库地址(不含http)",Utils.getPeoperties("dburl"));
m.put("dbname#数据库库名",Utils.getPeoperties("dbname"));
m.put("dbport#数据库端口",Utils.getPeoperties("dbport"));
m.put("dbusername#数据库用户名",Utils.getPeoperties("dbusername"));
m.put("dbpassword#数据库密码",Utils.getPeoperties("dbpassword"));
m.put("aliNotifyUrl#当面付回调地址",Utils.getPeoperties("aliNotifyUrl"));
m.put("appid#当面付APPID",Utils.getPeoperties("appid"));
m.put("private_key#当面付私钥",Utils.getPeoperties("private_key"));
m.put("public_key#当面付公钥",Utils.getPeoperties("public_key"));
return Utils.ObjectToJson(m);
}else if(pwd.equals(p)){

View File

@@ -16,11 +16,11 @@ import java.util.Map;
public class DBUtil {
// 四大金刚
String dname = Utils.getPeoperties("dbname")+"";
String dname = Utils.getPeoperties("dbname");
String driver = "com.mysql.jdbc.Driver";// 驱动名称
String url = "jdbc:mysql://"+Utils.getPeoperties("dburl")+":"+Utils.getPeoperties("dbport")+"/"+dname+"?useUnicode=false&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&autoReconnect=true&useSSL=false";// 连接
String username = Utils.getPeoperties("dbusername")+"";// 用户名
String password = Utils.getPeoperties("dbpassword")+"";// 密码
String username = Utils.getPeoperties("dbusername");// 用户名
String password = Utils.getPeoperties("dbpassword");// 密码
// 三剑客
Connection con = null;// 连接对象

View File

@@ -12,6 +12,7 @@ import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.URL;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@@ -141,7 +142,8 @@ public class Utils {
return resMatrix;
}
public static Properties readPeoperties(){
public static String getPeoperties(Object k){
InputStream inputStream = Utils.class.getClassLoader().getResourceAsStream("t.properties");
Properties p = new Properties();
@@ -150,19 +152,10 @@ public class Utils {
}catch(Exception e1) {
e1.printStackTrace();
}
return p;
}
public static Object getPeoperties(Object k){
InputStream inputStream = Utils.class.getClassLoader().getResourceAsStream("t.properties");
Properties p = new Properties();
try{
p.load(inputStream);
}catch(Exception e1) {
e1.printStackTrace();
}
return p.get(k);
return p.get(k)+"";
}
public static void setPeoperties(String k,Object v){
@@ -180,7 +173,6 @@ public class Utils {
URL f = Utils.class.getClassLoader().getResource("t.properties");
try{
System.out.println(f.toURI());
FileOutputStream fos = new FileOutputStream(new File(f.toURI()));
p.store(new BufferedOutputStream(fos),"save");
fos.close();

View File

@@ -20,7 +20,7 @@
<br><br>
<div id="kvs">
输入后台密码获取配置:
<input type="text" name="p" id="p"> <button onclick="setp()">提交</button>
<input type="text" name="p" id="p" placeholder="输入密码"> <button onclick="setp()">获取</button>
</div>
<br>
@@ -28,7 +28,7 @@
<button onclick="createTable()">运行数据库建表程序</button>
<br> <br> <br>
测试环境tomcat8.5jdk1.8
<a href="https://scboxs.com/bbs/info?id=3">官网教程</a>
<br>
<br> 支付宝开放平台https://open.alipay.com/
<br> 本人以_创建网页应用_做步骤展示:
@@ -36,7 +36,9 @@
<br>
<br> 2.创建成功后,点击“开发设置”,设置【接口加签方式】选择“秘钥”,根据步骤提示下载"秘钥工具"安装,根据提示步骤生成秘钥,按照步骤填写公钥,下载生成的公钥文件,一定要保存好。
<br>
<br> 3.还是上步骤的“开发设置”里填写【支付宝网关地址】,此地址与下述java代码里的支付宝回调地址是一个东西本测试代码填写的是yourweb/war名称[根目录此项去掉]/alinotify。用户支付成功后支付宝会将成功数据发送到你填的这个网关地址上
<br> 3.还是上步骤的“开发设置”里填写【支付宝网关地址】,此地址与上述参数配置里的当面付回调地址是一个东西本测试代码填写的是yourweb/war名称[根目录此项去掉]/alinotify。
<br> 系统监测到你应该填写:<span style="color: red;" id="al"></span> (仅供参考,若错误请自行填写)
<br> 用户支付成功后支付宝会将成功数据发送到你填的这个网关地址上
<br>
<br> 4.在“产品绑定”页面,点击去绑定,在产品里找到"当面付",选中,点击确定。
<br>
@@ -76,11 +78,10 @@
var e0 = document.createElement('span');
e0.innerHTML=ks[1]+"";
var e1 = document.createElement('input');
e1.setAttribute("type","text");
var e1 = document.createElement('textarea');
e1.setAttribute("name",ks[0]);
e1.setAttribute("id",ks[0]);
e1.setAttribute("value",v);
e1.innerHTML = v;
var e2 = document.createElement('button');
e2.setAttribute("onclick","setk('"+res['pwd#后台密码']+"','"+ks[0]+"')");
@@ -104,7 +105,7 @@
async function setk(pwd,k) {
var p = $('#'+k).val();
let response = await fetch('./settings?p='+pwd+'&k='+k+'&v=' + p);
let response = await fetch('./settings?p='+pwd+'&k='+k+'&v=' + encodeURIComponent(p));
let res = JSON.parse(await response.text());
if(res.code / 1 == 1){
alert(res.msg);
@@ -118,6 +119,9 @@
if(res.msg) alert(res.msg);
if(res.url) window.location.href = res.url;
}
var ph = window.location.pathname.split('/');
$("#al").html(window.location.protocol+'//'+window.location.host+(ph.length>2?('/'+ph[1]):ph[0])+'/alinotify');
</script>
</body>