fix: 成交指标始终记账并回填;抢单建聊移出事务并重试

抢单池刷新触发历史回填,旧单也能出成交率/罚款率/均时;建聊失败重试并订阅组队成员,避免消息列表空白。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-27 08:46:22 +08:00
parent 5e38a3d49a
commit e3f9654002
4 changed files with 143 additions and 25 deletions

View File

@@ -507,8 +507,15 @@ class QiangdanView(APIView):
return Response({'code': 400, 'msg': validation_result['message']})
self._execute_qiangdan(order, dashou_profile, request.user.UserUID)
# ========== 【唯一改动】聊天建立方式 ==========
# 建聊必须在事务提交后GoEasy HTTP 不可放在行锁事务里,失败也不回滚抢单
chat_success = False
try:
chat_success = establish_order_chat(dingdan_id)
if not chat_success:
# 再试一次,避免偶发订阅/发消息失败导致消息列表空白
chat_success = establish_order_chat(dingdan_id)
except Exception as e:
logger.error(f"抢单后建立聊天失败 dingdan={dingdan_id}: {e}", exc_info=True)
try:
update_dashou_daily_by_action(