member, member_bank_account are modified
This commit is contained in:
parent
936565f9e6
commit
d098634d94
|
@ -19,7 +19,7 @@ prost = { version = "0" }
|
||||||
nats = { version = "0" }
|
nats = { version = "0" }
|
||||||
base64 = { version = "0" }
|
base64 = { version = "0" }
|
||||||
|
|
||||||
beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.72-snapshot" }
|
beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.74-snapshot" }
|
||||||
beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.56-snapshot" }
|
beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.58-snapshot" }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
|
|
@ -31,6 +31,8 @@ impl Service {
|
||||||
self.get_member(),
|
self.get_member(),
|
||||||
self.get_member_by_username(),
|
self.get_member_by_username(),
|
||||||
self.update_member(),
|
self.update_member(),
|
||||||
|
self.update_member_for_password(),
|
||||||
|
self.update_member_for_state(),
|
||||||
self.delete_member(),
|
self.delete_member(),
|
||||||
)
|
)
|
||||||
.map(|_| ())
|
.map(|_| ())
|
||||||
|
@ -150,6 +152,7 @@ impl Service {
|
||||||
username: req.username,
|
username: req.username,
|
||||||
password: req.password,
|
password: req.password,
|
||||||
nickname: req.nickname,
|
nickname: req.nickname,
|
||||||
|
state: bpr::models::member::MemberState::Normal as i32,
|
||||||
bank_account,
|
bank_account,
|
||||||
game_setting,
|
game_setting,
|
||||||
settlement_setting,
|
settlement_setting,
|
||||||
|
@ -569,7 +572,7 @@ impl Service {
|
||||||
bank_id: a.bank_id,
|
bank_id: a.bank_id,
|
||||||
name: a.name,
|
name: a.name,
|
||||||
account_number: a.account_number,
|
account_number: a.account_number,
|
||||||
exchange_password: a.exchange_password,
|
memo: a.memo,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
None => None,
|
None => None,
|
||||||
|
@ -625,7 +628,6 @@ impl Service {
|
||||||
id: req.id,
|
id: req.id,
|
||||||
site_id: req.site_id,
|
site_id: req.site_id,
|
||||||
member_level_id: req.member_level_id,
|
member_level_id: req.member_level_id,
|
||||||
password: req.password,
|
|
||||||
mobile_phone_number: req.mobile_phone_number,
|
mobile_phone_number: req.mobile_phone_number,
|
||||||
bank_account,
|
bank_account,
|
||||||
game_setting,
|
game_setting,
|
||||||
|
@ -706,6 +708,211 @@ impl Service {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn update_member_for_password(&self) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
let s = self
|
||||||
|
.connection_broker
|
||||||
|
.queue_subscribe(
|
||||||
|
bpr::c2se::backend::member::SUBJECT_UPDATE_MEMBER_FOR_PASSWORD,
|
||||||
|
self.queue_broker.as_str(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
while let Some(message) = s.next().await {
|
||||||
|
if let Err(e) = async {
|
||||||
|
let client = self.get_client_in_header(&message)?;
|
||||||
|
|
||||||
|
let req =
|
||||||
|
bpr::c2se::member::UpdateMemberForPasswordRequest::decode(message.data.as_slice())
|
||||||
|
.map_err(|e| {
|
||||||
|
bcr::error::rpc::Error::InvalidRequest(bcr::error::rpc::InvalidRequest {
|
||||||
|
message: format!("invalid request: {}", e),
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let ss_update_member_req = bpr::ss::member::UpdateMemberForPasswordRequest {
|
||||||
|
client: Some(client),
|
||||||
|
request: Some(
|
||||||
|
bpr::ss::member::update_member_for_password_request::Request {
|
||||||
|
id: req.id,
|
||||||
|
password: req.password,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
|
let ss_update_member_res_msg = self
|
||||||
|
.connection_broker
|
||||||
|
.request(
|
||||||
|
bpr::ss::member::SUBJECT_UPDATE_MEMBER_FOR_PASSWORD,
|
||||||
|
ss_update_member_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_update_member_res = bpr::ss::member::UpdateMemberForPasswordResponse::decode(
|
||||||
|
ss_update_member_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_update_member_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,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(r) = ss_update_member_res.result {
|
||||||
|
message
|
||||||
|
.respond(
|
||||||
|
bpr::c2se::member::UpdateMemberForPasswordResponse {
|
||||||
|
error: None,
|
||||||
|
result: Some(bpr::c2se::member::update_member_for_password_response::Result {}),
|
||||||
|
}
|
||||||
|
.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,
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok::<(), bcr::error::rpc::Error>(())
|
||||||
|
}
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
message
|
||||||
|
.respond(
|
||||||
|
bpr::c2se::member::UpdateMemberForPasswordResponse {
|
||||||
|
error: Some(bpr::protobuf::rpc::Error::from(e)),
|
||||||
|
result: None,
|
||||||
|
}
|
||||||
|
.encode_to_vec(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn update_member_for_state(&self) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
let s = self
|
||||||
|
.connection_broker
|
||||||
|
.queue_subscribe(
|
||||||
|
bpr::c2se::backend::member::SUBJECT_UPDATE_MEMBER_FOR_STATE,
|
||||||
|
self.queue_broker.as_str(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
while let Some(message) = s.next().await {
|
||||||
|
if let Err(e) = async {
|
||||||
|
let client = self.get_client_in_header(&message)?;
|
||||||
|
|
||||||
|
let req = bpr::c2se::member::UpdateMemberForStateRequest::decode(message.data.as_slice())
|
||||||
|
.map_err(|e| {
|
||||||
|
bcr::error::rpc::Error::InvalidRequest(bcr::error::rpc::InvalidRequest {
|
||||||
|
message: format!("invalid request: {}", e),
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let ss_update_member_req = bpr::ss::member::UpdateMemberForStateRequest {
|
||||||
|
client: Some(client),
|
||||||
|
request: Some(bpr::ss::member::update_member_for_state_request::Request {
|
||||||
|
id: req.id,
|
||||||
|
state: req.state,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
|
let ss_update_member_res_msg = self
|
||||||
|
.connection_broker
|
||||||
|
.request(
|
||||||
|
bpr::ss::member::SUBJECT_UPDATE_MEMBER_FOR_STATE,
|
||||||
|
ss_update_member_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_update_member_res = bpr::ss::member::UpdateMemberForStateResponse::decode(
|
||||||
|
ss_update_member_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_update_member_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,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(r) = ss_update_member_res.result {
|
||||||
|
message
|
||||||
|
.respond(
|
||||||
|
bpr::c2se::member::UpdateMemberForStateResponse {
|
||||||
|
error: None,
|
||||||
|
result: Some(
|
||||||
|
bpr::c2se::member::update_member_for_state_response::Result { member: r.member },
|
||||||
|
),
|
||||||
|
}
|
||||||
|
.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,
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok::<(), bcr::error::rpc::Error>(())
|
||||||
|
}
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
message
|
||||||
|
.respond(
|
||||||
|
bpr::c2se::member::UpdateMemberForStateResponse {
|
||||||
|
error: Some(bpr::protobuf::rpc::Error::from(e)),
|
||||||
|
result: None,
|
||||||
|
}
|
||||||
|
.encode_to_vec(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
async fn delete_member(&self) -> Result<(), Box<dyn std::error::Error>> {
|
async fn delete_member(&self) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let s = self
|
let s = self
|
||||||
.connection_broker
|
.connection_broker
|
||||||
|
|
|
@ -30,6 +30,7 @@ impl Service {
|
||||||
self.list_member_bank_accounts(),
|
self.list_member_bank_accounts(),
|
||||||
self.get_member_bank_account(),
|
self.get_member_bank_account(),
|
||||||
self.update_member_bank_account(),
|
self.update_member_bank_account(),
|
||||||
|
self.update_member_bank_account_for_exchange_password(),
|
||||||
self.delete_member_bank_account(),
|
self.delete_member_bank_account(),
|
||||||
)
|
)
|
||||||
.map(|_| ())
|
.map(|_| ())
|
||||||
|
@ -421,7 +422,6 @@ impl Service {
|
||||||
bank_id: req.bank_id,
|
bank_id: req.bank_id,
|
||||||
name: req.name,
|
name: req.name,
|
||||||
account_number: req.account_number,
|
account_number: req.account_number,
|
||||||
exchange_password: req.exchange_password,
|
|
||||||
memo: req.memo,
|
memo: req.memo,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -501,6 +501,108 @@ impl Service {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn update_member_bank_account_for_exchange_password(&self) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
let s = self
|
||||||
|
.connection_broker
|
||||||
|
.queue_subscribe(
|
||||||
|
bpr::c2se::backend::member_bank_account::SUBJECT_UPDATE_MEMBER_BANK_ACCOUNT_FOR_EXCHANGE_PASSWORD,
|
||||||
|
self.queue_broker.as_str(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
while let Some(message) = s.next().await {
|
||||||
|
if let Err(e) = async {
|
||||||
|
let client = self.get_client_in_header(&message)?;
|
||||||
|
|
||||||
|
let req = bpr::c2se::member_bank_account::UpdateMemberBankAccountForExchangePasswordRequest::decode(message.data.as_slice())
|
||||||
|
.map_err(|e| {
|
||||||
|
bcr::error::rpc::Error::InvalidRequest(bcr::error::rpc::InvalidRequest {
|
||||||
|
message: format!("invalid request: {}", e),
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let ss_update_member_bank_account_req = bpr::ss::member_bank_account::UpdateMemberBankAccountForExchangePasswordRequest {
|
||||||
|
client: Some(client),
|
||||||
|
request: Some(bpr::ss::member_bank_account::update_member_bank_account_for_exchange_password_request::Request{
|
||||||
|
id: req.id,
|
||||||
|
exchange_password: req.exchange_password,
|
||||||
|
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
let ss_update_member_bank_account_res_msg = self
|
||||||
|
.connection_broker
|
||||||
|
.request(
|
||||||
|
bpr::ss::member_bank_account::SUBJECT_UPDATE_MEMBER_BANK_ACCOUNT_FOR_EXCHANGE_PASSWORD,
|
||||||
|
ss_update_member_bank_account_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_update_member_bank_account_res = bpr::ss::member_bank_account::UpdateMemberBankAccountForExchangePasswordResponse::decode(
|
||||||
|
ss_update_member_bank_account_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_update_member_bank_account_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,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(r) = ss_update_member_bank_account_res.result {
|
||||||
|
message
|
||||||
|
.respond(
|
||||||
|
bpr::c2se::member_bank_account::UpdateMemberBankAccountForExchangePasswordResponse {
|
||||||
|
error: None,
|
||||||
|
result: Some(bpr::c2se::member_bank_account::update_member_bank_account_for_exchange_password_response::Result {
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
.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,
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok::<(), bcr::error::rpc::Error>(())
|
||||||
|
}
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
message
|
||||||
|
.respond(
|
||||||
|
bpr::c2se::member_bank_account::UpdateMemberBankAccountForExchangePasswordResponse {
|
||||||
|
error: Some(bpr::protobuf::rpc::Error::from(e)),
|
||||||
|
result: None,
|
||||||
|
}
|
||||||
|
.encode_to_vec(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
async fn delete_member_bank_account(&self) -> Result<(), Box<dyn std::error::Error>> {
|
async fn delete_member_bank_account(&self) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let s = self
|
let s = self
|
||||||
.connection_broker
|
.connection_broker
|
||||||
|
|
Loading…
Reference in New Issue
Block a user