属实是神奇

This commit is contained in:
shenjack 2024-09-06 00:32:47 +08:00
parent df92d7d31f
commit 40752741c1
Signed by: shenjack
GPG Key ID: 7B1134A979775551
4 changed files with 23 additions and 10 deletions

View File

@ -8,6 +8,7 @@ SELECT
md.blake_hash,
md.xml_tested,
md.len,
md.time,
CASE
WHEN md.len > 1024 THEN
ld.text

View File

@ -29,7 +29,7 @@ pub fn ships_table() -> Statement {
.boolean()
.not_null(),
);
// .col(ColumnDef::new(Ships::XmlData));
// .col(ColumnDef::new(Ships::XmlData));
DatabaseBackend::Postgres.build(&table)
}

View File

@ -194,18 +194,28 @@ const INFO_PAGE: &str = include_str!("info.html");
async fn dashboard_page(State(db): State<DatabaseConnection>) -> Html<String> {
let max_id = db_part::search::max_id(&db).await;
let max_id_data = DbData::from_db(max_id, &db).await.unwrap();
let max_id_data = DbData::from_db(max_id, &db).await;
let max_ship = db_part::search::max_ship(&db).await;
let max_save = db_part::search::max_save(&db).await;
let mut page_content = INFO_PAGE
.replace("|MAX_ID|", &max_id_data.save_id.to_string())
.replace(
"|MAX_SAVE_TYPE|",
&max_id_data.save_type.to_value().to_string(),
)
.replace("|MAX_LEN|", &max_id_data.len.to_string())
.replace("|MAX_HASH|", &max_id_data.blake_hash);
let mut page_content = INFO_PAGE.replace("|MAX_ID|", &max_id.to_string());
if let Some(max_id_data) = max_id_data {
page_content = page_content
.replace("|MAX_ID|", &max_id_data.save_id.to_string())
.replace(
"|MAX_SAVE_TYPE|",
&max_id_data.save_type.to_value().to_string(),
)
.replace("|MAX_LEN|", &max_id_data.len.to_string())
.replace("|MAX_HASH|", &max_id_data.blake_hash);
} else {
page_content = page_content
.replace("|MAX_ID|", "not found")
.replace("|MAX_SAVE_TYPE|", "not found")
.replace("|MAX_LEN|", "not found")
.replace("|MAX_HASH|", "not found");
}
if let Some(max_ship) = max_ship {
page_content = page_content
.replace("|MAX_SHIP_ID|", &max_ship.save_id.to_string())

View File

@ -6,6 +6,8 @@
然后遇到了 sea_orm 不支持 xml 类型的问题
先发一版再说
顺便修复了web界面的一些可能导致 panic 的 unwrap
## 1.2.4
又修复了一遍剩下的问题