fix: 修复部分数据类型错误,添加额外检查
This commit is contained in:
@@ -8,7 +8,7 @@ pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
#[sea_orm(unique)]
|
||||
pub f_id: i32,
|
||||
pub f_id: i64,
|
||||
pub name: String,
|
||||
pub path: String,
|
||||
pub created_at: String,
|
||||
|
||||
@@ -8,7 +8,7 @@ pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
pub favorite_id: i32,
|
||||
pub upper_id: i32,
|
||||
pub upper_id: i64,
|
||||
pub upper_name: String,
|
||||
pub upper_face: String,
|
||||
pub name: String,
|
||||
|
||||
@@ -15,7 +15,7 @@ pub struct FavoriteList<'a> {
|
||||
|
||||
#[derive(Debug, serde::Deserialize)]
|
||||
pub struct FavoriteListInfo {
|
||||
pub id: i32,
|
||||
pub id: i64,
|
||||
pub title: String,
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ pub struct VideoInfo {
|
||||
|
||||
#[derive(Debug, serde::Deserialize)]
|
||||
pub struct Upper {
|
||||
pub mid: i32,
|
||||
pub mid: i64,
|
||||
pub name: String,
|
||||
pub face: String,
|
||||
}
|
||||
@@ -103,14 +103,18 @@ impl<'a> FavoriteList<'a> {
|
||||
let mut videos = match self.get_videos(page).await {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
error!("failed to get videos of page {}: {}", page, e);
|
||||
error!("failed to get videos of favorite {} page {}: {}", self.fid, page, e);
|
||||
break;
|
||||
},
|
||||
};
|
||||
if !videos["data"]["medias"].is_array() {
|
||||
error!("no medias found in favorite {} page {}", self.fid, page);
|
||||
break;
|
||||
}
|
||||
let videos_info = match serde_json::from_value::<Vec<VideoInfo>>(videos["data"]["medias"].take()) {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
error!("failed to parse videos of page {}: {}", page, e);
|
||||
error!("failed to parse videos of favorite {} page {}: {}", self.fid, page, e);
|
||||
break;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user