From 3a19a9bd4e301fa7e0d081e9c2aada3ac77700c1 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期二, 26 十二月 2023 18:10:29 +0800
Subject: [PATCH] bug修复

---
 third_data/code_plate_key_manager.py |   70 ++++++++++++++++++++++-------------
 1 files changed, 44 insertions(+), 26 deletions(-)

diff --git a/third_data/code_plate_key_manager.py b/third_data/code_plate_key_manager.py
index 52a82d8..23082eb 100644
--- a/third_data/code_plate_key_manager.py
+++ b/third_data/code_plate_key_manager.py
@@ -9,7 +9,7 @@
 
 import constant
 from db.redis_manager_delegate import RedisUtils
-from third_data import kpl_block_util, kpl_api
+from third_data import kpl_block_util, kpl_api, kpl_util
 from utils import global_util, tool
 from log_module import log, async_log_util
 from db import redis_manager_delegate as redis_manager
@@ -447,7 +447,7 @@
             jingxuan_block_info = self.__KPLCodeJXBlockManager.get_jx_blocks_cache(code, by=True)
         if jingxuan_block_info:
             jingxuan_blocks = jingxuan_block_info[0]
-            k4 |= set(jingxuan_blocks)  #set([x[1] for x in jingxuan_blocks])
+            k4 |= set(jingxuan_blocks)  # set([x[1] for x in jingxuan_blocks])
         for k in [k1, k11, k2, k3, k4]:
             keys |= k
 
@@ -518,13 +518,22 @@
                 if not general_blocks or block not in general_blocks:
                     # 娌″湪娉涘寲鏉垮潡涓�
                     continue
-            if d[4].find("杩炴澘") > 0:
-                if d[4].replace("杩炴澘", "").isdigit():
-                    count = int(d[4].replace("杩炴澘", ""))
-                    if count >= 3:
-                        is_strong_block = True
-                        break
+            count = kpl_util.get_high_level_count(d[4])
+            if count >= 3:
+                if d[4].find("杩炴澘") > 0:
+                    is_strong_block = True
+                    break
+                elif d[0] in yesterday_current_limit_up_codes and len(block_codes) >= 2:
+                    # 鍑犲ぉ鍑犳澘锛屼笖鏈�杩�2杩炴澘
+                    # 鐪嬫槸鍚︽湁棣栨澘鍚庢帓
+                    is_strong_block = True
+                    break
 
+        if not is_strong_block:
+            temp_block_codes = set(copy.deepcopy(block_codes))
+            temp_block_codes.discard(code)
+            if len(temp_block_codes) >= 3:
+                is_strong_block = True
         max_rank = 2
         #  寮哄娍鏉垮潡涔拌�佸洓
         if is_strong_block:
@@ -551,8 +560,10 @@
                                                                                                 code_limit_up_reason_dict,
                                                                                                 yesterday_current_limit_up_codes,
                                                                                                 exclude_first_codes,
-                                                                                                len(current_open_limit_up_codes),
-                                                                                                shsz=True, limit_up_time=first_limit_up_time)
+                                                                                                len(
+                                                                                                    current_open_limit_up_codes),
+                                                                                                shsz=True,
+                                                                                                limit_up_time=first_limit_up_time)
         # record_shsz_rank, record_shsz_rank_codes = kpl_block_util.get_code_record_rank(code, block,
         #                                                                                limit_up_record_datas,
         #                                                                                code_limit_up_reason_dict,
@@ -565,6 +576,11 @@
         if current_shsz_rank < len(current_open_limit_up_codes) + max_rank:
             return True, False, f"銆恵block}銆戝墠鎺掍唬鐮侊細{current_shsz_rank}", is_strong_block
         else:
+            # 鐪嬭嚜鐢辨祦閫氬競鍊兼槸鍚﹀皬浜�20浜�
+            if is_strong_block and current_shsz_rank < len(current_open_limit_up_codes) + max_rank + 1:
+                zyltgb = global_util.zyltgb_map.get(code)
+                if zyltgb and zyltgb < 20 * 100000000:
+                    return True, False, f"銆恵block}銆戝己鍔挎澘鍧� 鑷敱娴侀�氬競鍊�({zyltgb})灏忎簬20浜�", is_strong_block
             return False, False, f"銆恵block}銆戝墠鎺掍唬鐮侊細{front_current_shsz_rank_codes} 瓒呰繃{len(current_open_limit_up_codes) + max_rank}涓�", is_strong_block
 
         # 杩囨椂鐨勪唬鐮�
@@ -752,10 +768,11 @@
     # high_level_general_code_blocks 楂樹綅娉涘寲鏉垮潡
     @classmethod
     def update_can_buy_blocks(cls, code, current_limit_up_datas, limit_up_record_datas,
-                              yesterday_current_limit_up_records,
+                              latest_current_limit_up_records,
                               before_blocks_dict, current_limit_up_block_codes_dict):
         yesterday_current_limit_up_codes = set()
         yesterday_current_limit_up_records_dict = {}
+        yesterday_current_limit_up_records = latest_current_limit_up_records[0][1]
         if yesterday_current_limit_up_records:
             for r in yesterday_current_limit_up_records:
                 yesterday_current_limit_up_codes.add(r[0])
@@ -763,21 +780,22 @@
         high_level_general_code_blocks = {}
         # 鏄惁鏄�3鏉垮強浠ヤ笂鐨勯珮浣嶆澘
         for r in current_limit_up_datas:
-            if r[4].find("杩炴澘") > 0:
-                if r[4].replace("杩炴澘", "").isdigit():
-                    count = int(r[4].replace("杩炴澘", ""))
-                    if count >= 3:
-                        # 鏄珮浣嶆澘
-                        # 褰撴棩绮鹃��
-                        blocks = set(r[6].split("銆�"))
-                        if r[0] in yesterday_current_limit_up_records_dict:
-                            # 鏄ㄦ棩娑ㄥ仠鍘熷洜
-                            blocks.add(yesterday_current_limit_up_records_dict.get(r[0])[5])
-                        f_blocks = []
-                        for b in blocks:
-                            if b:
-                                f_blocks.append(b)
-                        high_level_general_code_blocks[r[0]] = f_blocks
+            count = kpl_util.get_high_level_count(r[4])
+            if count >= 3 and r[0] in yesterday_current_limit_up_codes:
+                latest_datas = latest_current_limit_up_records[:count - 1]
+                # 鏄珮浣嶆澘
+                # 褰撴棩绮鹃��
+                blocks = set(r[6].split("銆�"))
+                for d in latest_datas:
+                    for dd in d[1]:
+                        if dd[0] == r[0]:
+                            blocks.add(dd[5])
+                            break
+                f_blocks = []
+                for b in blocks:
+                    if b:
+                        f_blocks.append(b)
+                high_level_general_code_blocks[r[0]] = f_blocks
 
         can_buy_blocks, unique, msg, can_buy_strong_blocks, keys = cls.__compute_can_buy_blocks(code,
                                                                                                 current_limit_up_datas,

--
Gitblit v1.8.0