fix: 管事/组长分红入账接入资金冻结网关(会员/商家单/押金)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-29 00:50:13 +08:00
parent 0ebe5b4872
commit 8e7481e25d
6 changed files with 173 additions and 34 deletions

View File

@@ -5,6 +5,7 @@ import logging
from decimal import Decimal
from django.db import transaction
from django.db.models import F
from backend.utils import update_guanshi_daily_by_action
from jituan.constants import CLUB_ID_DEFAULT
@@ -152,9 +153,20 @@ def _apply_yajin_fenhong(order, dashou, amount):
if fenhong_jine <= 0:
return
guanshi = UserGuanshi.objects.select_for_update().get(user__UserUID=guanshi_id)
guanshi.yue += fenhong_jine
guanshi.chongzhifenrun += fenhong_jine
guanshi.save(update_fields=['yue', 'chongzhifenrun'])
from jituan.services.fund_freeze import credit_guanshi_fenhong
dingdan_id = str(order.dingdan_id or '')
result = credit_guanshi_fenhong(
user_id=str(guanshi_id),
amount=fenhong_jine,
biz_id=f'{dingdan_id}:guanshi:yajin',
profile=guanshi,
czjilu_id=dingdan_id,
freeze_reason=f'押金分红 {dingdan_id}',
)
if not result.get('idempotent'):
UserGuanshi.objects.filter(pk=guanshi.pk).update(
chongzhifenrun=F('chongzhifenrun') + fenhong_jine,
)
user_main = dashou.user
Gsfenhong.query.create(
dingdan_id=order.dingdan_id,