feat: 资金冻结 P1 打手结单收口网关 + 到期解冻定时任务骨架

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-26 18:49:44 +08:00
parent d40a27a5ca
commit 6a1895e566
9 changed files with 352 additions and 98 deletions

View File

@@ -1020,13 +1020,13 @@ class KefuRejectRefundView(APIView):
try:
dashou_user = User.query.get(UserUID=jiedan_dashou_id)
dashou_profile = dashou_user.DashouProfile
# 增加打手相关统计数据
dashou_profile.chengjiaozongliang += 1
dashou_profile.yue += dashou_fencheng
dashou_profile.zonge += dashou_fencheng
dashou_profile.jinrishouyi += dashou_fencheng
dashou_profile.jinyueshouyi += dashou_fencheng
dashou_profile.save()
from jituan.services.fund_freeze import credit_dashou_order_settle
credit_dashou_order_settle(
order=order,
dashou_profile=dashou_profile,
user_id=jiedan_dashou_id,
amount=dashou_fencheng,
)
logger.info(f"拒绝退款:打手 {jiedan_dashou_id} 获得分成 {dashou_fencheng}")
except (User.DoesNotExist, AttributeError):
logger.warning(f"拒绝退款:打手 {jiedan_dashou_id} 不存在或扩展表缺失,跳过结算")
@@ -1739,16 +1739,13 @@ class KefuForceCompleteView(APIView):
try:
dashou_user = User.query.get(UserUID=dashou_id)
dashou_profile = dashou_user.DashouProfile
# 原子更新(避免并发重复加)
dashou_profile.chengjiaozongliang = F('chengjiaozongliang') + 1
dashou_profile.yue = F('yue') + dashou_fencheng
dashou_profile.zonge = F('zonge') + dashou_fencheng
dashou_profile.jinrishouyi = F('jinrishouyi') + dashou_fencheng
dashou_profile.jinyueshouyi = F('jinyueshouyi') + dashou_fencheng
dashou_profile.save(update_fields=[
'chengjiaozongliang', 'yue', 'zonge',
'jinrishouyi', 'jinyueshouyi'
])
from jituan.services.fund_freeze import credit_dashou_order_settle
credit_dashou_order_settle(
order=order,
dashou_profile=dashou_profile,
user_id=dashou_id,
amount=dashou_fencheng,
)
except (User.DoesNotExist, AttributeError):
return Response({'code': 400, 'msg': '打手不存在或扩展表缺失'})