types of data are changed

This commit is contained in:
병준 박 2022-08-18 05:57:23 +00:00
parent 30555e9773
commit 21436b69a7
31 changed files with 172 additions and 172 deletions

View File

@ -1,7 +1,7 @@
CREATE TABLE IF NOT EXISTS api_kgon_synchronizations (
id SERIAL PRIMARY KEY,
item TEXT NOT NULL,
last_code INTEGER NOT NULL,
last_code BIGINT NOT NULL,
synchronized_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000)
);

View File

@ -3,7 +3,7 @@ CREATE TABLE IF NOT EXISTS api_kgon_synchronization_history (
item TEXT NOT NULL,
start_at BIGINT NOT NULL,
complete_at BIGINT NOT NULL,
code INTEGER NOT NULL,
code BIGINT NOT NULL,
message TEXT,
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000)
);

View File

@ -1,9 +1,9 @@
CREATE TABLE IF NOT EXISTS api_kgon_members (
id INTEGER NOT NULL,
balance INTEGER NOT NULL DEFAULT 0,
balance_bota INTEGER NOT NULL DEFAULT 0,
balance_sum INTEGER NOT NULL DEFAULT 0,
companies INTEGER NOT NULL DEFAULT 0,
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,
oriental_play BOOLEAN NOT NULL DEFAULT FALSE,
member_id UUID NOT NULL,
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),

View File

@ -1,7 +1,7 @@
CREATE TABLE IF NOT EXISTS api_kgon_balances (
id SERIAL PRIMARY KEY,
balance INTEGER NOT NULL DEFAULT 0,
balance_bota INTEGER NOT NULL DEFAULT 0,
balance BIGINT NOT NULL DEFAULT 0,
balance_bota BIGINT NOT NULL DEFAULT 0,
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000)
);

View File

