bug fixed
This commit is contained in:
parent
ad97b8b550
commit
4b3ad14674
|
@ -30,7 +30,7 @@ impl Composition {
|
|||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
member_id: uuid::Uuid,
|
||||
) -> Result<Option<models::MemberModel>, bcr::error::rpc::Error> {
|
||||
) -> Result<Option<models::Member>, bcr::error::rpc::Error> {
|
||||
let m = match self
|
||||
.member_repository
|
||||
.select_by_member_id(conn, member_id)
|
||||
|
@ -96,6 +96,98 @@ impl Composition {
|
|||
}));
|
||||
}
|
||||
|
||||
let mm = match ss_get_member_res.result {
|
||||
Some(r) => match r.member {
|
||||
Some(_m) => Some(models::Member {
|
||||
id: m.id,
|
||||
balance: m.balance,
|
||||
balance_bota: m.balance_bota,
|
||||
balance_sum: m.balance_sum,
|
||||
companies: m.companies,
|
||||
oriental_play: m.oriental_play,
|
||||
member: _m,
|
||||
created_at: m.created_at,
|
||||
updated_at: m.updated_at,
|
||||
}),
|
||||
None => None,
|
||||
},
|
||||
None => None,
|
||||
};
|
||||
|
||||
Ok(mm)
|
||||
}
|
||||
|
||||
///
|
||||
pub async fn select_b_by_member_id(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
member_id: uuid::Uuid,
|
||||
) -> Result<Option<models::MemberModel>, bcr::error::rpc::Error> {
|
||||
let m = match self
|
||||
.member_repository
|
||||
.select_by_member_id(conn, member_id)
|
||||
.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,
|
||||
})
|
||||
})? {
|
||||
Some(m) => m,
|
||||
None => {
|
||||
return Ok(None);
|
||||
}
|
||||
};
|
||||
|
||||
let ss_get_member_req = bpr::ss::member::GetMemberRequest {
|
||||
client: Some(bpr::models::core::network::Client {
|
||||
client_ip: self
|
||||
.connection_broker
|
||||
.client_ip()
|
||||
.unwrap_or(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)))
|
||||
.to_string(),
|
||||
site_url: None,
|
||||
access_token: None,
|
||||
}),
|
||||
request: Some(bpr::ss::member::get_member_request::Request {
|
||||
id: m.member_id.to_string(),
|
||||
}),
|
||||
};
|
||||
|
||||
let ss_get_member_res_msg = self
|
||||
.connection_broker
|
||||
.request(
|
||||
bpr::ss::member::SUBJECT_GET_MEMBER,
|
||||
ss_get_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_get_member_res = bpr::ss::member::GetMemberResponse::decode(
|
||||
ss_get_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_get_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,
|
||||
}));
|
||||
}
|
||||
|
||||
let mm = match ss_get_member_res.result {
|
||||
Some(r) => match r.member {
|
||||
Some(_m) => Some(models::MemberModel {
|
||||
|
|
|
@ -2,7 +2,7 @@ use beteran_protobuf_rust as bpr;
|
|||
|
||||
///
|
||||
#[derive(PartialEq, Debug, Clone)]
|
||||
pub struct MemberModel {
|
||||
pub struct Member {
|
||||
///
|
||||
pub id: i64,
|
||||
///
|
||||
|
@ -22,3 +22,26 @@ pub struct MemberModel {
|
|||
///
|
||||
pub updated_at: i64,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(PartialEq, Debug, Clone)]
|
||||
pub struct MemberModel {
|
||||
///
|
||||
pub id: i64,
|
||||
///
|
||||
pub balance: f64,
|
||||
///
|
||||
pub balance_bota: f64,
|
||||
///
|
||||
pub balance_sum: f64,
|
||||
///
|
||||
pub companies: Option<String>,
|
||||
///
|
||||
pub oriental_play: String,
|
||||
///
|
||||
pub member: bpr::models::member::MemberModel,
|
||||
///
|
||||
pub created_at: i64,
|
||||
///
|
||||
pub updated_at: i64,
|
||||
}
|
||||
|
|
|
@ -279,7 +279,7 @@ impl Service {
|
|||
|
||||
let result = match self
|
||||
.member_composition
|
||||
.select_by_member_id(&conn, member_id)
|
||||
.select_b_by_member_id(&conn, member_id)
|
||||
.await?
|
||||
{
|
||||
Some(m) => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user