From b6b59a5db39e042d0d173604497ebfa34be47d72 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期三, 11 十月 2023 16:11:45 +0800
Subject: [PATCH] bug修复

---
 third_data/kpl_block_util.py |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/third_data/kpl_block_util.py b/third_data/kpl_block_util.py
index debb990..673b534 100644
--- a/third_data/kpl_block_util.py
+++ b/third_data/kpl_block_util.py
@@ -124,11 +124,15 @@
 
 # 鑾峰彇褰撴棩鍘嗗彶韬綅
 # shsz:鏄惁涓绘澘
-def get_code_record_rank(code, block, limit_up_record_datas, code_limit_up_reason_dict, shsz=True):
+def get_code_record_rank(code, block, limit_up_record_datas, code_limit_up_reason_dict,
+                         yesterday_current_limit_up_codes, shsz=True):
     block_codes_infos = []
     limit_up_time = time.time()
     for k in limit_up_record_datas:
         if shsz and k[3].find("00") != 0 and k[3].find("60") != 0:
+            continue
+        # 鍓旈櫎楂樹綅鏉�
+        if k[3] in yesterday_current_limit_up_codes:
             continue
         if code_limit_up_reason_dict.get(k[3]) == block:
             if k[3] != code:
@@ -137,19 +141,26 @@
                 limit_up_time = int(k[5])
     block_codes_infos.append((code, limit_up_time))
     block_codes_infos.sort(key=lambda x: x[1])
+    front_codes = []
     for i in range(0, len(block_codes_infos)):
         if block_codes_infos[i][0] == code:
-            return i
-    return 0
+            return i, front_codes
+        else:
+            front_codes.append(block_codes_infos[i][0])
+    return 0,[]
 
 
 # 鑾峰彇褰撴棩瀹炴椂韬綅
 # before_blocks_dict鏍煎紡浣峽"浠g爜":set("鏉垮潡")}
-def get_code_current_rank(code, block, current_limit_up_datas, code_limit_up_reason_dict, shsz=False):
+def get_code_current_rank(code, block, current_limit_up_datas, code_limit_up_reason_dict,
+                          yesterday_current_limit_up_codes, shsz=False):
     block_codes_infos = []
     limit_up_time = time.time()
     for k in current_limit_up_datas:
         if shsz and k[0].find("00") != 0 and k[0].find("60") != 0:
+            continue
+        # 鍓旈櫎楂樹綅鏉�
+        if k[0] in yesterday_current_limit_up_codes:
             continue
         if code_limit_up_reason_dict.get(k[0]) == block:
             if k[0] != code:
@@ -159,10 +170,13 @@
                 limit_up_time = int(k[2])
     block_codes_infos.append((code, limit_up_time))
     block_codes_infos.sort(key=lambda x: x[1])
+    front_codes = []
     for i in range(0, len(block_codes_infos)):
         if block_codes_infos[i][0] == code:
-            return i
-    return 0
+            return i, front_codes
+        else:
+            front_codes.append(block_codes_infos[i][0])
+    return 0,[]
 
 
 if __name__ == "__main__":

--
Gitblit v1.8.0