mirror of
https://git.oceanpay.cc/danial/kami_itunes_third_api.git
synced 2025-12-18 22:20:08 +00:00
fix: 修复日限额问题
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
FROM python:3.11-slim
|
||||
FROM python:3.12-slim
|
||||
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
|
||||
@@ -169,6 +169,8 @@ def run_redeem_task(
|
||||
account_amount=redeem_result.balance,
|
||||
),
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(f"出现错误:{e}")
|
||||
finally:
|
||||
redis_client.decrby(f"apple_account_{master_order.account}_count", 1)
|
||||
queue.get()
|
||||
@@ -185,7 +187,6 @@ def run_task():
|
||||
"""
|
||||
# 注册信号处理程序
|
||||
has_been_console = False
|
||||
|
||||
while True:
|
||||
master_node_service = MasterNodeService()
|
||||
master_order = master_node_service.query_order()
|
||||
@@ -194,26 +195,15 @@ def run_task():
|
||||
run_redeem_task(master_order, master_node_service, fifo_queue)
|
||||
|
||||
# 10分钟打印一次信息
|
||||
if datetime.now().minute % 10 == 0 and not has_been_console:
|
||||
if datetime.now().minute % 5 == 0 and not has_been_console:
|
||||
has_been_console = True
|
||||
print(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\t暂时没有订单")
|
||||
if datetime.now().minute % 10 == 1 and has_been_console:
|
||||
if datetime.now().minute % 5 == 1 and has_been_console:
|
||||
has_been_console = False
|
||||
time.sleep(2)
|
||||
|
||||
|
||||
def run():
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
signal.signal(signal.SIGTERM, signal_handler)
|
||||
# signal.signal(signal.SIGINT, signal_handler)
|
||||
# signal.signal(signal.SIGTERM, signal_handler)
|
||||
run_task()
|
||||
# # 定义一个进程池
|
||||
# proc = Process(target=run_task, daemon=True)
|
||||
# # 启动进程池
|
||||
# proc.start()
|
||||
#
|
||||
# while True:
|
||||
# # print(f"主进程执行:{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
||||
# time.sleep(1)
|
||||
# if not proc.is_alive():
|
||||
# proc = Process(target=run_task, daemon=True)
|
||||
# proc.start()
|
||||
|
||||
@@ -5,7 +5,6 @@ from src.initialization import setting
|
||||
engine = create_engine(
|
||||
f"mysql+pymysql://{setting.database.user}:{setting.database.password}@{setting.database.host}:{setting.database.port}/{setting.database.database}",
|
||||
pool_size=100,
|
||||
pool_recycle=3600,
|
||||
echo_pool=True,
|
||||
echo=True,
|
||||
)
|
||||
|
||||
@@ -231,10 +231,16 @@ class AppleClient:
|
||||
result.errorMessageKey
|
||||
== "MZCommerce.GiftCertificateAlreadyRedeemed"
|
||||
):
|
||||
# 已经被兑换
|
||||
result.status = 12
|
||||
elif result.errorMessageKey == "MZFreeProductCode.NoSuch":
|
||||
# 没有这个卡密
|
||||
result.status = 11
|
||||
elif result.errorMessageKey == "MZCommerce.NatIdYearlyCapExceededException":
|
||||
# 年限额
|
||||
result.status = 31
|
||||
elif result.errorMessageKey == "MZCommerce.NatIdDailyCapExceededException":
|
||||
# 日限额
|
||||
result.status = 31
|
||||
else:
|
||||
logger.error(f"失败状态未知:{response.json()}")
|
||||
|
||||
Reference in New Issue
Block a user