fix: 修复 UP 主信息接口的类型问题

This commit is contained in:
amtoaer
2025-01-14 00:07:51 +08:00
parent f31900e6c7
commit 265fe630dd
4 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -151,7 +151,7 @@ pub(super) async fn submission_from<'a>(
let submission = Submission::new(bili_client, upper_id.to_owned()); let submission = Submission::new(bili_client, upper_id.to_owned());
let upper = submission.get_info().await?; let upper = submission.get_info().await?;
submission::Entity::insert(submission::ActiveModel { submission::Entity::insert(submission::ActiveModel {
upper_id: Set(upper.mid), upper_id: Set(upper.mid.parse()?),
upper_name: Set(upper.name), upper_name: Set(upper.name),
path: Set(path.to_string_lossy().to_string()), path: Set(path.to_string_lossy().to_string()),
..Default::default() ..Default::default()
@@ -16,8 +16,8 @@ pub struct FavoriteListInfo {
} }
#[derive(Debug, serde::Deserialize)] #[derive(Debug, serde::Deserialize)]
pub struct Upper { pub struct Upper<T> {
pub mid: i64, pub mid: T,
pub name: String, pub name: String,
pub face: String, pub face: String,
} }
+3 -3
View File
@@ -71,7 +71,7 @@ pub enum VideoInfo {
#[serde(rename = "pic")] #[serde(rename = "pic")]
cover: String, cover: String,
#[serde(rename = "owner")] #[serde(rename = "owner")]
upper: Upper, upper: Upper<i64>,
#[serde(with = "ts_seconds")] #[serde(with = "ts_seconds")]
ctime: DateTime<Utc>, ctime: DateTime<Utc>,
#[serde(rename = "pubdate", with = "ts_seconds")] #[serde(rename = "pubdate", with = "ts_seconds")]
@@ -87,7 +87,7 @@ pub enum VideoInfo {
bvid: String, bvid: String,
intro: String, intro: String,
cover: String, cover: String,
upper: Upper, upper: Upper<i64>,
#[serde(with = "ts_seconds")] #[serde(with = "ts_seconds")]
ctime: DateTime<Utc>, ctime: DateTime<Utc>,
#[serde(with = "ts_seconds")] #[serde(with = "ts_seconds")]
@@ -105,7 +105,7 @@ pub enum VideoInfo {
#[serde(rename = "pic")] #[serde(rename = "pic")]
cover: String, cover: String,
#[serde(rename = "owner")] #[serde(rename = "owner")]
upper: Upper, upper: Upper<i64>,
#[serde(with = "ts_seconds")] #[serde(with = "ts_seconds")]
ctime: DateTime<Utc>, ctime: DateTime<Utc>,
#[serde(rename = "add_at", with = "ts_seconds")] #[serde(rename = "add_at", with = "ts_seconds")]
+1 -1
View File
@@ -18,7 +18,7 @@ impl<'a> Submission<'a> {
Self { client, upper_id } Self { client, upper_id }
} }
pub async fn get_info(&self) -> Result<Upper> { pub async fn get_info(&self) -> Result<Upper<String>> {
let mut res = self let mut res = self
.client .client
.request(Method::GET, "https://api.bilibili.com/x/web-interface/card") .request(Method::GET, "https://api.bilibili.com/x/web-interface/card")