Pārlūkot izejas kodu

修复block为2能查出来的问题

skyfffire 3 gadi atpakaļ
vecāks
revīzija
6e873d4ec8

+ 0 - 92
src/main/java/controller/ConfigController.java

@@ -1,92 +0,0 @@
-package controller;
-
-import com.jfinal.core.Controller;
-import com.jfinal.kit.StrKit;
-import com.jfinal.plugin.activerecord.Db;
-import com.jfinal.plugin.activerecord.Page;
-import model.Config;
-import util.MyRet;
-
-public class ConfigController extends Controller {
-    public void add() {
-        int ts = (int)(System.currentTimeMillis() / 1000);
-        String hs = getPara("hs");
-        String type = getPara("type");
-        String o = getPara("o");
-
-        if (StrKit.isBlank(hs) || StrKit.isBlank(type) || StrKit.isBlank(o)) {
-            renderJson(MyRet.create().setFail().setMsg("参数不合法。"));
-            return;
-        }
-
-        o = o.replaceAll("【", "[").replaceAll("】", "]");
-
-        if (Db.queryInt("select count(1) from t_config where hs = ?", hs) == 1) {
-            renderJson(MyRet.create().setFail().setMsg("Hash已存在。"));
-            return;
-        }
-
-        Config config = getModel(Config.class, "", true);
-        config.set("o", o);
-        config.set("ts", ts);
-
-        if (!config.save()) {
-            renderJson(MyRet.create().setFail().setMsg("保存失败,请联系开发者。"));
-            return;
-        }
-
-        renderJson(MyRet.create().setOk().setMsg("保存成功").setData(config));
-    }
-
-    public void get() {
-        Page<Config> rst = Config.dao.paginate(1, 1000, "select *", "from t_config");
-
-        renderJson(MyRet
-                .create()
-                .setOk()
-                .setMsg("请求成功")
-                .setData(rst));
-    }
-
-    public void update() {
-        Config config = getModel(Config.class, "", true);
-
-        if (StrKit.isBlank(config.getStr("ts"))
-            || StrKit.isBlank(config.getStr("hs"))
-            || StrKit.isBlank(config.getStr("type"))
-            || StrKit.isBlank(config.getStr("o"))) {
-            renderJson(MyRet.create().setFail().setMsg("参数不合法。"));
-            return;
-        }
-
-        config.set("o", config.getStr("o").replaceAll("【", "[").replaceAll("】", "]"));
-
-        if (Db.queryInt("select count(1) from t_config where hs = ?", config.getStr("hs")) == 0) {
-            renderJson(MyRet.create().setFail().setMsg("Hash不存在!请勿修改Hash值!"));
-            return;
-        }
-
-        if (!config.update()) {
-            renderJson(MyRet.create().setFail().setMsg("更新失败,请联系开发者。"));
-            return;
-        }
-
-        renderJson(MyRet.create().setOk().setMsg("更新成功").setData(config));
-    }
-
-    public void delete() {
-        String hs = getPara("hs");
-
-        if (StrKit.isBlank("hs")) {
-            renderJson(MyRet.create().setFail().setMsg("参数不合法。"));
-            return;
-        }
-
-        if (Db.update("delete from t_config where hs = ?", hs) == 0) {
-            renderJson(MyRet.create().setFail().setMsg("删除失败,请联系开发者。"));
-            return;
-        }
-
-        renderJson(MyRet.create().setOk().setMsg("删除成功"));
-    }
-}

+ 4 - 4
src/main/java/controller/EthMevController.java

@@ -132,19 +132,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]+$' 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]+$' 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]+$' 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]+$' 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 ?,?";

+ 0 - 134
src/main/java/controller/InputDataController.java

