feat: 押金充值接入资金冻结池,接单按在押总额校验
This commit is contained in:
1 parent
6c22a0b77e
commit
fb2cfbcfc9
13 files changed
+619
-388
No files matched your search
@@ -99,7 +99,10 @@ def resolve_fake_pool_mode(user, club_id=None, leixing_id=None):
|
||||
return MODE_REAL_ONLY
|
||||
|
||||
try:
|
||||
yajin = Decimal(str(getattr(dashou, 'yajin', 0) or 0))
|
||||
from jituan.services.fund_freeze import get_effective_yajin
|
||||
yajin = get_effective_yajin(
|
||||
dashou, user_id=str(getattr(user, 'UserUID', '') or ''),
|
||||
)
|
||||
except Exception:
|
||||
yajin = Decimal('0')
|
||||
if yajin >= get_fake_yajin_hide_threshold(cid):
|
||||
|
||||
@@ -569,8 +569,10 @@ def join_recruit(*, recruit_id: int, user_uid: str, game_id: str, request=None,
|
||||
if not user_has_huiyuan_access_any(user_uid, required_ids, club_id=rec.club_id):
|
||||
raise ValueError('未开通对应会员或会员已过期')
|
||||
elif order.GrabRequirement == 2:
|
||||
from jituan.services.fund_freeze import get_effective_yajin
|
||||
|
||||
yajin_required = order.CommissionReq or 0
|
||||
if (profile.yajin or 0) < yajin_required:
|
||||
if get_effective_yajin(profile) < yajin_required:
|
||||
raise ValueError(f'押金不足,需要{yajin_required}元')
|
||||
|
||||
now = timezone.now()
|
||||
|
||||
@@ -426,6 +426,8 @@ class AdGengHuanDaShou(APIView):
|
||||
)
|
||||
|
||||
elif yaoqiuleixing == 2: # 押金抢单
|
||||
from jituan.services.fund_freeze import get_effective_yajin
|
||||
|
||||
# 获取订单的押金(yongjin字段)
|
||||
order_yajin = dingdan_obj.CommissionReq
|
||||
if order_yajin is None:
|
||||
@@ -434,8 +436,8 @@ class AdGengHuanDaShou(APIView):
|
||||
status=status.HTTP_400_BAD_REQUEST
|
||||
)
|
||||
|
||||
# 验证打手押金是否大于等于订单押金
|
||||
if new_dashou_profile.yajin < order_yajin:
|
||||
# 验证打手押金是否大于等于订单押金(含押金冻结池)
|
||||
if get_effective_yajin(new_dashou_profile) < order_yajin:
|
||||
return Response(
|
||||
{'code': 400, 'message': '打手押金不足', 'data': None},
|
||||
status=status.HTTP_400_BAD_REQUEST
|
||||
|
||||
@@ -679,14 +679,15 @@ class QiangdanView(APIView):
|
||||
}
|
||||
|
||||
def _validate_yajin_requirement(self, order, dashou_profile):
|
||||
from jituan.services.fund_freeze import get_effective_yajin
|
||||
|
||||
yajin_required = order.CommissionReq or 0
|
||||
dashou_yajin = dashou_profile.yajin or 0
|
||||
try:
|
||||
need = float(yajin_required)
|
||||
except (TypeError, ValueError):
|
||||
need = 0.0
|
||||
try:
|
||||
have = float(dashou_yajin)
|
||||
have = float(get_effective_yajin(dashou_profile))
|
||||
except (TypeError, ValueError):
|
||||
have = 0.0
|
||||
if have < need:
|
||||
|
||||
Reference in new issue
Block a user