From 2b01412bb139aefe3b4e6be1ca02115d24dbeabb Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期一, 11 九月 2023 13:56:52 +0800
Subject: [PATCH] bug修复

---
 utils/data_export_util.py |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/utils/data_export_util.py b/utils/data_export_util.py
index d7f8d62..2804cec 100644
--- a/utils/data_export_util.py
+++ b/utils/data_export_util.py
@@ -2,6 +2,7 @@
 鏁版嵁瀵煎嚭宸ュ叿
 """
 import json
+import logging
 import os
 import time
 
@@ -136,7 +137,7 @@
             else:
                 ws.write(index, 6, '鍗栨挙', style)
         ws.write(index, 7, data["re"], style)
-        ws.write(index, 9, data.get("orderNo"), style)
+        ws.write(index, 9, data["val"].get("orderNo"), style)
         # 鏌ヨ鏄惁鎾ゅ崟
         if int(data["val"]["operateType"]) == 0:
             cancel = False
@@ -147,8 +148,11 @@
                                                                                                      num_operate_map[
                                                                                                          code])
                     if buy_index == data["index"]:
-                        ws.write(index, 8, "{}-{}".format(d["index"], d["val"]["time"]), cancel_style)
-                        break
+                        try:
+                            ws.write(index, 8, "{}-{}".format(d["index"], d["val"]["time"]), cancel_style)
+                            break
+                        except Exception as e:
+                            logging.exception(e)
 
         ws.write(index, 3, "{}涓�".format(round(int(data["val"]["num"]) * float(data["val"]["price"]) / 100, 2)), style)
     wb.save(file_name)
@@ -206,4 +210,4 @@
 
 
 if __name__ == "__main__":
-    export_l2_excel("002178")
+    export_l2_excel("002207")

--
Gitblit v1.8.0