@ -1,11 +1,11 @@
CREATE TABLE IF NOT EXISTS api_kgon_vendors (
id INTEGER NOT NULL,
company_id INTEGER NOT NULL,
vendor_id INTEGER NOT NULL,
max_bet_casino INTEGER NOT NULL,
max_bet_slot INTEGER NOT NULL,
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,
is_enable CHAR(1) NOT NULL,
bet_count INTEGER NOT NULL,
bet_count BIGINT NOT NULL,
key TEXT NOT NULL,
name TEXT NOT NULL,
category TEXT NOT NULL,

View File

@ -1,6 +1,6 @@
CREATE TABLE IF NOT EXISTS api_kgon_games (
id INTEGER NOT NULL,
vendor_id INTEGER NOT NULL,
id BIGINT NOT NULL,
vendor_id BIGINT NOT NULL,
key TEXT NOT NULL,
names TEXT NOT NULL,
platform TEXT NOT NULL,

View File

@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize};
pub struct Error {
pub code: i32,
pub code: i64,
pub msg: Option<String>,
}
@ -11,12 +11,12 @@ pub struct FindTransactionsRequest {
pub edate: Option<String>,
pub group_key: Option<String>,
pub username: Option<String>,
pub limit: i32,
pub limit: i64,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct FindTransactionsResponse {
pub code: i32,
pub code: i64,
pub msg: Option<String>,
pub transactions: Vec<String>,
}
@ -27,7 +27,7 @@ pub struct FindPragmaticHistoryRequest {
#[derive(Serialize, Deserialize, Debug)]
pub struct FindPragmaticHistoryResponse {
pub code: i32,
pub code: i64,
pub msg: Option<String>,
pub url: Option<String>,
}
@ -38,7 +38,7 @@ pub struct FindEvolutionTransactionDetailRequest {
#[derive(Serialize, Deserialize, Debug)]
pub struct FindEvolutionTransactionDetailResponse {
pub code: i32,
pub code: i64,
pub msg: Option<String>,
pub transactions: Vec<String>,
}
@ -51,7 +51,7 @@ pub struct FindStatisticRequest {
#[derive(Serialize, Deserialize, Debug)]
pub struct FindStatisticResponse {
pub code: i32,
pub code: i64,
pub msg: Option<String>,
pub data: Option<String>,
}

View File

@ -1,5 +1,5 @@
#[derive(Debug)]
pub struct Error {
pub code: i32,
pub code: i64,
pub msg: Option<String>,
}

View File

@ -3,7 +3,7 @@ use std::collections::HashMap;
#[derive(Serialize, Deserialize, Debug)]
pub struct Game {
pub id: i32,
pub id: i64,
pub key: String,
pub names: HashMap<String, String>,
pub platform: String,
@ -19,7 +19,7 @@ pub struct ListGamesRequest {
#[derive(Serialize, Deserialize, Debug)]
pub struct _ListGamesResponse {
pub code: i32,
pub code: i64,
pub msg: Option<String>,
pub games: Vec<Game>,
}
@ -36,23 +36,23 @@ pub struct PlayRequest {
pub nickname: String,
pub site_username: String,
pub group_key: Option<String>,
pub amount: i32,
pub amount: i64,
pub request_key: Option<String>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct _PlayResponse {
pub code: i32,
pub code: i64,
pub msg: Option<String>,
#[serde(rename = "userId")]
pub user_id: String,
pub url: String,
pub balance: i32,
pub balance: i64,
}
#[derive(Debug)]
pub struct PlayResponse {
pub user_id: String,
pub url: String,
pub balance: i32,
pub balance: i64,
}

View File

@ -7,10 +7,10 @@ pub struct ListMembersRequest {
#[derive(Serialize, Deserialize, Debug)]
pub struct Member {
pub id: i32,
pub id: i64,
pub username: String,
pub cash: i32,
pub cash_bota: i32,
pub cash: i64,
pub cash_bota: i64,
pub nickname: String,
pub site_username: String,
pub group_key: Option<String>,
@ -19,7 +19,7 @@ pub struct Member {
#[derive(Serialize, Deserialize, Debug)]
pub struct _ListMembersResponse {
pub code: i32,
pub code: i64,
pub msg: Option<String>,
pub users: Vec<Member>,
}
@ -39,7 +39,7 @@ pub struct SaveMemberRequest {
#[derive(Serialize, Deserialize, Debug)]
pub struct SaveMemberResponse {
pub code: i32,
pub code: i64,
pub msg: Option<String>,
pub id: Option<i32>,
pub id: Option<i64>,
}

View File

@ -6,50 +6,50 @@ pub struct GetBalanceForUserRequest {
#[derive(Serialize, Deserialize, Debug)]
pub struct _GetBalanceForUserResponse {
pub code: i32,
pub code: i64,
pub msg: Option<String>,
pub balance: i32,
pub balance_bota: i32,
pub balance_sum: i32,
pub companies: i32,
pub balance: i64,
pub balance_bota: i64,
pub balance_sum: i64,
pub companies: i64,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct GetBalanceForUserResponse {
pub balance: i32,
pub balance_bota: i32,
pub balance_sum: i32,
pub companies: i32,
pub balance: i64,
pub balance_bota: i64,
pub balance_sum: i64,
pub companies: i64,
}
pub struct GetBalanceForPartnerRequest {}
#[derive(Serialize, Deserialize, Debug)]
pub struct _GetBalanceForPartnerResponse {
pub code: i32,
pub code: i64,
pub msg: Option<String>,
pub balance: i32,
pub balance_bota: i32,
pub balance: i64,
pub balance_bota: i64,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct GetBalanceForPartnerResponse {
pub balance: i32,
pub balance_bota: i32,
pub balance: i64,
pub balance_bota: i64,
}
pub struct SaveDepositRequest {
pub username: String,
pub cash_type: Option<String>,
pub amount: i32,
pub amount: i64,
pub request_key: Option<String>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct SaveDepositResponse {
pub code: i32,
pub code: i64,
pub msg: Option<String>,
pub balance: i32,
pub balance: i64,
}
pub struct SaveWithdrawRequest {
@ -59,10 +59,10 @@ pub struct SaveWithdrawRequest {
#[derive(Serialize, Deserialize, Debug)]
pub struct SaveWithdrawResponse {
pub code: i32,
pub code: i64,
pub msg: Option<String>,
pub balance: i32,
pub balance_cash: i32,
pub balance_cash_bota: i32,
pub amount: i32,
pub balance: i64,
pub balance_cash: i64,
pub balance_cash_bota: i64,
pub amount: i64,
}

View File

@ -2,13 +2,13 @@ use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
pub struct Vendor {
pub id: i32,
pub company_id: i32,
pub vendor_id: i32,
pub max_bet_casino: i32,
pub max_bet_slot: i32,
pub id: i64,
pub company_id: i64,
pub vendor_id: i64,
pub max_bet_casino: i64,
pub max_bet_slot: i64,
pub is_enable: String,
pub bet_count: i32,
pub bet_count: i64,
pub key: String,
pub name: String,
pub category: String,
@ -18,7 +18,7 @@ pub struct ListVendorsRequest {}
#[derive(Serialize, Deserialize, Debug)]
pub struct _ListVendorsResponse {
pub code: i32,
pub code: i64,
pub msg: Option<String>,
pub vendors: Vec<Vendor>,
}

View File

@ -87,30 +87,30 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut sched = tokio_cron_scheduler::JobScheduler::new().await?;
let member_scheduler = schedulers::member::scheduler::Scheduler::get_instance(
pool.clone(),
sched.clone(),
api_config.clone(),
)?;
member_scheduler.queue().await?;
let balance_scheduler = schedulers::balance::scheduler::Scheduler::get_instance(
pool.clone(),
sched.clone(),
api_config.clone(),
)?;
balance_scheduler.queue().await?;
// let member_scheduler = schedulers::member::scheduler::Scheduler::get_instance(
// pool.clone(),
// sched.clone(),
// api_config.clone(),
// )?;
// member_scheduler.queue().await?;
// let balance_scheduler = schedulers::balance::scheduler::Scheduler::get_instance(
// pool.clone(),
// sched.clone(),
// api_config.clone(),
// )?;
// balance_scheduler.queue().await?;
let vendor_scheduler = schedulers::vendor::scheduler::Scheduler::get_instance(
pool.clone(),
sched.clone(),
api_config.clone(),
)?;
vendor_scheduler.queue().await?;
let game_scheduler = schedulers::game::scheduler::Scheduler::get_instance(
pool.clone(),
sched.clone(),
api_config.clone(),
)?;
game_scheduler.queue().await?;
// let game_scheduler = schedulers::game::scheduler::Scheduler::get_instance(
// pool.clone(),
// sched.clone(),
// api_config.clone(),
// )?;
// game_scheduler.queue().await?;
let _h_scheduler = sched.start().await?;

View File

@ -7,9 +7,9 @@ pub struct Balance {
///
pub id: i32,
///
pub balance: i32,
pub balance: i64,
///
pub balance_bota: i32,
pub balance_bota: i64,
///
pub created_at: i64,
///
@ -21,9 +21,9 @@ pub struct Balance {
#[table_name = "api_kgon_balances"]
pub struct NewBalance {
///
pub balance: i32,
pub balance: i64,
///
pub balance_bota: i32,
pub balance_bota: i64,
}
///
@ -31,7 +31,7 @@ pub struct NewBalance {
#[table_name = "api_kgon_balances"]
pub struct ModifyBalance {
///
pub balance: i32,
pub balance: i64,
///
pub balance_bota: i32,
pub balance_bota: i64,
}

View File

@ -7,9 +7,9 @@ table! {
///
id -> Integer,
///
balance -> Integer,
balance -> BigInt,
///
balance_bota -> Integer,
balance_bota -> BigInt,
///
created_at -> BigInt,
///

View File

@ -6,9 +6,9 @@ use beteran_common_rust as bcr;
#[table_name = "api_kgon_games"]
pub struct Game {
///
pub id: i32,
pub id: i64,
///
pub vendor_id: i32,
pub vendor_id: i64,
///
pub key: String,
///
@ -32,9 +32,9 @@ pub struct Game {
#[table_name = "api_kgon_games"]
pub struct NewGame {
///
pub id: i32,
pub id: i64,
///
pub vendor_id: i32,
pub vendor_id: i64,
///
pub key: String,
///
@ -72,9 +72,9 @@ pub struct ModifyGame {
#[table_name = "api_kgon_games"]
pub struct UpsertGame {
///
pub id: i32,
pub id: i64,
///
pub vendor_id: i32,
pub vendor_id: i64,
///
pub key: String,
///
@ -93,7 +93,7 @@ pub struct UpsertGame {
#[derive(Debug, Clone)]
pub struct FindAllSearch {
///
pub vendor_id: Option<i32>,
pub vendor_id: Option<i64>,
///
pub key_like: Option<String>,
///

View File

@ -70,7 +70,7 @@ impl Repository {
pub fn select(
&self,
conn: &diesel::PgConnection,
id: i32,
id: i64,
) -> Result<Option<models::Game>, Error> {
match api_kgon_games::table.find(id).first::<models::Game>(conn) {
Ok(m) => Ok(Some(m)),
@ -206,7 +206,7 @@ impl Repository {
pub fn update(
&self,
conn: &diesel::PgConnection,
id: i32,
id: i64,
modify: &models::ModifyGame,
) -> Result<u64, Error> {
use api_kgon_games::dsl;
@ -218,7 +218,7 @@ impl Repository {
}
///
pub fn delete(&self, conn: &diesel::PgConnection, id: i32) -> Result<u64, Error> {
pub fn delete(&self, conn: &diesel::PgConnection, id: i64) -> Result<u64, Error> {
use api_kgon_games::dsl;
diesel::delete(api_kgon_games::table.filter(dsl::id.eq(id)))

View File

@ -5,9 +5,9 @@ table! {
///
api_kgon_games(id) {
///
id -> Integer,
id -> BigInt,
///
vendor_id -> Integer,
vendor_id -> BigInt,
///
key -> Text,
///

View File

@ -6,15 +6,15 @@ use beteran_common_rust as bcr;
#[table_name = "api_kgon_members"]
pub struct Member {
///
pub id: i32,
pub id: i64,
///
pub balance: i32,
pub balance: i64,
///
pub balance_bota: i32,
pub balance_bota: i64,
///
pub balance_sum: i32,
pub balance_sum: i64,
///
pub companies: i32,
pub companies: i64,
///
pub oriental_play: String,
///
@ -30,15 +30,15 @@ pub struct Member {
#[table_name = "api_kgon_members"]
pub struct NewMember {
///
pub id: i32,
pub id: i64,
///
pub balance: i32,
pub balance: i64,
///
pub balance_bota: i32,
pub balance_bota: i64,
///
pub balance_sum: i32,
pub balance_sum: i64,
///
pub companies: i32,
pub companies: i64,
///
pub oriental_play: String,
///
@ -50,9 +50,9 @@ pub struct NewMember {
#[table_name = "api_kgon_members"]
pub struct ModifyMember {
///
pub balance: i32,
pub balance: i64,
///
pub balance_bota: i32,
pub balance_bota: i64,
///
pub oriental_play: String,
}
@ -62,13 +62,13 @@ pub struct ModifyMember {
#[table_name = "api_kgon_members"]
pub struct ModifyMemberForBalance {
///
pub balance: i32,
pub balance: i64,
///
pub balance_bota: i32,
pub balance_bota: i64,
///
pub balance_sum: i32,
pub balance_sum: i64,
///
pub companies: i32,
pub companies: i64,
}
///

View File

@ -43,7 +43,7 @@ impl Repository {
pub fn select(
&self,
conn: &diesel::PgConnection,
id: i32,
id: i64,
) -> Result<Option<models::Member>, Error> {
match api_kgon_members::table
.find(id)
@ -178,7 +178,7 @@ impl Repository {
pub fn update(
&self,
conn: &diesel::PgConnection,
id: i32,
id: i64,
modify: &models::ModifyMember,
) -> Result<u64, Error> {
use api_kgon_members::dsl;
@ -193,7 +193,7 @@ impl Repository {
pub fn update_balance(
&self,
conn: &diesel::PgConnection,
id: i32,
id: i64,
modify: &models::ModifyMemberForBalance,
) -> Result<u64, Error> {
use api_kgon_members::dsl;
@ -205,7 +205,7 @@ impl Repository {
}
///
pub fn delete(&self, conn: &diesel::PgConnection, id: i32) -> Result<u64, Error> {
pub fn delete(&self, conn: &diesel::PgConnection, id: i64) -> Result<u64, Error> {
use api_kgon_members::dsl;
diesel::delete(api_kgon_members::table.filter(dsl::id.eq(id)))

View File

@ -5,15 +5,15 @@ table! {
///
api_kgon_members(id) {
///
id -> Integer,
id -> BigInt,
///
balance -> Integer,
balance -> BigInt,
///
balance_bota -> Integer,
balance_bota -> BigInt,
///
balance_sum -> Integer,
balance_sum -> BigInt,
///
companies -> Integer,
companies -> BigInt,
///
oriental_play -> Text,
///

View File

@ -14,7 +14,7 @@ pub struct SynchronizationHistory {
///
pub complete_at: i64,
///
pub code: i32,
pub code: i64,
///
pub message: Option<String>,
///
@ -32,7 +32,7 @@ pub struct NewSynchronizationHistory {
///
pub complete_at: i64,
///
pub code: i32,
pub code: i64,
///
pub message: Option<String>,
}
@ -43,7 +43,7 @@ pub struct FindAllSearch {
///
pub item: Option<String>,
///
pub code: Option<i32>,
pub code: Option<i64>,
}
///
#[derive(Debug, Clone)]

View File

@ -13,7 +13,7 @@ table! {
///
complete_at -> BigInt,
///
code -> Integer,
code -> BigInt,
///
message -> Nullable<Text>,
///

View File

@ -6,11 +6,11 @@ use beteran_common_rust as bcr;
#[table_name = "api_kgon_vendors"]
pub struct Vendor {
///
pub id: i32,
pub id: i64,
///
pub company_id: i32,
pub company_id: i64,
///
pub vendor_id: i32,
pub vendor_id: i64,
///
pub key: String,
///
@ -18,13 +18,13 @@ pub struct Vendor {
///
pub category: String,
///
pub max_bet_casino: i32,
pub max_bet_casino: i64,
///
pub max_bet_slot: i32,
pub max_bet_slot: i64,
///
pub is_enable: String,
///
pub bet_count: i32,
pub bet_count: i64,
///
pub created_at: i64,
///
@ -36,11 +36,11 @@ pub struct Vendor {
#[table_name = "api_kgon_vendors"]
pub struct NewVendor {
///
pub id: i32,
pub id: i64,
///
pub company_id: i32,
pub company_id: i64,
///
pub vendor_id: i32,
pub vendor_id: i64,
///
pub key: String,
///
@ -48,13 +48,13 @@ pub struct NewVendor {
///
pub category: String,
///
pub max_bet_casino: i32,
pub max_bet_casino: i64,
///
pub max_bet_slot: i32,
pub max_bet_slot: i64,
///
pub is_enable: String,
///
pub bet_count: i32,
pub bet_count: i64,
}
///
@ -62,9 +62,9 @@ pub struct NewVendor {
#[table_name = "api_kgon_vendors"]
pub struct ModifyVendor {
///
pub company_id: i32,
pub company_id: i64,
///
pub vendor_id: i32,
pub vendor_id: i64,
///
pub key: String,
///
@ -72,13 +72,13 @@ pub struct ModifyVendor {
///
pub category: String,
///
pub max_bet_casino: i32,
pub max_bet_casino: i64,
///
pub max_bet_slot: i32,
pub max_bet_slot: i64,
///
pub is_enable: String,
///
pub bet_count: i32,
pub bet_count: i64,
}
///
@ -86,11 +86,11 @@ pub struct ModifyVendor {
#[table_name = "api_kgon_vendors"]
pub struct UpsertVendor {
///
pub id: i32,
pub id: i64,
///
pub company_id: i32,
pub company_id: i64,
///
pub vendor_id: i32,
pub vendor_id: i64,
///
pub key: String,
///
@ -98,22 +98,22 @@ pub struct UpsertVendor {
///
pub category: String,
///
pub max_bet_casino: i32,
pub max_bet_casino: i64,
///
pub max_bet_slot: i32,
pub max_bet_slot: i64,
///
pub is_enable: String,
///
pub bet_count: i32,
pub bet_count: i64,
}
///
#[derive(Debug, Clone)]
pub struct FindAllSearch {
///
pub company_id: Option<i32>,
pub company_id: Option<i64>,
///
pub vendor_id: Option<i32>,
pub vendor_id: Option<i64>,
///
pub key_like: Option<String>,
///

View File

@ -72,7 +72,7 @@ impl Repository {
pub fn select(
&self,
conn: &diesel::PgConnection,
id: i32,
id: i64,
) -> Result<Option<models::Vendor>, Error> {
match api_kgon_vendors::table
.find(id)
@ -241,7 +241,7 @@ impl Repository {
pub fn update(
&self,
conn: &diesel::PgConnection,
id: i32,
id: i64,
modify: &models::ModifyVendor,
) -> Result<u64, Error> {
use api_kgon_vendors::dsl;
@ -253,7 +253,7 @@ impl Repository {
}
///
pub fn delete(&self, conn: &diesel::PgConnection, id: i32) -> Result<u64, Error> {
pub fn delete(&self, conn: &diesel::PgConnection, id: i64) -> Result<u64, Error> {
use api_kgon_vendors::dsl;
diesel::delete(api_kgon_vendors::table.filter(dsl::id.eq(id)))

View File

@ -5,11 +5,11 @@ table! {
///
api_kgon_vendors(id) {
///
id -> Integer,
id -> BigInt,
///
company_id -> Integer,
company_id -> BigInt,
///
vendor_id -> Integer,
vendor_id -> BigInt,
///
key -> Text,
///
@ -17,13 +17,13 @@ table! {
///
category -> Text,
///
max_bet_casino -> Integer,
max_bet_casino -> BigInt,
///
max_bet_slot -> Integer,
max_bet_slot -> BigInt,
///
is_enable -> Text,
///
bet_count -> Integer,
bet_count -> BigInt,
///
created_at -> BigInt,
///

View File

@ -68,7 +68,7 @@ impl Scheduler {
&'static self,
item: String,
start_at: i64,
code: i32,
code: i64,
message: Option<String>,
) -> Result<(), Box<dyn std::error::Error>> {
let conn = self.pool.get().expect("conn");

View File

@ -65,7 +65,7 @@ impl Scheduler {
&'static self,
item: String,
start_at: i64,
code: i32,
code: i64,
message: Option<String>,
) -> Result<(), Box<dyn std::error::Error>> {
let complete_at = (chrono::Utc::now()).timestamp();

View File

@ -63,7 +63,7 @@ impl Scheduler {
&'static self,
item: String,
start_at: i64,
code: i32,
code: i64,
message: Option<String>,
) -> Result<(), Box<dyn std::error::Error>> {
let conn = self.pool.get().expect("conn");

View File

@ -63,7 +63,7 @@ impl Scheduler {
&'static self,
item: String,
start_at: i64,
code: i32,
code: i64,
message: Option<String>,
) -> Result<(), Box<dyn std::error::Error>> {
let complete_at = (chrono::Utc::now()).timestamp();

View File

@ -105,8 +105,8 @@ impl Service {
search: match request.search {
Some(s) => Some(repositories::vendor::models::FindAllSearch {
name_like: s.name_like,
company_id: s.company_id.map(|d| d as i32),
vendor_id: s.vendor_id.map(|d| d as i32),
company_id: s.company_id.map(|d| d as i64),
vendor_id: s.vendor_id.map(|d| d as i64),
key_like: s.key_like,
category_like: s.category_like,
is_enable: s.is_enable,