model is modified
This commit is contained in:
parent
62b501d6bb
commit
72bd1ffad8
|
@ -36,7 +36,7 @@ tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
|
||||||
tokio-cron-scheduler = { version = "0" }
|
tokio-cron-scheduler = { version = "0" }
|
||||||
uuid = { version = "0", features = ["serde", "v4", "v5"] }
|
uuid = { version = "0", features = ["serde", "v4", "v5"] }
|
||||||
|
|
||||||
beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.86-snapshot" }
|
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.72-snapshot" }
|
beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.73-snapshot" }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use beteran_common_rust as bcr;
|
use beteran_common_rust as bcr;
|
||||||
use beteran_protobuf_rust as bpr;
|
|
||||||
use diesel::deserialize::QueryableByName;
|
use diesel::deserialize::QueryableByName;
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -8,8 +7,6 @@ pub struct BettingHistoryModel {
|
||||||
///
|
///
|
||||||
pub id: String,
|
pub id: String,
|
||||||
///
|
///
|
||||||
pub member: bpr::models::member::Member,
|
|
||||||
///
|
|
||||||
pub vendor_id: i64,
|
pub vendor_id: i64,
|
||||||
///
|
///
|
||||||
pub vendor_name: String,
|
pub vendor_name: String,
|
||||||
|
@ -53,45 +50,24 @@ pub struct BettingHistoryModel {
|
||||||
pub created_at: i64,
|
pub created_at: i64,
|
||||||
///
|
///
|
||||||
pub utc_created_at: i64,
|
pub utc_created_at: i64,
|
||||||
|
///
|
||||||
|
pub m_site_id: uuid::Uuid,
|
||||||
|
///
|
||||||
|
pub m_member_class_id: uuid::Uuid,
|
||||||
|
///
|
||||||
|
pub m_member_level_id: uuid::Uuid,
|
||||||
|
///
|
||||||
|
pub m_parent_member_id: Option<uuid::Uuid>,
|
||||||
|
///
|
||||||
|
pub m_nickname: String,
|
||||||
|
///
|
||||||
|
pub m_mobile_phone_number: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl QueryableByName<diesel::pg::Pg> for BettingHistoryModel {
|
impl QueryableByName<diesel::pg::Pg> for BettingHistoryModel {
|
||||||
fn build<R: diesel::row::NamedRow<diesel::pg::Pg>>(row: &R) -> diesel::deserialize::Result<Self> {
|
fn build<R: diesel::row::NamedRow<diesel::pg::Pg>>(row: &R) -> diesel::deserialize::Result<Self> {
|
||||||
let member = bpr::models::member::Member {
|
|
||||||
id: row.get("_m_id")?,
|
|
||||||
site_id: row.get("_m_site_id")?,
|
|
||||||
member_class_id: row.get("_m_member_class_id")?,
|
|
||||||
member_level_id: row.get("_m_member_level_id")?,
|
|
||||||
username: row.get("_m_username")?,
|
|
||||||
nickname: row.get("_m_nickname")?,
|
|
||||||
mobile_phone_number: row.get("_m_mobile_phone_number")?,
|
|
||||||
state: row.get("_m_state")?,
|
|
||||||
state_changed_at: row
|
|
||||||
.get::<diesel::sql_types::Nullable<diesel::sql_types::BigInt>, Option<i64>>(
|
|
||||||
"_m_state_changed_at",
|
|
||||||
)?
|
|
||||||
.map(|v| v as u64),
|
|
||||||
parent_member_id: row.get("_m_parent_member_id")?,
|
|
||||||
child_member_count: row.get::<diesel::sql_types::BigInt, i64>("_m_child_member_count")?
|
|
||||||
as u64,
|
|
||||||
last_signined_ip: row.get("_m_last_signined_ip")?,
|
|
||||||
last_signined_at: row
|
|
||||||
.get::<diesel::sql_types::Nullable<diesel::sql_types::BigInt>, Option<i64>>(
|
|
||||||
"_m_last_signined_at",
|
|
||||||
)?
|
|
||||||
.map(|v| v as u64),
|
|
||||||
created_at: row.get::<diesel::sql_types::BigInt, i64>("_m_created_at")? as u64,
|
|
||||||
updated_at: row.get::<diesel::sql_types::BigInt, i64>("_m_updated_at")? as u64,
|
|
||||||
deleted_at: row
|
|
||||||
.get::<diesel::sql_types::Nullable<diesel::sql_types::BigInt>, Option<i64>>(
|
|
||||||
"_m_deleted_at",
|
|
||||||
)?
|
|
||||||
.map(|v| v as u64),
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(BettingHistoryModel {
|
Ok(BettingHistoryModel {
|
||||||
id: row.get("akbh_id")?,
|
id: row.get("akbh_id")?,
|
||||||
member,
|
|
||||||
vendor_id: row.get("akbh_vendor_id")?,
|
vendor_id: row.get("akbh_vendor_id")?,
|
||||||
vendor_name: row.get("akbh_vendor_name")?,
|
vendor_name: row.get("akbh_vendor_name")?,
|
||||||
game_id: row.get("akbh_game_id")?,
|
game_id: row.get("akbh_game_id")?,
|
||||||
|
@ -114,6 +90,12 @@ impl QueryableByName<diesel::pg::Pg> for BettingHistoryModel {
|
||||||
category: row.get("akbh_category")?,
|
category: row.get("akbh_category")?,
|
||||||
created_at: row.get("akbh_created_at")?,
|
created_at: row.get("akbh_created_at")?,
|
||||||
utc_created_at: row.get("akbh_utc_created_at")?,
|
utc_created_at: row.get("akbh_utc_created_at")?,
|
||||||
|
m_site_id: row.get("_m_site_id")?,
|
||||||
|
m_member_class_id: row.get("_m_member_class_id")?,
|
||||||
|
m_member_level_id: row.get("_m_member_level_id")?,
|
||||||
|
m_nickname: row.get("_m_nickname")?,
|
||||||
|
m_mobile_phone_number: row.get("_m_mobile_phone_number")?,
|
||||||
|
m_parent_member_id: row.get("_m_parent_member_id")?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,28 +5,8 @@ impl From<&compositions::betting::models::BettingHistoryModel>
|
||||||
for bpr::models::api::betting::BettingHistoryModel
|
for bpr::models::api::betting::BettingHistoryModel
|
||||||
{
|
{
|
||||||
fn from(d: &compositions::betting::models::BettingHistoryModel) -> Self {
|
fn from(d: &compositions::betting::models::BettingHistoryModel) -> Self {
|
||||||
let member = Some(bpr::models::member::Member {
|
|
||||||
id: d.member.id.to_string(),
|
|
||||||
site_id: d.member.site_id.to_string(),
|
|
||||||
member_class_id: d.member.member_class_id.to_string(),
|
|
||||||
member_level_id: d.member.member_level_id.to_string(),
|
|
||||||
parent_member_id: d.member.parent_member_id.as_ref().map(|d| d.to_string()),
|
|
||||||
child_member_count: d.member.child_member_count as u64,
|
|
||||||
username: d.member.username.clone(),
|
|
||||||
nickname: d.member.nickname.clone(),
|
|
||||||
mobile_phone_number: d.member.mobile_phone_number.clone(),
|
|
||||||
state: d.member.state as i32,
|
|
||||||
state_changed_at: d.member.state_changed_at.map(|d| d as u64),
|
|
||||||
last_signined_ip: d.member.last_signined_ip.clone(),
|
|
||||||
last_signined_at: d.member.last_signined_at.map(|d| d as u64),
|
|
||||||
created_at: d.member.created_at as u64,
|
|
||||||
updated_at: d.member.updated_at as u64,
|
|
||||||
deleted_at: d.member.deleted_at.map(|d| d as u64),
|
|
||||||
});
|
|
||||||
|
|
||||||
bpr::models::api::betting::BettingHistoryModel {
|
bpr::models::api::betting::BettingHistoryModel {
|
||||||
id: d.id.clone(),
|
id: d.id.clone(),
|
||||||
member,
|
|
||||||
vendor_id: d.vendor_id as u64,
|
vendor_id: d.vendor_id as u64,
|
||||||
vendor_name: d.vendor_name.clone(),
|
vendor_name: d.vendor_name.clone(),
|
||||||
game_id: d.game_id as u64,
|
game_id: d.game_id as u64,
|
||||||
|
@ -49,6 +29,12 @@ impl From<&compositions::betting::models::BettingHistoryModel>
|
||||||
category: d.category.clone(),
|
category: d.category.clone(),
|
||||||
created_at: d.created_at as u64,
|
created_at: d.created_at as u64,
|
||||||
utc_created_at: d.utc_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(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user