Skip to content

Commit

Permalink
optimize.
Browse files Browse the repository at this point in the history
  • Loading branch information
cowbeer committed Feb 29, 2024
1 parent a77613c commit ba836b4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion explorer/src/service/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ impl Api {
}

#[oai(
path = "/v2/tx/prism/records/send",
path = "/v2/tx/prism/send",
method = "get",
tag = "ApiTags::Transaction"
)]
Expand Down
4 changes: 2 additions & 2 deletions explorer/src/service/v1/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@ pub async fn get_prism_received(
let mut items: Vec<V2PrismItem> = vec![];

let sql_counts = format!(
"SELECT count(*) AS cnt FROM e2n WHERE receiver=\'{}\'",
"SELECT count(*) AS cnt FROM e2n WHERE receiver='{}'",
address.0
);
let row_counts = sqlx::query(sql_counts.as_str())
.fetch_one(&mut conn)
.await?;
let total: i64 = row_counts.try_get("cnt")?;

let sql_query = format!("SELECT tx_hash,block_hash,sender,receiver,asset,amount,decimal,height,timestamp,value FROM e2n WHERE receiver=\'{}\' ORDER BY timestamp DESC LIMIT {} OFFSET {}", address.0, page_size, (page-1)*page_size);
let sql_query = format!("SELECT tx_hash,block_hash,sender,receiver,asset,amount,decimal,height,timestamp,value FROM e2n WHERE receiver='{}' ORDER BY timestamp DESC LIMIT {} OFFSET {}", address.0, page_size, (page-1)*page_size);
let rows = sqlx::query(sql_query.as_str()).fetch_all(&mut conn).await?;
for row in rows {
let tx_hash: String = row.try_get("tx_hash")?;
Expand Down

0 comments on commit ba836b4

Please sign in to comment.