From b6fddc2f32b5cde1181e6b9de2a3a952ea45a12b Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期一, 16 十月 2023 17:47:58 +0800
Subject: [PATCH] 影子订单不参与处理
---
code_attribute/code_data_util.py | 30 +++++++++++++++++-------------
1 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/code_attribute/code_data_util.py b/code_attribute/code_data_util.py
index 1378431..8a6bd99 100644
--- a/code_attribute/code_data_util.py
+++ b/code_attribute/code_data_util.py
@@ -7,10 +7,11 @@
import time
from code_attribute import gpcode_manager
-from db import mysql_data, redis_manager
-from db.redis_manager import RedisUtils
+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
+__db = 0
_redisManager = redis_manager.RedisManager(0)
@@ -19,7 +20,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:
@@ -29,17 +30,23 @@
# 鑷敱娴侀�氳偂鏈伐鍏风被
class ZYLTGBUtil:
+ __db = 0
+
@classmethod
def save(cls, code, val, unit):
- redis = _redisManager.getRedis()
- RedisUtils.setex(redis,"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 save_async(cls, code, val, unit):
+ RedisUtils.setex_async(cls.__db, "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 = RedisUtils.get(redis, "zyltgb-{}".format(code))
+ val = RedisUtils.get(_redisManager.getRedis(), "zyltgb-{}".format(code))
if val is not None:
return int(val)
return None
@@ -67,7 +74,4 @@
if __name__ == "__main__":
- redis = _redisManager.getRedis()
- keys = RedisUtils.keys(redis, "zyltgb-*")
- for key in keys:
- RedisUtils.delete(redis, key)
+ pass
--
Gitblit v1.8.0