龚成明 3 anni fa
parent
commit
7b26eed776

+ 467 - 0
.idea/httpRequests/http-requests-log.http

@@ -0,0 +1,467 @@
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-29T185929.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-29T185928.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-29T185927.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-29T185925.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-29T185923-1.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-29T185923.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-29T185921.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-29T185917.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-29T182941.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-29T181844.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-29T175503.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-29T144639.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-29T144629.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-23T114313.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-23T114236.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-23T111657.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-23T111620.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-23T111241.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-23T111144.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-23T110640.200.json
+
+###
+
+POST https://httpbin.org/post
+Content-Type: application/json
+
+{
+  "id": 8b439e4c-87e8-4912-88ff-6719f35f09d6,
+  "price": 689,
+  "ts": 1666492372,
+  "value": "content"
+}
+
+<> 2022-10-23T103253.200.json
+
+###
+
+POST http://www.410eth.com:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-22T114310.200.json
+
+###
+
+GET http://www.410eth.com:8088/hello
+Content-Type: application/json
+
+<> 2022-10-22T114309.200.txt
+
+###
+
+POST http://{{baseUrl}}/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+###
+
+GET http://{{baseUrl}}/hello
+Content-Type: application/json
+
+###
+
+POST http://www.410eth.com:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address={{lp_address}}&timestamp={{timestamp}}&auth={{auth}}
+
+<> 2022-10-22T114159.200.json
+
+###
+
+POST http://www.410eth.com:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+{%:
+client.global.set("lp_address", "0x397FF1542f962076d0BFE58eA045FfA2d347ACa0");:
+client.global.set("timestamp", "12345");:
+client.global.set("auth", "338209cfc53e9db6d344073335e47cf0");:
+%}:
+
+lp_address={{lp_address}}&timestamp={{timestamp}}&auth={{auth}}
+
+<> 2022-10-22T114112.400.html
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+{%:
+client.global.set("lp_address", "0x397FF1542f962076d0BFE58eA045FfA2d347ACa0");:
+client.global.set("timestamp", "12345");:
+client.global.set("auth", "338209cfc53e9db6d344073335e47cf0");:
+%}:
+
+lp_address={{lp_address}}&timestamp={{timestamp}}&auth={{auth}}
+
+###
+
+POST http://{{%20baseUrl%20}}/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address={{lp_address}}&timestamp={{timestamp}}&auth={{auth}}
+
+###
+
+GET http://>%20{%
+client.global.set("lp_address", "0x397FF1542f962076d0BFE58eA045FfA2d347ACa0");:
+client.global.set("timestamp", "12345");:
+client.global.set("auth", "338209cfc53e9db6d344073335e47cf0");:
+%}:
+
+###
+
+POST http://www.410eth.com:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address={{lp_address}}&timestamp={{timestamp}}&auth={{auth}}
+
+<> 2022-10-22T113946.200.json
+
+###
+
+POST http://www.410eth.com:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+{% client.global.set("lp_address", "0x397FF1542f962076d0BFE58eA045FfA2d347ACa0"); %}}
+{% client.global.set("timestamp", "12345"); %}}
+{% client.global.set("auth", "338209cfc53e9db6d344073335e47cf0"); %}}
+lp_address={{lp_address}}&timestamp={{timestamp}}&auth={{auth}}
+
+<> 2022-10-22T113356.200.json
+
+###
+
+POST http://www.410eth.com:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+{% client.global.set("lp_address", "0x397FF1542f962076d0BFE58eA045FfA2d347ACa0"); %}}
+{% client.global.set("timestamp", "12345"); %}}
+{% client.global.set("auth", "338209cfc53e9db6d344073335e47cf0"); %}}
+lp_address={{$lp_address}}&timestamp=1666409620&auth={{$auth}}
+
+<> 2022-10-22T113340.200.json
+
+###
+
+GET https://httpbin.org/get
+
+<> 2022-10-22T112904.200.json
+
+###
+
+GET https://httpbin.org/get
+
+<> 2022-10-22T112903.200.json
+
+###
+
+GET https://httpbin.org/status/404
+
+###
+
+GET https://httpbin.org/status/200
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-22T112712.200.json
+
+###
+
+POST http://www.410eth.com:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-22T112549.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0
+&timestamp=12345
+&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-22T111437.200.json
+
+###
+
+POST http://localhost:8088/swappath/findLevel2PathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-22T111406.200.json
+
+###
+
+POST http://localhost:8088/swappath/findPathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-22T110957.200.json
+
+###
+
+POST http://localhost:8088/swappath/findPathByLpAddress
+Content-Type: application/x-www-form-urlencoded
+
+lp_address=0x397FF1542f962076d0BFE58eA045FfA2d347ACa0&timestamp=12345&auth=338209cfc53e9db6d344073335e47cf0
+
+<> 2022-10-22T110355.200.json
+
+###
+
+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
+
+###
+

+ 10 - 20
src/main/java/common/config/WebConfig.java

@@ -1,6 +1,8 @@
 package common.config;
 
 import com.jfinal.config.*;
+import com.jfinal.kit.Prop;
+import com.jfinal.kit.PropKit;
 import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
 import com.jfinal.plugin.druid.DruidPlugin;
 import com.jfinal.server.undertow.UndertowServer;
@@ -12,27 +14,22 @@ import common.memory.SwapPathMemoryDb;
 import common.model.EthMev;
 import common.model.SwapPath;
 
-import java.io.File;
-
 public class WebConfig extends JFinalConfig {
-    public static boolean IsDev = false;
-    private static String url = "jdbc:mysql://localhost:3306/ethmev?useSSL=false";
-    private static String user = "root";
-    private static String password = "Qwe410410.";
+    static Prop p;
 
     public static void main(String[] args) {
         UndertowServer.start(WebConfig.class, 8088, true);
     }
 
-    static {
-        // 识别运行环境
-        File file = new File(".debug");
-        IsDev = file.exists();
+    static void loadConfig() {
+        if (p == null) p = PropKit.useFirstFound("/webapp/backend/evi.jfc", "evi-dev.jfc");
     }
 
     @Override
     public void configConstant(Constants constants) {
-        constants.setDevMode(true);
+        loadConfig();
+
+        constants.setDevMode(p.getBoolean("devMode", false));
     }
 
     @Override
@@ -44,18 +41,11 @@ public class WebConfig extends JFinalConfig {
     }
 
     @Override
-    public void configEngine(Engine engine) {
-
-    }
+    public void configEngine(Engine engine) {}
 
     @Override
     public void configPlugin(Plugins plugins) {
-        if (IsDev) {
-            url = "jdbc:mysql://localhost:3306/ethmev?useSSL=false";
-            password = "123456";
-        }
-
-        DruidPlugin dp = new DruidPlugin(url, user, password);
+        DruidPlugin dp = new DruidPlugin(p.get("dbUrl"), p.get("dbUser"), p.get("dbPwd"));
         plugins.add(dp);
 
         ActiveRecordPlugin arp = new ActiveRecordPlugin(dp);

+ 7 - 0
src/main/resources/evi-dev.jfc

@@ -0,0 +1,7 @@
+# db config
+dbUrl=jdbc:mysql://localhost:3306/ethmev?useSSL=false
+dbUser=root
+dbPwd=123456
+
+# jfinal config
+devMode=true