feat: 资金冻结 P1 打手结单收口网关 + 到期解冻定时任务骨架
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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': '打手不存在或扩展表缺失'})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user