Просмотр исходного кода

修复:
1. 数据库查询过慢的问题
2. 修复服务器java端查不到配置文件的问题

skyfffire 3 лет назад
Родитель
Сommit
11806a2dd6

+ 1 - 2
.gitignore

@@ -3,5 +3,4 @@
 target/
 out/
 
-*.pem
-*.sql
+pem/

+ 63 - 86
.idea/httpRequests/http-requests-log.http

@@ -1,3 +1,66 @@
+POST http://localhost:8088/ethmev/findByHashOrBlockOrDataVague
+Content-Type: application/x-www-form-urlencoded
+
+timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-31T163804.200.json
+
+###
+
+POST http://localhost:8088/ethmev/findByHashOrBlockOrDataVague
+Content-Type: application/x-www-form-urlencoded
+
+dataVague=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-31T163629.200.json
+
+###
+
+POST http://localhost:8088/ethmev/findByHashOrBlockOrDataVague
+Content-Type: application/x-www-form-urlencoded
+
+dataVague=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-31T163246.200.json
+
+###
+
+POST http://192.168.101.42:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-31T161913.200.json
+
+###
+
+POST http://192.168.101.42:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-31T161436.200.json
+
+###
+
+POST http://192.168.101.42:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-31T161432.200.json
+
+###
+
+POST http://192.168.101.42:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-31T161222.404.html
+
+###
+
 POST http://localhost:8088/swappath/findLevel2PathByLpAddress
 Content-Type: application/x-www-form-urlencoded
 
@@ -379,89 +442,3 @@ lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=33820
 
 ###
 
-POST http://localhost:8088/swappath/findPathByLpAddress
-Content-Type: application/x-www-form-urlencoded
-
-lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
-
-<> 2022-10-22T110152.500.html
-
-###
-
-POST http://localhost:8088/swappath/findPathByLpAddress
-Content-Type: application/x-www-form-urlencoded
-
-timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
-
-<> 2022-10-22T110118.200.json
-
-###
-
-POST http://localhost:8088/swappath/findPathByLpAddress
-Content-Type: multipart/x-www-form-urlencoded
-
-timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
-
-<> 2022-10-22T105957.200.json
-
-###
-
-POST http://localhost:8088/swappath/findPathByLpAddress
-Content-Type: multipart/form-data
-
-{
-timestamp: 12345
-auth: 338209cfc53e9db6d344073335e47cf0
-}
-
-<> 2022-10-22T105016.200.json
-
-###
-
-POST http://localhost:8088/swappath/findPathByLpAddress
-Content-Type: multipart/form-data; boundary=WebAppBoundary
-
---WebAppBoundary
-Content-Disposition: form-data; name="field-name"
-
-
---WebAppBoundary
-
-
-{
-timestamp: 12345
-auth: 338209cfc53e9db6d344073335e47cf0
-}
---WebAppBoundary--
-
-<> 2022-10-22T104906.200.json
-
-###
-
-POST http://localhost:8088/swappath/findPathByLpAddress
-Content-Type: multipart/form-data; boundary=WebAppBoundary
-
---WebAppBoundary
-Content-Disposition: form-data; name="field-name"
-
-timestamp: 12345
-auth: 338209cfc53e9db6d344073335e47cf0
---WebAppBoundary--
-
-<> 2022-10-22T104744.200.json
-
-###
-
-POST http://localhost:8088/swappath/findPathByLpAddress
-Content-Type: multipart/form-data; boundary=WebAppBoundary
-
---WebAppBoundary
-Content-Disposition: form-data; name="field-name"
-
-field-value
---WebAppBoundary--
-
-<> 2022-10-22T104649.200.json
-
-###
-

+ 9 - 1
src/main/java/common/config/WebConfig.java

@@ -14,6 +14,8 @@ import common.memory.SwapPathMemoryDb;
 import common.model.EthMev;
 import common.model.SwapPath;
 
