| | |
| | | pass |
| | | |
| | | @classmethod |
| | | def add_async_task(cls, db, method, args): |
| | | def add_async_task(cls, db: int, method, args): |
| | | cls.__async_task_queue.put_nowait((db, method, args)) |
| | | |
| | | @classmethod |
| | |
| | | # 开启购买入口 |
| | | class TradeStateManager: |
| | | __instance = None |
| | | __db = 2 |
| | | redisManager = redis_manager.RedisManager(2) |
| | | |
| | | def __new__(cls, *args, **kwargs): |
| | |
| | | # 开启购买入口 |
| | | def open_buy(self): |
| | | self.__trade_buy_state_cache = True |
| | | RedisUtils.setex_async(self.__get_redis(), "trade_buy_state", tool.get_expire(), 1) |
| | | RedisUtils.setex_async(self.__db, "trade_buy_state", tool.get_expire(), 1) |
| | | |
| | | # 关闭购买入口 |
| | | def close_buy(self): |
| | | self.__trade_buy_state_cache = False |
| | | RedisUtils.setex_async(self.__get_redis(), "trade_buy_state", tool.get_expire(), 0) |
| | | RedisUtils.setex_async(self.__db, "trade_buy_state", tool.get_expire(), 0) |
| | | |
| | | # 是否可以下单 |
| | | @classmethod |