修复了客服日统计时机,展示更加全面的数据

This commit is contained in:
XingQue
2026-06-20 04:23:31 +08:00
parent 993c0c54b0
commit c70b2ee7be
10 changed files with 83 additions and 48 deletions

View File

@@ -198,7 +198,7 @@ def update_dashou_daily_by_action(yonghuid, amount, action):
PlayerDailyStats.query.filter(id=stat.id).update(**update_fields)
def update_shangjia_daily(yonghuid, amount, action):
def update_shangjia_daily(yonghuid, amount, action, order_id=None):
"""
根据操作行为更新商家每日统计(派发、结算、退款)
@@ -206,6 +206,7 @@ def update_shangjia_daily(yonghuid, amount, action):
yonghuid: 商家用户ID
amount: 当前订单涉及的金额Decimal
action: 操作类型1 = 派发2 = 结算成交3 = 退款
order_id: 订单ID传入时同步更新该订单派单归属客服的日统计
说明:
- 金额必须大于0否则不执行任何操作
@@ -253,6 +254,12 @@ def update_shangjia_daily(yonghuid, amount, action):
# 执行原子更新
MerchantDailyStats.query.filter(id=stat.id).update(**update_fields)
if order_id:
try:
from merchant_ops.services.stats import sync_staff_stats_by_order_id
sync_staff_stats_by_order_id(order_id, amount, action)
except Exception:
logger.warning('同步客服日统计失败 order_id=%s', order_id, exc_info=True)
def update_guanshi_daily_by_action(yonghuid, action, amount=Decimal('0.00')):