From 9ec7d91a46bad23927a84bb6355e8766ecdb9d24 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期四, 17 八月 2023 12:28:58 +0800
Subject: [PATCH] ++++++++++++++++ bug修复

---
 code_attribute/code_data_util.py |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/code_attribute/code_data_util.py b/code_attribute/code_data_util.py
index 6f91029..aeb5b98 100644
--- a/code_attribute/code_data_util.py
+++ b/code_attribute/code_data_util.py
@@ -7,7 +7,8 @@
 import time
 
 from code_attribute import gpcode_manager
-from db import mysql_data, redis_manager
+from db import mysql_data_delegate as mysql_data, redis_manager_delegate as redis_manager
+from db.redis_manager_delegate import RedisUtils
 from utils import tool
 
 _redisManager = redis_manager.RedisManager(0)
@@ -18,7 +19,7 @@
     if code == '600066':
         print('杩涘叆璋冭瘯')
     # 鏄ㄦ棩鏀剁洏浠�
-    price_close = gpcode_manager.get_price_pre(code)
+    price_close = gpcode_manager.CodePrePriceManager.get_price_pre_cache(code)
     max_price = tool.to_price(decimal.Decimal(str(price_close)) * decimal.Decimal("1.1"))
     min_price = tool.to_price(decimal.Decimal(str(price_close)) * decimal.Decimal("0.9"))
     if min_price <= decimal.Decimal(str(price)) <= max_price:
@@ -30,15 +31,13 @@
 class ZYLTGBUtil:
     @classmethod
     def save(cls, code, val, unit):
-        redis = _redisManager.getRedis()
-        redis.setex("zyltgb-{}".format(code), tool.get_expire(),
-                    round(float(val) * 100000000) if int(unit) == 0 else round(
-                        float(val) * 10000))
+        RedisUtils.setex(_redisManager.getRedis(), "zyltgb-{}".format(code), tool.get_expire(),
+                         round(float(val) * 100000000) if int(unit) == 0 else round(
+                             float(val) * 10000))
 
     @classmethod
     def get(cls, code):
-        redis = _redisManager.getRedis()
-        val = redis.get("zyltgb-{}".format(code))
+        val = RedisUtils.get(_redisManager.getRedis(), "zyltgb-{}".format(code))
         if val is not None:
             return int(val)
         return None
@@ -66,7 +65,4 @@
 
 
 if __name__ == "__main__":
-    redis = _redisManager.getRedis()
-    keys = redis.keys("zyltgb-*")
-    for key in keys:
-        redis.delete(key)
+    pass

--
Gitblit v1.8.0