Преглед изворни кода

htx 查单不存在直接移除

JiahengHe пре 1 година
родитељ
комит
46760ff3f3
1 измењених фајлова са 11 додато и 3 уклоњено
  1. 11 3
      standard/src/htx_swap.rs

+ 11 - 3
standard/src/htx_swap.rs

@@ -500,7 +500,7 @@ impl Platform for HtxSwap {
                     }
                     Err(error) => {
                         // 已经取消的订单不去撤单了
-                        if !error.to_string().contains("Your order has been canceled") {
+                        if !error.to_string().contains("Your order has been canceled"){
                             // 取消失败去查订单。
                             let query_rst = self_clone.get_order_detail(&order_id, &custom_id).await;
                             match query_rst {
@@ -508,10 +508,18 @@ impl Platform for HtxSwap {
                                     self_clone.order_sender.send(order).await.unwrap();
                                 }
                                 Err(err) => {
-                                    error!("撤单失败,而且查单也失败了,htx_swap,oid={}, cid={}, err={:?}。", order_id.clone(), custom_id.clone(), err);
+                                    // 不存在的订单直接移除
+                                    if !err.to_string().contains("Order doesnt exist") {
+                                        self_clone.error_sender.send(error).await.unwrap();
+                                        error!("撤单失败,而且查单也失败了,htx_swap,oid={}, cid={}, err={:?}。", order_id.clone(), custom_id.clone(), err);
+                                    }
+                                    let mut err_order = Order::new();
+                                    err_order.custom_id = custom_id.clone();
+                                    err_order.status = "REMOVE".to_string();
+
+                                    self_clone.order_sender.send(err_order).await.unwrap();
                                 }
                             }
-                            self_clone.error_sender.send(error).await.unwrap();
                         }
                     }
                 }