Pārlūkot izejas kodu

修改导出余额添加只导出汇总模式

gepangpang 1 gadu atpakaļ
vecāks
revīzija
c6bf46ad4d

+ 2 - 0
config_balance.toml.sample

@@ -10,6 +10,8 @@ exchanges = ["gate"]
 range_time = ["2023-12-20 18:00:00", "2023-12-26 10:00:00"]
 # 配置查询时间(格式:2023-12-6 15:00:00)
 count_range_time = ["2023-12-25 10:00:00", "2023-12-26 10:00:00"]
+# 是否只导出汇总
+is_total = true
 # 配置导出表格模式(1:按小时导出,2:按余额变动导出)
 export_mode = 1
 # 导出路径(不填则为默认路径"./")

+ 2 - 1
src/export_template/template_balance.rs

@@ -46,8 +46,9 @@ pub fn export_html(config: BalanceConfigInfo, acc_name_all: &Vec<String>, x_time
         let series = json!({"name": key.to_string(), "type": "line", "smooth": true, "data": val});
         series_all.push(series);
     }
+    let series_array = if config.is_total { [series_all[series_all.len() - 1].clone()].to_vec() } else { series_all };
     let json = json!({
-        "data":series_all
+        "data":series_array
     });
 
     let series_str = format!("{}", json["data"]);

+ 2 - 0
src/utils/utils.rs

@@ -67,6 +67,7 @@ pub fn get_ticker_config_info(file_path: &str) -> TickerConfigInfo {
 #[derive(Debug, Clone, Deserialize)]
 pub struct BalanceConfigInfo {
     pub is_export: bool,
+    pub is_total: bool,
     pub proxy_address: String,
     pub account_list: Vec<Vec<String>>,
     pub exchanges: Vec<String>,
@@ -81,6 +82,7 @@ impl BalanceConfigInfo {
     fn new() -> BalanceConfigInfo {
         BalanceConfigInfo {
             is_export: false,
+            is_total: true,
             proxy_address: "".to_string(),
             account_list: vec![],
             exchanges: vec![],