|
@@ -344,11 +344,25 @@ impl Platform for CoinexSwap {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if res_data.code == 200 {
|
|
if res_data.code == 200 {
|
|
|
- let res_data_json: Value = res_data.data;
|
|
|
|
|
- let mut result = format_order_item(res_data_json, ct_val, status);
|
|
|
|
|
- result.custom_id = custom_id.to_string();
|
|
|
|
|
- result.id = order_id.to_string();
|
|
|
|
|
- Ok(result)
|
|
|
|
|
|
|
+ let res_data_json = res_data.data.as_array().unwrap();
|
|
|
|
|
+ if res_data_json.len() == 0 { // 已取消或已成交
|
|
|
|
|
+ return Ok(Order{
|
|
|
|
|
+ id: order_id.to_string(),
|
|
|
|
|
+ custom_id: custom_id.to_string(),
|
|
|
|
|
+ price: Default::default(),
|
|
|
|
|
+ amount: Default::default(),
|
|
|
|
|
+ deal_amount: Default::default(),
|
|
|
|
|
+ avg_price: Default::default(),
|
|
|
|
|
+ status: "REMOVE".to_string(),
|
|
|
|
|
+ order_type: "".to_string(),
|
|
|
|
|
+ trace_stack: TraceStack::new(0, Instant::now()).on_special("358 coinex_swap".to_string()),
|
|
|
|
|
+ })
|
|
|
|
|
+ } else { // 待成交
|
|
|
|
|
+ let mut result = format_order_item(res_data_json[0].clone(), ct_val, status);
|
|
|
|
|
+ result.custom_id = custom_id.to_string();
|
|
|
|
|
+ result.id = order_id.to_string();
|
|
|
|
|
+ Ok(result)
|
|
|
|
|
+ }
|
|
|
} else if res_data.code == -1 && res_data.message.contains("3103:order not exists") { // 未成交已取消的订单会报不存在
|
|
} else if res_data.code == -1 && res_data.message.contains("3103:order not exists") { // 未成交已取消的订单会报不存在
|
|
|
let mut order = Order::new();
|
|
let mut order = Order::new();
|
|
|
order.id = order_id.to_string();
|
|
order.id = order_id.to_string();
|
|
@@ -487,7 +501,7 @@ impl Platform for CoinexSwap {
|
|
|
avg_price: Default::default(),
|
|
avg_price: Default::default(),
|
|
|
status: "NULL".to_string(),
|
|
status: "NULL".to_string(),
|
|
|
order_type: "".to_string(),
|
|
order_type: "".to_string(),
|
|
|
- trace_stack: TraceStack::new(0, Instant::now()).on_special("485 coinex_swap".to_string()),
|
|
|
|
|
|
|
+ trace_stack: TraceStack::new(0, Instant::now()).on_special("485 coinex_swap".to_string())
|
|
|
};
|
|
};
|
|
|
} else {
|
|
} else {
|
|
|
result = format_order_item(res_data_json, ct_val, "canceled");
|
|
result = format_order_item(res_data_json, ct_val, "canceled");
|