+import java.io.File;
+
 public class WebConfig extends JFinalConfig {
     static Prop p;
 
@@ -22,7 +24,13 @@ public class WebConfig extends JFinalConfig {
     }
 
     static void loadConfig() {
-        if (p == null) p = PropKit.useFirstFound("/webapp/backend/evi.properties", "evi-dev.properties");
+        if (p == null) {
+            try {
+                p = PropKit.use(new File("/webapp/backend/evi.properties"));
+            } catch (Exception e) {
+                p = PropKit.useFirstFound("evi-dev.properties");
+            }
+        }
     }
 
     @Override

+ 4 - 4
src/main/java/modules/ethmev/EthMevController.java

@@ -125,19 +125,19 @@ public class EthMevController extends Controller {
         if (StrKit.isBlank(getPara("block"))
                 && StrKit.isBlank(getPara("hash"))
                 && StrKit.isBlank(getPara("dataVague"))) {
-            sql = "select * from t_ethereum_mev_v1 where block regexp '^[-0-9]{8,10}$' order by block desc limit ?,?";
+            sql = "select * from t_ethereum_mev_v1 where block regexp '^[-0-9]{8,10}' order by block desc limit ?,?";
             ethMevList = EthMev.dao.find(sql, limit1, limit2);
         } else if (StrKit.isBlank(getPara("block")) && StrKit.isBlank(getPara("hash"))) {
-            sql = "select * from t_ethereum_mev_v1 where block regexp '^[-0-9]{8,10}$' and data like ? order by block desc limit ?,?";
+            sql = "select * from t_ethereum_mev_v1 where block regexp '^[-0-9]{8,10}' and data like ? order by block desc limit ?,?";
             ethMevList = EthMev.dao.find(sql, dataVague, limit1, limit2);
         } else if (StrKit.isBlank(getPara("block")) && StrKit.isBlank(getPara("dataVague"))) {
-            sql = "select * from t_ethereum_mev_v1 where block regexp '^[-0-9]{8,10}$' and  hash=? order by block desc limit ?,?";
+            sql = "select * from t_ethereum_mev_v1 where block regexp '^[-0-9]{8,10}' and hash=? order by block desc limit ?,?";
             ethMevList = EthMev.dao.find(sql, hash, limit1, limit2);
         } else if (StrKit.isBlank(getPara("hash")) && StrKit.isBlank(getPara("dataVague"))) {
             sql = "select * from t_ethereum_mev_v1 where block=? order by block desc limit ?,?";
             ethMevList = EthMev.dao.find(sql, block, limit1, limit2);
         } else if (StrKit.isBlank(getPara("block"))) {
-            sql = "select * from t_ethereum_mev_v1 where block regexp '^[-0-9]{8,10}$' and hash=? and data like ? order by block desc limit ?,?";
+            sql = "select * from t_ethereum_mev_v1 where block regexp '^[-0-9]{8,10}' and hash=? and data like ? order by block desc limit ?,?";
             ethMevList = EthMev.dao.find(sql, hash, dataVague, limit1, limit2);
         } else if (StrKit.isBlank(getPara("hash"))) {
             sql = "select * from t_ethereum_mev_v1 where block=? and data like ? order by block desc limit ?,?";

+ 1 - 1
src/main/resources/evi-dev.properties

@@ -1,5 +1,5 @@
 # db config
-dbUrl=jdbc:mysql://127.0.0.1:3306/ethmev?useSSL=false
+dbUrl=jdbc:mysql://192.168.101.41:3306/ethmev?useSSL=false
 dbUser=root
 dbPwd=123456
 

+ 9 - 0
src/test/http/EthMev.http

@@ -0,0 +1,9 @@
+###
+POST {{ baseUrl }}/ethmev/findByHashOrBlockOrDataVague
+Content-Type: application/x-www-form-urlencoded
+
+# dataVague=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+
+###

+ 3 - 0
src/test/http/http-client.env.json

@@ -2,6 +2,9 @@
   "dev": {
     "baseUrl": "http://localhost:8088"
   },
+  "local": {
+    "baseUrl": "http://192.168.101.42:8088"
+  },
   "pro": {
     "baseUrl": "http://www.410eth.com:8088"
   }

+ 2 - 1
upload

@@ -1,7 +1,8 @@
 sudo scp -i 410.pem /Volumes/Code/Customer/410/ethereum_viewer_interface/target/ethereum_viewer_interface.war ec2-user@3.227.34.41:/webapp/backend/apache-tomcat-interface/webapps
 sudo scp -i 410.pem /Volumes/Code/Customer/410/ethereum_viewer_interface/server.xml ec2-user@3.227.34.41:/webapp/backend/apache-tomcat-interface/conf
 
-scp -i 410.pem C:/Users/skyfffire/IdeaProjects/ethereum_viewer_interface/target/ethereum_viewer_interface.war ec2-user@3.227.34.41:/webapp/backend/apache-tomcat-interface/webapps
+scp -i pem/410.pem C:/Users/skyfffire/IdeaProjects/ethereum_viewer_interface/target/ethereum_viewer_interface.war ec2-user@3.227.34.41:/webapp/backend/apache-tomcat-interface/webapps
+scp -i pem/local.pem C:/Users/skyfffire/IdeaProjects/ethereum_viewer_interface/target/ethereum_viewer_interface.war root@192.168.101.42:/webapp/backend/apache-tomcat-interface/webapps
 
 start:
 /webapp/backend/apache-tomcat-interface/bin/startup.sh