@@ -1,134 +0,0 @@
-package controller;
-
-import com.jfinal.core.Controller;
-import com.jfinal.kit.Ret;
-import com.jfinal.plugin.activerecord.Page;
-import model.InputData;
-
-import java.util.Date;
-
-public class InputDataController extends Controller {
-    public void getRecord() {
-        // timestamp start
-        long t1 = (new Date().getTime() / 1000) - (10 * 60);
-        // timestamp end
-        long t2 = 9999999999999999L;
-        // from
-        String fm = "%";
-        // to
-        String t = "%";
-        // hash
-        String hs = "%";
-        // state
-        String state = "%";
-        // page?
-        boolean isDynamic = false;
-        // pageSize
-        int pageSize = 200;
-        if (getPara("fm") != null) {
-//            t1 = 0;
-            fm = getPara("fm");
-        }
-        if (getPara("t") != null) {
-//            t1 = 0;
-            t = getPara("t");
-        }
-        if (getPara("hs") != null) {
-//            t1 = 0;
-            hs = getPara("hs");
-        }
-        if (getPara("state") != null) {
-//            t1 = 0;
-            state = getPara("state");
-        }
-        if (getPara("t1") != null) {
-            if (getParaToLong("t1") > t1 + 60 * 7) {
-                isDynamic = true;
-                t1 = 0;
-            } else {
-                t1 = getParaToLong("t1");
-            }
-        }
-        if (getPara("t2") != null) {
-            t2 = getParaToLong("t2");
-        }
-        if (getPara("pageSize") != null) {
-            pageSize = getParaToInt("pageSize");
-        }
-        System.out.println(t1 + ", " + t2 + ", " + isDynamic);
-        String from = "from input_data where ts>? and ts<? and fm like ? and t like ? and hs like ? and state like ? "
-                + "and (o like '%\"intoken\": \"WETH\"%' or o like \"%'intoken': 'WETH'%\")"
-                + (isDynamic ? " and state != 'cancel'" : "");
-        String totalSQL = "select count(1) " + from;
-        String findSQL = "select * " + from + " order by ts desc";
-        Page<InputData> rst = InputData.dao.paginateByFullSql(1, isDynamic ? pageSize : 9999,
-                totalSQL, findSQL, t1, t2, fm, t, hs, state);
-
-        Ret ret = new Ret();
-        ret.set("data", rst.getList());
-        ret.set("count", rst.getList().size());
-        ret.setOk();
-
-        renderJson(ret);
-    }
-
-    public void getRecordByMySelf() {
-        // timestamp start
-        long t1 = (new Date().getTime() / 1000) - (10 * 60);
-        // timestamp end
-        long t2 = 9999999999999999L;
-        // from
-        String fm = "%";
-        // to
-        String t = "%";
-        // hash
-        String hs = "%";
-        // state
-        String state = "%";
-        // pageSize
-        int pageSize = 400;
-        if (getPara("fm") != null) {
-//            t1 = 0;
-            fm = getPara("fm");
-        }
-        if (getPara("t") != null) {
-//            t1 = 0;
-            t = getPara("t");
-        }
-        if (getPara("hs") != null) {
-//            t1 = 0;
-            hs = getPara("hs");
-        }
-        if (getPara("state") != null) {
-//            t1 = 0;
-            state = getPara("state");
-        }
-        if (getPara("t1") != null) {
-            if (getParaToLong("t1") > t1 + 60 * 7) {
-                t1 = 0;
-            } else {
-                t1 = getParaToLong("t1");
-            }
-        }
-        if (getPara("t2") != null) {
-            t2 = getParaToLong("t2");
-        }
-        if (getPara("pageSize") != null) {
-            pageSize = getParaToInt("pageSize");
-        }
-
-        String from = "from input_data where ts>? and ts<? and fm like ? and t like ? and hs like ? and state like ? and o like '%ZIJI%'";
-        String totalSQL = "select count(1) " + from;
-        String findSQL = "select * " + from + " order by ts desc";
-
-        Page<InputData> rst = InputData.dao.paginateByFullSql(1, pageSize,
-                totalSQL, findSQL, t1, t2, fm, t, hs, state);
-
-        Ret ret = new Ret();
-        ret.set("data", rst.getList());
-        ret.set("count", rst.getList().size());
-        ret.setOk();
-
-        renderJson(ret);
-    }
-}