属实是神奇

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.blake_hash,
md.xml_tested, md.xml_tested,
md.len, md.len,
md.time,
CASE CASE
WHEN md.len > 1024 THEN WHEN md.len > 1024 THEN
ld.text ld.text

View File

@ -29,7 +29,7 @@ pub fn ships_table() -> Statement {
.boolean() .boolean()
.not_null(), .not_null(),
); );
// .col(ColumnDef::new(Ships::XmlData)); // .col(ColumnDef::new(Ships::XmlData));
DatabaseBackend::Postgres.build(&table) 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> { async fn dashboard_page(State(db): State<DatabaseConnection>) -> Html<String> {
let max_id = db_part::search::max_id(&db).await; 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_ship = db_part::search::max_ship(&db).await;
let max_save = db_part::search::max_save(&db).await; let max_save = db_part::search::max_save(&db).await;
let mut page_content = INFO_PAGE let mut page_content = INFO_PAGE.replace("|MAX_ID|", &max_id.to_string());
.replace("|MAX_ID|", &max_id_data.save_id.to_string())
.replace( if let Some(max_id_data) = max_id_data {
"|MAX_SAVE_TYPE|", page_content = page_content
&max_id_data.save_type.to_value().to_string(), .replace("|MAX_ID|", &max_id_data.save_id.to_string())
) .replace(
.replace("|MAX_LEN|", &max_id_data.len.to_string()) "|MAX_SAVE_TYPE|",
.replace("|MAX_HASH|", &max_id_data.blake_hash); &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 { if let Some(max_ship) = max_ship {
page_content = page_content page_content = page_content
.replace("|MAX_SHIP_ID|", &max_ship.save_id.to_string()) .replace("|MAX_SHIP_ID|", &max_ship.save_id.to_string())

View File

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