优化一下自动提现接口就是user/tixian_shenhe_servers.py,tixian_shenhe_views.py,让文件以及对应的申请,回调,确认接口,让它更好用一点,允许用户多次提现审核,强化收款接口,及时更新数据库中的收款状态,其次,更新了客服提现审核接口,关于大于200元的提现,同意之后直接按驳回处理,微信官方不支持大于200元的提现申请去掉了订单24小时或48小时自动结算的定时任务,将订单广播通知的任务,名称改成和新代码一样

This commit is contained in:
XingQue
2026-06-15 22:24:32 +08:00
parent 653e127493
commit e8795ca9f2
7 changed files with 277 additions and 114 deletions

View File

@@ -56,36 +56,29 @@ def handle_order_status_8(sender, instance, **kwargs):
# 状态从 非8 变为 8
if old != 8 and instance.zhuangtai == 8:
#logger.info(f"📅 订单 {instance.dingdan_id} 状态变为8提交定时任务")
# 设置时间标记
# 订单自动结算已关闭:仅记录时间标记,不再提交 Celery 延时结算任务
instance.status_8_time = timezone.now()
instance.pending_dispatch = True
# 使用配置中的超时时间
expire_seconds = getattr(settings, 'ORDER_EXPIRE_SECONDS', 48 * 60 * 60)
# 提交Celery任务
try:
from orders.tasks import process_expired_order
task_result = process_expired_order.apply_async(
args=[instance.dingdan_id],
countdown=expire_seconds,
queue='order_tasks',
priority=9
)
#logger.info(f"✅ 任务提交成功,订单: {instance.dingdan_id}, 任务ID: {task_result.id}")
# 保存任务信息
instance.auto_task_id = task_result.id
instance.auto_expire_at = timezone.now() + timezone.timedelta(seconds=expire_seconds)
except Exception as e:
logger.error(f"❌ 任务提交失败: {e}")
instance.pending_dispatch = True
instance.auto_task_id = f"failed_{timezone.now().timestamp()}"
instance.pending_dispatch = False
instance.auto_task_id = ''
instance.auto_expire_at = None
logger.info(f"订单 {instance.dingdan_id} 状态变为8自动结算已禁用不提交结算任务")
# --- 原自动结算逻辑(已禁用,保留代码备查)---
# expire_seconds = getattr(settings, 'ORDER_EXPIRE_SECONDS', 48 * 60 * 60)
# try:
# from orders.tasks import process_expired_order
# task_result = process_expired_order.apply_async(
# args=[instance.dingdan_id],
# countdown=expire_seconds,
# queue='order_tasks',
# priority=9
# )
# instance.auto_task_id = task_result.id
# instance.auto_expire_at = timezone.now() + timezone.timedelta(seconds=expire_seconds)
# except Exception as e:
# logger.error(f"❌ 任务提交失败: {e}")
# instance.pending_dispatch = True
# instance.auto_task_id = f"failed_{timezone.now().timestamp()}"
# 状态从 8 变为 非8
elif old == 8 and instance.zhuangtai != 8:

View File

@@ -26,7 +26,12 @@ logger = logging.getLogger(__name__)
def process_expired_order(self, dingdan_id):
"""
处理单个超时订单(订单状态=8超过48小时未处理
【已禁用】保留任务定义避免 Celery 注册/引用报错,实际不执行结算逻辑
"""
logger.info(f"订单{dingdan_id}自动结算任务已禁用,跳过执行")
return f"订单{dingdan_id}自动结算已禁用,跳过"
# --- 以下原结算逻辑保留备查 ---
try:
# 使用select_for_update锁定记录防止并发修改
with transaction.atomic():
@@ -134,9 +139,12 @@ def process_expired_order(self, dingdan_id):
def check_order_expire_task():
"""
批量检查超时订单(补偿机制)
每5分钟执行一次作为信号处理的备用方案
查找状态为8且创建时间超过72小时的订单宽松时间防止误处理
【已禁用】保留任务定义避免 Beat/Worker 引用报错,实际不执行
"""
logger.info("订单自动结算补偿检查已禁用,跳过")
return {"success": True, "message": "自动结算已禁用", "count": 0}
# --- 以下原补偿逻辑保留备查 ---
try:
# 计算更宽松的时间点当前时间减去72小时48+24小时
# 这样避免误处理刚变为状态8的订单