diff --git a/docs/api.md b/docs/api.md
index 2387716..1d64c0c 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -97,13 +97,15 @@
1.2 获取交易列表
-| 参数 | 类型 | 必传 | 说明 |
-|-----------|--------|----|------------|
-| from | string | N | 发送者 |
-| to | string | N | 接收者 |
-| ty | number | N | 类型 |
-| page | number | N | 页码,缺省值为1 |
-| page_size | number | N | 页大小,缺省值为10 |
+| 参数 | 类型 | 必传 | 说明 |
+|------------|--------|----|------------|
+| from | string | N | 发送者 |
+| to | string | N | 接收者 |
+| ty | number | N | 类型 |
+| start_time | number | N | 开始时间戳 |
+| end_time | number | N | 结束时间戳 |
+| page | number | N | 页码,缺省值为1 |
+| page_size | number | N | 页大小,缺省值为10 |
* Request: `/api/txs?page=2&page_size=2`
* Response:
diff --git a/explorer/src/service/v2/transaction.rs b/explorer/src/service/v2/transaction.rs
index eaf25db..fc1f299 100644
--- a/explorer/src/service/v2/transaction.rs
+++ b/explorer/src/service/v2/transaction.rs
@@ -16,6 +16,8 @@ pub struct GetTxsParams {
pub from: Option,
pub to: Option,
pub ty: Option,
+ pub start_time: Option,
+ pub end_time: Option,
pub page: Option,
pub page_size: Option,
}
@@ -40,6 +42,12 @@ pub async fn get_txs(
if let Some(ty) = params.ty {
query_params.push(format!("ty={} ", ty));
}
+ if let Some(start_time) = params.start_time {
+ query_params.push(format!("timestamp>={} ", start_time));
+ }
+ if let Some(end_time) = params.end_time {
+ query_params.push(format!("timestamp<={} ", end_time));
+ }
if !query_params.is_empty() {
sql_query = sql_query
.add("WHERE ")