diff --git a/Cargo.toml b/Cargo.toml index 4a6cc94..966bc11 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.83-snapshot" } -beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.69-snapshot" } +beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.84-snapshot" } +beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.70-snapshot" } [build-dependencies] diff --git a/migrations/202208051200_api_kgon_member/up.sql b/migrations/202208051200_api_kgon_member/up.sql index da46f27..ea7c3ea 100644 --- a/migrations/202208051200_api_kgon_member/up.sql +++ b/migrations/202208051200_api_kgon_member/up.sql @@ -1,9 +1,9 @@ CREATE TABLE IF NOT EXISTS api_kgon_members ( id BIGINT NOT NULL, - balance BIGINT NOT NULL DEFAULT 0, - balance_bota BIGINT NOT NULL DEFAULT 0, - balance_sum BIGINT NOT NULL DEFAULT 0, - companies BIGINT NOT NULL DEFAULT 0, + balance DOUBLE PRECISION NOT NULL DEFAULT 0.00, + balance_bota DOUBLE PRECISION NOT NULL DEFAULT 0.00, + balance_sum DOUBLE PRECISION NOT NULL DEFAULT 0.00, + companies TEXT, oriental_play CHAR(1) NOT NULL DEFAULT 'n', member_id UUID NOT NULL, created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000), diff --git a/migrations/202208051400_api_kgon_balance/up.sql b/migrations/202208051400_api_kgon_balance/up.sql index 14fa1d3..76f1b9b 100644 --- a/migrations/202208051400_api_kgon_balance/up.sql +++ b/migrations/202208051400_api_kgon_balance/up.sql @@ -1,7 +1,7 @@ CREATE TABLE IF NOT EXISTS api_kgon_balances ( id SERIAL PRIMARY KEY, - balance BIGINT NOT NULL DEFAULT 0, - balance_bota BIGINT NOT NULL DEFAULT 0, + balance DOUBLE PRECISION NOT NULL DEFAULT 0.00, + balance_bota DOUBLE PRECISION NOT NULL DEFAULT 0.00, created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000), updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000) ); diff --git a/migrations/202208061200_api_kgon_vendor/up.sql b/migrations/202208061200_api_kgon_vendor/up.sql index 4be6ecd..12c9af0 100644 --- a/migrations/202208061200_api_kgon_vendor/up.sql +++ b/migrations/202208061200_api_kgon_vendor/up.sql @@ -2,8 +2,8 @@ CREATE TABLE IF NOT EXISTS api_kgon_vendors ( id BIGINT NOT NULL, company_id BIGINT NOT NULL, vendor_id BIGINT NOT NULL, - max_bet_casino BIGINT NOT NULL, - max_bet_slot BIGINT NOT NULL, + max_bet_casino DOUBLE PRECISION NOT NULL DEFAULT 0.00, + max_bet_slot DOUBLE PRECISION NOT NULL DEFAULT 0.00, is_enable CHAR(1) NOT NULL, bet_count BIGINT NOT NULL, key TEXT NOT NULL, diff --git a/src/api/game/api.rs b/src/api/game/api.rs index d41e2e4..422984c 100644 --- a/src/api/game/api.rs +++ b/src/api/game/api.rs @@ -144,7 +144,7 @@ impl Api { let user_id = r.user_id.unwrap_or(0); let url = r.url.unwrap_or("".to_string()); - let balance = r.balance.unwrap_or(0); + let balance = r.balance.unwrap_or(0.00); Ok(models::GetGameUrlResponse { user_id, diff --git a/src/api/game/models.rs b/src/api/game/models.rs index 93b8245..7723027 100644 --- a/src/api/game/models.rs +++ b/src/api/game/models.rs @@ -36,7 +36,7 @@ pub struct GetGameUrlRequest { pub nickname: String, pub site_username: String, pub group_key: Option, - pub amount: i64, + pub amount: f64, pub request_key: Option, } @@ -47,12 +47,12 @@ pub struct _GetGameUrlResponse { #[serde(rename = "userId")] pub user_id: Option, pub url: Option, - pub balance: Option, + pub balance: Option, } #[derive(Debug)] pub struct GetGameUrlResponse { pub user_id: i64, pub url: String, - pub balance: i64, + pub balance: f64, } diff --git a/src/api/member/models.rs b/src/api/member/models.rs index 5dad897..d55afd7 100644 --- a/src/api/member/models.rs +++ b/src/api/member/models.rs @@ -9,8 +9,8 @@ pub struct ListMembersRequest { pub struct Member { pub id: i64, pub username: String, - pub cash: i64, - pub cash_bota: i64, + pub cash: f64, + pub cash_bota: f64, pub nickname: String, pub site_username: String, pub group_key: Option, diff --git a/src/api/member_account/api.rs b/src/api/member_account/api.rs index 2930a39..df86b28 100644 --- a/src/api/member_account/api.rs +++ b/src/api/member_account/api.rs @@ -66,10 +66,10 @@ impl Api { }); } - let balance = r.balance.unwrap_or(0); - let balance_bota = r.balance_bota.unwrap_or(0); - let balance_sum = r.balance_sum.unwrap_or(0); - let companies = r.companies.unwrap_or(0); + let balance = r.balance.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 companies = r.companies.unwrap_or("".to_string()); Ok(models::GetBalanceForUserResponse { balance, @@ -127,8 +127,8 @@ impl Api { }); } - let balance = r.balance.unwrap_or(0); - let balance_bota = r.balance_bota.unwrap_or(0); + let balance = r.balance.unwrap_or(0.00); + let balance_bota = r.balance_bota.unwrap_or(0.00); Ok(models::GetBalanceForPartnerResponse { balance, @@ -196,7 +196,7 @@ impl Api { }); } - let balance = r.balance.unwrap_or(0); + let balance = r.balance.unwrap_or(0.00); Ok(models::CreateDepositResponse { balance }) } @@ -257,10 +257,10 @@ impl Api { }); } - let balance = r.balance.unwrap_or(0); - let balance_cash = r.balance_cash.unwrap_or(0); - let balance_cash_bota = r.balance_cash_bota.unwrap_or(0); - let amount = r.amount.unwrap_or(0); + let balance = r.balance.unwrap_or(0.00); + let balance_cash = r.balance_cash.unwrap_or(0.00); + let balance_cash_bota = r.balance_cash_bota.unwrap_or(0.00); + let amount = r.amount.unwrap_or(0.00); Ok(models::CreateWithdrawResponse { balance, diff --git a/src/api/member_account/models.rs b/src/api/member_account/models.rs index 1ef99e5..57172fc 100644 --- a/src/api/member_account/models.rs +++ b/src/api/member_account/models.rs @@ -8,22 +8,22 @@ pub struct GetBalanceForUserRequest { pub struct _GetBalanceForUserResponse { pub code: i64, pub msg: Option, - pub balance: Option, + pub balance: Option, #[serde(rename = "balanceBota")] - pub balance_bota: Option, + pub balance_bota: Option, #[serde(rename = "balanceSum")] - pub balance_sum: Option, - pub companies: Option, + pub balance_sum: Option, + pub companies: Option, } #[derive(Serialize, Deserialize, Debug)] pub struct GetBalanceForUserResponse { - pub balance: i64, + pub balance: f64, #[serde(rename = "balanceBota")] - pub balance_bota: i64, + pub balance_bota: f64, #[serde(rename = "balanceSum")] - pub balance_sum: i64, - pub companies: i64, + pub balance_sum: f64, + pub companies: String, } pub struct GetBalanceForPartnerRequest {} @@ -32,22 +32,22 @@ pub struct GetBalanceForPartnerRequest {} pub struct _GetBalanceForPartnerResponse { pub code: i64, pub msg: Option, - pub balance: Option, + pub balance: Option, #[serde(rename = "balanceBota")] - pub balance_bota: Option, + pub balance_bota: Option, } #[derive(Serialize, Deserialize, Debug)] pub struct GetBalanceForPartnerResponse { - pub balance: i64, + pub balance: f64, #[serde(rename = "balanceBota")] - pub balance_bota: i64, + pub balance_bota: f64, } pub struct CreateDepositRequest { pub username: String, pub cash_type: Option, - pub amount: i64, + pub amount: f64, pub request_key: Option, } @@ -55,12 +55,12 @@ pub struct CreateDepositRequest { pub struct _CreateDepositResponse { pub code: i64, pub msg: Option, - pub balance: Option, + pub balance: Option, } #[derive(Serialize, Deserialize, Debug)] pub struct CreateDepositResponse { - pub balance: i64, + pub balance: f64, } pub struct CreateWithdrawRequest { @@ -72,16 +72,16 @@ pub struct CreateWithdrawRequest { pub struct _CreateWithdrawResponse { pub code: i64, pub msg: Option, - pub balance: Option, - pub balance_cash: Option, - pub balance_cash_bota: Option, - pub amount: Option, + pub balance: Option, + pub balance_cash: Option, + pub balance_cash_bota: Option, + pub amount: Option, } #[derive(Serialize, Deserialize, Debug)] pub struct CreateWithdrawResponse { - pub balance: i64, - pub balance_cash: i64, - pub balance_cash_bota: i64, - pub amount: i64, + pub balance: f64, + pub balance_cash: f64, + pub balance_cash_bota: f64, + pub amount: f64, } diff --git a/src/api/vendor/models.rs b/src/api/vendor/models.rs index 3aaa8c4..399f082 100644 --- a/src/api/vendor/models.rs +++ b/src/api/vendor/models.rs @@ -5,8 +5,8 @@ pub struct Vendor { pub id: i64, pub company_id: i64, pub vendor_id: i64, - pub max_bet_casino: i64, - pub max_bet_slot: i64, + pub max_bet_casino: f64, + pub max_bet_slot: f64, pub is_enable: String, pub bet_count: i64, pub key: String, diff --git a/src/compositions/member/models.rs b/src/compositions/member/models.rs index 680d4c6..8be6a88 100644 --- a/src/compositions/member/models.rs +++ b/src/compositions/member/models.rs @@ -6,13 +6,13 @@ pub struct MemberModel { /// pub id: i64, /// - pub balance: i64, + pub balance: f64, /// - pub balance_bota: i64, + pub balance_bota: f64, /// - pub balance_sum: i64, + pub balance_sum: f64, /// - pub companies: i64, + pub companies: String, /// pub oriental_play: String, /// diff --git a/src/events/member_bank_deposit/event.rs b/src/events/member_bank_deposit/event.rs index 97f4c10..9641588 100644 --- a/src/events/member_bank_deposit/event.rs +++ b/src/events/member_bank_deposit/event.rs @@ -171,7 +171,7 @@ impl EventHandler { self.member_account_api.create_deposit(api::member_account::models::CreateDepositRequest{ username: member.username.clone(), cash_type: None, - amount: member_bank_deposit.amount as i64, + amount: member_bank_deposit.amount, request_key: None, }).await .map_err(|e| { diff --git a/src/repositories/balance/models.rs b/src/repositories/balance/models.rs index 312095f..63c663f 100644 --- a/src/repositories/balance/models.rs +++ b/src/repositories/balance/models.rs @@ -1,15 +1,15 @@ use super::schema::api_kgon_balances; /// -#[derive(Eq, Hash, Identifiable, Queryable, PartialEq, Debug, Clone)] +#[derive(Identifiable, Queryable, PartialEq, Debug, Clone)] #[table_name = "api_kgon_balances"] pub struct Balance { /// pub id: i32, /// - pub balance: i64, + pub balance: f64, /// - pub balance_bota: i64, + pub balance_bota: f64, /// pub created_at: i64, /// @@ -21,9 +21,9 @@ pub struct Balance { #[table_name = "api_kgon_balances"] pub struct NewBalance { /// - pub balance: i64, + pub balance: f64, /// - pub balance_bota: i64, + pub balance_bota: f64, } /// @@ -31,7 +31,7 @@ pub struct NewBalance { #[table_name = "api_kgon_balances"] pub struct ModifyBalance { /// - pub balance: i64, + pub balance: f64, /// - pub balance_bota: i64, + pub balance_bota: f64, } diff --git a/src/repositories/balance/schema.rs b/src/repositories/balance/schema.rs index 7c3226a..6fb1598 100644 --- a/src/repositories/balance/schema.rs +++ b/src/repositories/balance/schema.rs @@ -7,9 +7,9 @@ table! { /// id -> Integer, /// - balance -> BigInt, + balance -> Double, /// - balance_bota -> BigInt, + balance_bota -> Double, /// created_at -> BigInt, /// diff --git a/src/repositories/member/models.rs b/src/repositories/member/models.rs index 9ca5490..752c721 100644 --- a/src/repositories/member/models.rs +++ b/src/repositories/member/models.rs @@ -2,19 +2,19 @@ use super::schema::api_kgon_members; use beteran_common_rust as bcr; /// -#[derive(Eq, Hash, Identifiable, Queryable, PartialEq, Debug, Clone)] +#[derive(Identifiable, Queryable, PartialEq, Debug, Clone)] #[table_name = "api_kgon_members"] pub struct Member { /// pub id: i64, /// - pub balance: i64, + pub balance: f64, /// - pub balance_bota: i64, + pub balance_bota: f64, /// - pub balance_sum: i64, + pub balance_sum: f64, /// - pub companies: i64, + pub companies: String, /// pub oriental_play: String, /// @@ -40,9 +40,9 @@ pub struct NewMember { #[table_name = "api_kgon_members"] pub struct ModifyMember { /// - pub balance: i64, + pub balance: f64, /// - pub balance_bota: i64, + pub balance_bota: f64, /// pub oriental_play: String, } @@ -52,13 +52,13 @@ pub struct ModifyMember { #[table_name = "api_kgon_members"] pub struct ModifyMemberForBalance { /// - pub balance: i64, + pub balance: f64, /// - pub balance_bota: i64, + pub balance_bota: f64, /// - pub balance_sum: i64, + pub balance_sum: f64, /// - pub companies: i64, + pub companies: String, } /// diff --git a/src/repositories/member/schema.rs b/src/repositories/member/schema.rs index dafaa84..a6f0c77 100644 --- a/src/repositories/member/schema.rs +++ b/src/repositories/member/schema.rs @@ -7,13 +7,13 @@ table! { /// id -> BigInt, /// - balance -> BigInt, + balance -> Double, /// - balance_bota -> BigInt, + balance_bota -> Double, /// - balance_sum -> BigInt, + balance_sum -> Double, /// - companies -> BigInt, + companies -> Text, /// oriental_play -> Text, /// diff --git a/src/repositories/vendor/models.rs b/src/repositories/vendor/models.rs index 387913f..2971f2e 100644 --- a/src/repositories/vendor/models.rs +++ b/src/repositories/vendor/models.rs @@ -2,7 +2,7 @@ use super::schema::api_kgon_vendors; use beteran_common_rust as bcr; /// -#[derive(Eq, Hash, Identifiable, Queryable, PartialEq, Debug, Clone)] +#[derive(Identifiable, Queryable, PartialEq, Debug, Clone)] #[table_name = "api_kgon_vendors"] pub struct Vendor { /// @@ -18,9 +18,9 @@ pub struct Vendor { /// pub category: String, /// - pub max_bet_casino: i64, + pub max_bet_casino: f64, /// - pub max_bet_slot: i64, + pub max_bet_slot: f64, /// pub is_enable: String, /// @@ -48,9 +48,9 @@ pub struct NewVendor { /// pub category: String, /// - pub max_bet_casino: i64, + pub max_bet_casino: f64, /// - pub max_bet_slot: i64, + pub max_bet_slot: f64, /// pub is_enable: String, /// @@ -72,9 +72,9 @@ pub struct ModifyVendor { /// pub category: String, /// - pub max_bet_casino: i64, + pub max_bet_casino: f64, /// - pub max_bet_slot: i64, + pub max_bet_slot: f64, /// pub is_enable: String, /// @@ -98,9 +98,9 @@ pub struct UpsertVendor { /// pub category: String, /// - pub max_bet_casino: i64, + pub max_bet_casino: f64, /// - pub max_bet_slot: i64, + pub max_bet_slot: f64, /// pub is_enable: String, /// diff --git a/src/repositories/vendor/schema.rs b/src/repositories/vendor/schema.rs index 1da6328..7eb28c0 100644 --- a/src/repositories/vendor/schema.rs +++ b/src/repositories/vendor/schema.rs @@ -17,9 +17,9 @@ table! { /// category -> Text, /// - max_bet_casino -> BigInt, + max_bet_casino -> Double, /// - max_bet_slot -> BigInt, + max_bet_slot -> Double, /// is_enable -> Text, /// diff --git a/src/services/game/service.rs b/src/services/game/service.rs index b4e1525..79d7f48 100644 --- a/src/services/game/service.rs +++ b/src/services/game/service.rs @@ -302,7 +302,7 @@ impl Service { Some(bpr::ss::api::game::get_game_url_response::Result { user_id: res.user_id as u64, - balance: res.balance as u64, + balance: res.balance, url: res.url, }) } diff --git a/src/services/vendor/models.rs b/src/services/vendor/models.rs index e1413d0..9e7b627 100644 --- a/src/services/vendor/models.rs +++ b/src/services/vendor/models.rs @@ -10,8 +10,8 @@ impl From<&repositories::vendor::models::Vendor> for bpr::models::api::vendor::V vendor_id: d.vendor_id as u64, key: d.key.clone(), category: d.category.clone(), - max_bet_casino: d.max_bet_casino as u64, - max_bet_slot: d.max_bet_slot as u64, + max_bet_casino: d.max_bet_casino, + max_bet_slot: d.max_bet_slot, is_enable: d.is_enable.clone(), bet_count: d.bet_count as u64, created_at: d.created_at as u64,