diff --git a/Cargo.toml b/Cargo.toml index 70427d0..e725f03 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ tokio = { version = "1", features = ["macros", "rt-multi-thread"] } tokio-cron-scheduler = { version = "0" } uuid = { version = "0", features = ["serde", "v4", "v5"] } -beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.87-snapshot" } -beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.73-snapshot" } +beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.89-snapshot" } +beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.75-snapshot" } [build-dependencies] diff --git a/src/compositions/betting/composition.rs b/src/compositions/betting/composition.rs index 791b9db..991f557 100644 --- a/src/compositions/betting/composition.rs +++ b/src/compositions/betting/composition.rs @@ -222,6 +222,22 @@ impl Composition { write!(&mut query_where, "akbh.vendor_id = {}", sp) .map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?; } + if !s.vendor_ids.is_empty() { + if !query_where.is_empty() { + write!(&mut query_where, " AND ") + .map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?; + } + write!( + &mut query_where, + "akbh.vendor_id IN ({})", + s.vendor_ids + .iter() + .map(|v| v.to_string()) + .collect::>() + .join(",") + ) + .map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?; + } if let Some(sp) = &s.vendor_name { if !query_where.is_empty() { @@ -248,6 +264,22 @@ impl Composition { write!(&mut query_where, "akbh.game_id = {}", sp) .map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?; } + if !s.game_ids.is_empty() { + if !query_where.is_empty() { + write!(&mut query_where, " AND ") + .map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?; + } + write!( + &mut query_where, + "akbh.game_id IN ({})", + s.game_ids + .iter() + .map(|v| v.to_string()) + .collect::>() + .join(",") + ) + .map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?; + } if let Some(sp) = &s.game_name { if !query_where.is_empty() { diff --git a/src/compositions/betting/models.rs b/src/compositions/betting/models.rs index b3cfccd..4994edc 100644 --- a/src/compositions/betting/models.rs +++ b/src/compositions/betting/models.rs @@ -108,12 +108,16 @@ pub struct FindAllSearch { /// pub vendor_id: Option, /// + pub vendor_ids: Vec, + /// pub vendor_name: Option, /// pub vendor_name_like: Option, /// pub game_id: Option, /// + pub game_ids: Vec, + /// pub game_name: Option, /// pub game_name_like: Option, diff --git a/src/services/betting/models.rs b/src/services/betting/models.rs index de11d4d..48fe854 100644 --- a/src/services/betting/models.rs +++ b/src/services/betting/models.rs @@ -5,6 +5,15 @@ impl From<&compositions::betting::models::BettingHistoryModel> for bpr::models::api::betting::BettingHistoryModel { fn from(d: &compositions::betting::models::BettingHistoryModel) -> Self { + let member = Some(bpr::models::api::betting::betting_history_model::Member { + site_id: d.m_site_id.to_string(), + member_class_id: d.m_member_class_id.to_string(), + member_level_id: d.m_member_level_id.to_string(), + parent_member_id: d.m_parent_member_id.map(|v| v.to_string()), + nickname: d.m_nickname.clone(), + mobile_phone_number: d.m_mobile_phone_number.clone(), + }); + bpr::models::api::betting::BettingHistoryModel { id: d.id.clone(), vendor_id: d.vendor_id as u64, @@ -29,12 +38,7 @@ impl From<&compositions::betting::models::BettingHistoryModel> category: d.category.clone(), created_at: d.created_at as u64, utc_created_at: d.utc_created_at as u64, - m_site_id: d.m_site_id.to_string(), - m_member_class_id: d.m_member_class_id.to_string(), - m_member_level_id: d.m_member_level_id.to_string(), - m_parent_member_id: d.m_parent_member_id.map(|v| v.to_string()), - m_nickname: d.m_nickname.clone(), - m_mobile_phone_number: d.m_mobile_phone_number.clone(), + member, } } } diff --git a/src/services/betting/service.rs b/src/services/betting/service.rs index 7488e1a..dfc5430 100644 --- a/src/services/betting/service.rs +++ b/src/services/betting/service.rs @@ -112,9 +112,11 @@ impl Service { Some(s) => Some(compositions::betting::models::FindAllSearch { member_id: s.member_id, vendor_id: s.vendor_id.map(|v| v as i64), + vendor_ids: s.vendor_ids.iter().map(|v| *v as i64).collect(), vendor_name: s.vendor_name, vendor_name_like: s.vendor_name_like, game_id: s.game_id.map(|v| v as i64), + game_ids: s.game_ids.iter().map(|v| *v as i64).collect(), game_name: s.game_name, game_name_like: s.game_name_like, game_category: s.game_category,