From 045319f511af9f0b58ba7b9f57f5ed7effb95b6d Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期一, 31 七月 2023 14:38:50 +0800 Subject: [PATCH] bug修复 --- code_attribute/code_nature_analyse.py | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-) diff --git a/code_attribute/code_nature_analyse.py b/code_attribute/code_nature_analyse.py index c305e0d..4fca075 100644 --- a/code_attribute/code_nature_analyse.py +++ b/code_attribute/code_nature_analyse.py @@ -15,8 +15,8 @@ class CodeNatureRecordManager: __redisManager = RedisManager(0) - __k_format_cache={} - __nature_cache={} + __k_format_cache = {} + __nature_cache = {} @classmethod def __get_redis(cls): @@ -36,12 +36,15 @@ @classmethod def get_k_format_cache(cls, code): + val = None if code in cls.__k_format_cache: - return cls.__k_format_cache[code] - val = cls.get_k_format(code) - if val: - cls.__k_format_cache[code] = val - return val + val = cls.__k_format_cache[code] + if not val: + val = cls.get_k_format(code) + if val: + cls.__k_format_cache[code] = val + # 澶嶅埗 + return copy.deepcopy(val) if val else None # 淇濆瓨鑲℃�� @classmethod @@ -63,7 +66,6 @@ if val: cls.__nature_cache[code] = val return val - # 璁剧疆鍘嗗彶K绾� @@ -100,7 +102,8 @@ # 鏄惁鍏锋湁K绾垮舰鎬� def is_has_k_format(limit_up_price, record_datas): - is_too_high, is_new_top, is_lowest, is_near_new_top, is_n, is_v, has_format, volume_info,is_special = get_k_format(float(limit_up_price),record_datas) + is_too_high, is_new_top, is_lowest, is_near_new_top, is_n, is_v, has_format, volume_info, is_special = get_k_format( + float(limit_up_price), record_datas) if not has_format: return False, "涓嶆弧瓒矺绾垮舰鎬�" return True, "鏈夊舰鎬�" -- Gitblit v1.8.0