浏览代码

pending查询 不验证blockNumber是否为空

JiahengHe 2 年之前
父节点
当前提交
bbcbd6003a

+ 1 - 0
src/main/java/common/utils/model/ConstantUtil.java

@@ -8,4 +8,5 @@ public class ConstantUtil {
 
     public static final String COUNT_NUM_KEY = "address:countNum:";
     public static final String[] ADDRESS_COUNT_TABLE= {"t_factory", "t_bal_lp", "t_v2_lp", "t_v3_lp"};
+    public static final String[] TX_COUNT_TABLE = {"t_history", "t_pending"};
 }

+ 4 - 0
src/main/java/modules/tx/TxService.java

@@ -122,6 +122,10 @@ public class TxService {
 		Kv query = Kv.of("txTableName", txTableName)
 				.set("transferTableName", transferTableName)
 				.set("chainId", chainId);
+		// 如果是history,添加blockNumber不为空
+		if(txTableName.equals(ConstantUtil.TX_COUNT_TABLE[0])){
+			query.set("isHistory", "1");
+		}
 		if(p != null){
 			query.set("limit0", (p.getPageNumber() - 1) * p.getPageSize())
 					.set("limit1", p.getPageSize());

+ 3 - 1
src/main/java/modules/tx/tx.sqlt

@@ -13,7 +13,9 @@
 		inner join #(transferTableName) c on c.mainId = b.id
 	#end
 	where b.chainId=#(chainId)
-	and b.blockNumber is not null
+	#if(isHistory)
+	    and b.blockNumber is not null
+	#end
 	#if (txblock || txhash || txfrom || txto)
 		#if (txblock)
 			and b.blockNumber=#para(txblock)

+ 14 - 0
src/test/http/tx/PendingTest.http

@@ -166,6 +166,20 @@ Content-Type: application/json
 
 {
   "chainId": 56,
+  "conditions": {
+    "autoFlushTime": 0,
+    "transfer": {
+      "from": "",
+      "to": "",
+      "token": "",
+    },
+    "tx": {
+      "block": "",
+      "from": "",
+      "hash": "",
+      "to": "",
+    }
+  },
   "pageNumber": 1,
   "pageSize": 20,
   "auth": {