bug fixed

This commit is contained in:
병준 박 2022-09-05 11:50:51 +00:00
parent ccc3e0c9f1
commit 496c22af81
5 changed files with 29 additions and 6 deletions

View File

@ -31,6 +31,7 @@ openssl = { version = "0", features = ["vendored"] }
prost = { version = "0" } prost = { version = "0" }
reqwest = { version = "0", features = ["json"] } reqwest = { version = "0", features = ["json"] }
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_bytes = { version = "0" }
serde_json = { version = "1" } serde_json = { version = "1" }
tokio = { version = "1", features = ["macros", "rt-multi-thread"] } tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
tokio-cron-scheduler = { version = "0" } tokio-cron-scheduler = { version = "0" }

View File

@ -36,8 +36,8 @@ pub struct Betting {
#[serde(rename = "groupKey")] #[serde(rename = "groupKey")]
pub group_key: Option<String>, pub group_key: Option<String>,
/// 게임 데이터 /// 게임 데이터
#[serde(skip_deserializing)] #[serde(with = "serde_bytes")]
pub detail: Option<String>, pub detail: Option<Vec<u8>>,
/// 보너스 여부 /// 보너스 여부
#[serde(rename = "isBonus")] #[serde(rename = "isBonus")]
pub is_bonus: bool, pub is_bonus: bool,

View File

@ -69,7 +69,18 @@ impl Api {
let balance = r.balance.unwrap_or(0.00); let balance = r.balance.unwrap_or(0.00);
let balance_bota = r.balance_bota.unwrap_or(0.00); let balance_bota = r.balance_bota.unwrap_or(0.00);
let balance_sum = r.balance_sum.unwrap_or(0.00); let balance_sum = r.balance_sum.unwrap_or(0.00);
let companies = r.companies; let companies = match r.companies {
Some(v) => match std::str::from_utf8(v.as_slice()) {
Ok(v) => Some(v.to_string()),
Err(e) => {
return Err(Error {
code: -1,
msg: Some(e.to_string()),
});
}
},
None => None,
};
Ok(models::GetBalanceForUserResponse { Ok(models::GetBalanceForUserResponse {
balance, balance,

View File

@ -13,8 +13,8 @@ pub struct _GetBalanceForUserResponse {
pub balance_bota: Option<f64>, pub balance_bota: Option<f64>,
#[serde(rename = "balanceSum")] #[serde(rename = "balanceSum")]
pub balance_sum: Option<f64>, pub balance_sum: Option<f64>,
#[serde(skip_deserializing)] #[serde(with = "serde_bytes")]
pub companies: Option<String>, pub companies: Option<Vec<u8>>,
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]

View File

@ -137,7 +137,18 @@ impl Synchronizer {
}); });
} }
}; };
let detail = b.detail; let detail = match b.detail {
Some(v) => match std::str::from_utf8(v.as_slice()) {
Ok(v) => Some(v.to_string()),
Err(e) => {
return Err(api::core::models::Error {
code: -1,
msg: Some(format!("std::str::from_utf8 error: {}", e)),
});
}
},
None => None,
};
new_betting_history.push(repositories::betting_history::models::NewBettingHistory { new_betting_history.push(repositories::betting_history::models::NewBettingHistory {
id: b._id, id: b._id,