model is changed
This commit is contained in:
parent
0a20633990
commit
e245e12d5e
|
@ -19,7 +19,7 @@ prost = { version = "0" }
|
|||
nats = { version = "0" }
|
||||
base64 = { version = "0" }
|
||||
|
||||
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" }
|
||||
beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.92-snapshot" }
|
||||
beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.78-snapshot" }
|
||||
|
||||
[build-dependencies]
|
||||
|
|
|
@ -84,7 +84,7 @@ impl Service {
|
|||
})?;
|
||||
|
||||
let ss_list_betting_history_req = bpr::ss::api::betting::ListBettingHistoryRequest {
|
||||
client: Some(client),
|
||||
client: Some(client.clone()),
|
||||
request: Some(
|
||||
bpr::ss::api::betting::list_betting_history_request::Request {
|
||||
pagination: req.pagination,
|
||||
|
@ -168,13 +168,121 @@ impl Service {
|
|||
}
|
||||
|
||||
if let Some(r) = ss_list_betting_history_res.result {
|
||||
let mut usernames: Vec<String> = vec![];
|
||||
for b in &r.betting_history {
|
||||
let username = b.site_username.clone();
|
||||
if !usernames.contains(&username) {
|
||||
usernames.push(username);
|
||||
}
|
||||
}
|
||||
|
||||
let members = if !usernames.is_empty() {
|
||||
let ss_list_members_req = bpr::ss::member::ListMembersRequest {
|
||||
client: Some(client.clone()),
|
||||
request: Some(bpr::ss::member::list_members_request::Request {
|
||||
pagination: None,
|
||||
sorts: vec![],
|
||||
search: Some(bpr::ss::member::list_members_request::request::Search {
|
||||
site_id: None,
|
||||
member_class_id: None,
|
||||
member_level_id: None,
|
||||
parent_member_id: None,
|
||||
username: None,
|
||||
usernames,
|
||||
username_like: None,
|
||||
nickname: None,
|
||||
nicknames: vec![],
|
||||
nickname_like: None,
|
||||
mobile_phone_number_like: None,
|
||||
last_signined_ip: None,
|
||||
state: None,
|
||||
deleted_at: None,
|
||||
}),
|
||||
}),
|
||||
};
|
||||
|
||||
let ss_list_members_res_msg = self
|
||||
.connection_broker
|
||||
.request(
|
||||
bpr::ss::member::SUBJECT_LIST_MEMBERS,
|
||||
ss_list_members_req.encode_to_vec(),
|
||||
)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||
message: format!("server {}", e),
|
||||
data: None,
|
||||
})
|
||||
})?;
|
||||
|
||||
let ss_list_members_res =
|
||||
bpr::ss::member::ListMembersResponse::decode(ss_list_members_res_msg.data.as_slice())
|
||||
.map_err(|e| {
|
||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||
message: format!("server {}", e),
|
||||
data: None,
|
||||
})
|
||||
})?;
|
||||
|
||||
if let Some(e) = ss_list_members_res.error {
|
||||
return Err(bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||
message: format!("server {}", e),
|
||||
data: None,
|
||||
}));
|
||||
}
|
||||
|
||||
match ss_list_members_res.result {
|
||||
Some(rr) => rr.members,
|
||||
None => vec![],
|
||||
}
|
||||
} else {
|
||||
vec![]
|
||||
};
|
||||
|
||||
let mut betting_history: Vec<bpr::models::api::betting::BettingHistoryModel> = vec![];
|
||||
for b in r.betting_history {
|
||||
let member = members
|
||||
.iter()
|
||||
.find(|v| v.username.eq(&b.site_username))
|
||||
.cloned();
|
||||
betting_history.push(bpr::models::api::betting::BettingHistoryModel {
|
||||
id: b.id,
|
||||
vendor_id: b.vendor_id,
|
||||
vendor_name: b.vendor_name,
|
||||
game_id: b.game_id,
|
||||
game_name: b.game_name,
|
||||
game_category: b.game_category,
|
||||
game_type: b.game_type,
|
||||
currency: b.currency,
|
||||
cash: b.cash,
|
||||
before_cash: b.before_cash,
|
||||
after_cash: b.after_cash,
|
||||
key: b.key,
|
||||
ref_id: b.ref_id,
|
||||
o_ref_id: b.o_ref_id,
|
||||
group_key: b.group_key,
|
||||
is_bonus: b.is_bonus,
|
||||
is_promo: b.is_promo,
|
||||
is_jackpot: b.is_jackpot,
|
||||
site_username: b.site_username,
|
||||
betting_type: b.betting_type,
|
||||
category: b.category,
|
||||
created_at: b.created_at,
|
||||
utc_created_at: b.utc_created_at,
|
||||
member,
|
||||
});
|
||||
}
|
||||
|
||||
message
|
||||
.respond(
|
||||
bpr::c2se::api::betting::ListBettingHistoryResponse {
|
||||
error: None,
|
||||
result: Some(
|
||||
bpr::c2se::api::betting::list_betting_history_response::Result {
|
||||
betting_history: r.betting_history,
|
||||
betting_history,
|
||||
},
|
||||
),
|
||||
}
|
||||
|
|
|
@ -263,7 +263,11 @@ impl Service {
|
|||
member_class_id: s.member_class_id,
|
||||
member_level_id: s.member_level_id,
|
||||
parent_member_id: s.parent_member_id,
|
||||
username: s.username,
|
||||
usernames: s.usernames,
|
||||
username_like: s.username_like,
|
||||
nickname: s.nickname,
|
||||
nicknames: s.nicknames,
|
||||
nickname_like: s.nickname_like,
|
||||
mobile_phone_number_like: s.mobile_phone_number_like,
|
||||
last_signined_ip: s.last_signined_ip,
|
||||
|
|
Loading…
Reference in New Issue
Block a user