methods are modified

This commit is contained in:
병준 박 2022-09-07 04:08:37 +00:00
parent 17e993955c
commit ad97b8b550
4 changed files with 39 additions and 42 deletions

View File

@ -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.95-snapshot" } beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.96-snapshot" }
beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.81-snapshot" } beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.82-snapshot" }
[build-dependencies] [build-dependencies]

View File

@ -47,7 +47,7 @@ impl Composition {
} }
}; };
let ss_get_member_req = bpr::ss::member::GetMemberRequest { let ss_get_member_req = bpr::ss::member::GetMemberBRequest {
client: Some(bpr::models::core::network::Client { client: Some(bpr::models::core::network::Client {
client_ip: self client_ip: self
.connection_broker .connection_broker
@ -57,7 +57,7 @@ impl Composition {
site_url: None, site_url: None,
access_token: None, access_token: None,
}), }),
request: Some(bpr::ss::member::get_member_request::Request { request: Some(bpr::ss::member::get_member_b_request::Request {
id: m.member_id.to_string(), id: m.member_id.to_string(),
}), }),
}; };
@ -65,7 +65,7 @@ impl Composition {
let ss_get_member_res_msg = self let ss_get_member_res_msg = self
.connection_broker .connection_broker
.request( .request(
bpr::ss::member::SUBJECT_GET_MEMBER, bpr::ss::member::SUBJECT_GET_MEMBER_B,
ss_get_member_req.encode_to_vec(), ss_get_member_req.encode_to_vec(),
) )
.await .await
@ -77,15 +77,16 @@ impl Composition {
}) })
})?; })?;
let ss_get_member_res = let ss_get_member_res = bpr::ss::member::GetMemberBResponse::decode(
bpr::ss::member::GetMemberByUsernameResponse::decode(ss_get_member_res_msg.data.as_slice()) ss_get_member_res_msg.data.as_slice(),
.map_err(|e| { )
bcr::error::rpc::Error::Server(bcr::error::rpc::Server { .map_err(|e| {
code: bpr::protobuf::rpc::Error::SERVER_00, bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
message: format!("server {}", e), code: bpr::protobuf::rpc::Error::SERVER_00,
data: None, message: format!("server {}", e),
}) data: None,
})?; })
})?;
if let Some(e) = ss_get_member_res.error { if let Some(e) = ss_get_member_res.error {
return Err(bcr::error::rpc::Error::Server(bcr::error::rpc::Server { return Err(bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
@ -95,28 +96,24 @@ impl Composition {
})); }));
} }
match ss_get_member_res.result { let mm = match ss_get_member_res.result {
Some(r) => match r.member { Some(r) => match r.member {
Some(mm) => { Some(_m) => Some(models::MemberModel {
return Ok(Some(models::MemberModel { id: m.id,
id: m.id, balance: m.balance,
balance: m.balance, balance_bota: m.balance_bota,
balance_bota: m.balance_bota, balance_sum: m.balance_sum,
balance_sum: m.balance_sum, companies: m.companies,
companies: m.companies, oriental_play: m.oriental_play,
oriental_play: m.oriental_play, member: _m,
member: mm, created_at: m.created_at,
created_at: m.created_at, updated_at: m.updated_at,
updated_at: m.updated_at, }),
})); None => None,
}
None => {
return Ok(None);
}
}, },
None => { None => None,
return Ok(None);
}
}; };
Ok(mm)
} }
} }

View File

@ -16,7 +16,7 @@ pub struct MemberModel {
/// ///
pub oriental_play: String, pub oriental_play: String,
/// ///
pub member: bpr::models::member::MemberModel, pub member: bpr::models::member::Member,
/// ///
pub created_at: i64, pub created_at: i64,
/// ///

View File

@ -96,7 +96,7 @@ impl Synchronizer {
} }
.is_none() .is_none()
{ {
let ss_get_member_by_username_req = bpr::ss::member::GetMemberByUsernameRequest { let ss_get_member_by_username_req = bpr::ss::member::GetMemberBByUsernameRequest {
client: Some(bpr::models::core::network::Client { client: Some(bpr::models::core::network::Client {
client_ip: self client_ip: self
.connection_broker .connection_broker
@ -106,7 +106,7 @@ impl Synchronizer {
site_url: None, site_url: None,
access_token: None, access_token: None,
}), }),
request: Some(bpr::ss::member::get_member_by_username_request::Request { request: Some(bpr::ss::member::get_member_b_by_username_request::Request {
username: u.site_username.clone(), username: u.site_username.clone(),
}), }),
}; };
@ -114,7 +114,7 @@ impl Synchronizer {
let ss_get_member_by_username_res_msg = match self let ss_get_member_by_username_res_msg = match self
.connection_broker .connection_broker
.request( .request(
bpr::ss::member::SUBJECT_GET_MEMBER_BY_USERNAME, bpr::ss::member::SUBJECT_GET_MEMBER_B_BY_USERNAME,
ss_get_member_by_username_req.encode_to_vec(), ss_get_member_by_username_req.encode_to_vec(),
) )
.await .await
@ -124,7 +124,7 @@ impl Synchronizer {
return Err(api::core::models::Error { return Err(api::core::models::Error {
code: -1, code: -1,
msg: Some(format!( msg: Some(format!(
"bpr::ss::member::SUBJECT_GET_MEMBER_BY_USERNAME: {}", "bpr::ss::member::SUBJECT_GET_MEMBER_B_BY_USERNAME: {}",
e e
)), )),
}); });
@ -132,7 +132,7 @@ impl Synchronizer {
}; };
let ss_get_member_by_username_res = let ss_get_member_by_username_res =
match bpr::ss::member::GetMemberByUsernameResponse::decode( match bpr::ss::member::GetMemberBByUsernameResponse::decode(
ss_get_member_by_username_res_msg.data.as_slice(), ss_get_member_by_username_res_msg.data.as_slice(),
) { ) {
Ok(r) => r, Ok(r) => r,
@ -140,7 +140,7 @@ impl Synchronizer {
return Err(api::core::models::Error { return Err(api::core::models::Error {
code: -1, code: -1,
msg: Some(format!( msg: Some(format!(
"bpr::ss::member::GetMemberByUsernameResponse: {}", "bpr::ss::member::GetMemberBByUsernameResponse: {}",
e e
)), )),
}); });
@ -151,7 +151,7 @@ impl Synchronizer {
return Err(api::core::models::Error { return Err(api::core::models::Error {
code: -1, code: -1,
msg: Some(format!( msg: Some(format!(
"bpr::ss::member::SUBJECT_GET_MEMBER_BY_USERNAME error: {}", "bpr::ss::member::SUBJECT_GET_MEMBER_B_BY_USERNAME error: {}",
e e
)), )),
}); });