feat: 抽测风速改为用户可自定义次数(增删按钮)
- models.rs:新增 spot_check_count 字段(默认 5) - db.rs:INSERT/SELECT 添加 spotcheckcount 列 - migrations/007:ALTER TABLE weather_data ADD spotcheckcount - afterbody.js:使用 data.spotCheckCount 动态渲染抽测数据
This commit is contained in:
@@ -4,6 +4,11 @@ use serde_json::Value as JsonValue;
|
||||
use sqlx::FromRow;
|
||||
use std::convert::TryFrom;
|
||||
|
||||
// 默认值函数
|
||||
fn default_spot_check_count() -> i32 {
|
||||
5
|
||||
}
|
||||
|
||||
// 定义JWT载荷结构体
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct Claims {
|
||||
@@ -204,6 +209,10 @@ pub struct WeatherData {
|
||||
#[sqlx(rename = "hasspotcheckwindspeed")]
|
||||
pub has_spot_check_wind_speed: bool,
|
||||
|
||||
#[serde(rename = "spotCheckCount", default = "default_spot_check_count")]
|
||||
#[sqlx(rename = "spotcheckcount")]
|
||||
pub spot_check_count: i32,
|
||||
|
||||
#[serde(rename = "hours")]
|
||||
#[sqlx(rename = "hour")]
|
||||
pub hours: i32,
|
||||
|
||||
Reference in New Issue
Block a user