|
|
@@ -296,12 +296,18 @@ pub fn get_symbols_by_exchange(exchange: &str) -> Value {
|
|
|
|
|
|
let path_str = format!("./db/{}", exchange);
|
|
|
let path = Path::new(&path_str);
|
|
|
-
|
|
|
- if let Some(latest_dir) = find_latest_directory(path).unwrap() {
|
|
|
- info!("找到最后一日生成的目录: {}", latest_dir.to_str().unwrap());
|
|
|
- let subdirectories = list_directories(&latest_dir).unwrap();
|
|
|
- for sub_dir in subdirectories {
|
|
|
- symbols.push(sub_dir.file_name().unwrap().to_str().unwrap().to_string())
|
|
|
+ let latest_directory = find_latest_directory(path);
|
|
|
+ match latest_directory {
|
|
|
+ Ok(dir) => {
|
|
|
+ let latest_dir = dir.unwrap();
|
|
|
+ info!("找到最后一日生成的目录: {}", latest_dir.to_str().unwrap());
|
|
|
+ let subdirectories = list_directories(&latest_dir).unwrap();
|
|
|
+ for sub_dir in subdirectories {
|
|
|
+ symbols.push(sub_dir.file_name().unwrap().to_str().unwrap().to_string())
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Err(_) => {
|
|
|
+ return serde_json::to_value(&symbols).unwrap();
|
|
|
}
|
|
|
}
|
|
|
|