feat: 角色协议(勾选+阅读秒数+卡点)与冻结说明按身份返回
新增协议表/签署留痕、后台与小程序 API;去掉手写依赖;支持抢单/注册/提现等卡点配置。冻结问号文案按角色字典下发。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -66,6 +66,33 @@ def _profile_withdrawable(user, attr: str, field: str = 'yue') -> str:
|
||||
return '0.00'
|
||||
|
||||
|
||||
def _default_freeze_reason() -> str:
|
||||
return (
|
||||
'部分佣金暂存为冻结保障金,用于订单售后与纠纷保障;'
|
||||
'按俱乐部规则到期或达标后自动转入可提现余额,冻结中金额不可提现。'
|
||||
)
|
||||
|
||||
|
||||
def _freeze_display_reasons(club_id: str) -> Dict[str, str]:
|
||||
"""按角色返回冻结说明;无配置时用统一默认文案。"""
|
||||
default = _default_freeze_reason()
|
||||
out = {
|
||||
ROLE_DASHOU: default,
|
||||
ROLE_GUANSHI: default,
|
||||
ROLE_ZUZHANG: default,
|
||||
ROLE_SHENHEGUAN: default,
|
||||
}
|
||||
if not club_id:
|
||||
return out
|
||||
try:
|
||||
for row in ClubFundFreezeConfig.query.filter(club_id=club_id):
|
||||
if row.role in out and (row.remark or '').strip():
|
||||
out[row.role] = row.remark.strip()
|
||||
except Exception:
|
||||
pass
|
||||
return out
|
||||
|
||||
|
||||
class FundFreezeMineView(APIView):
|
||||
"""
|
||||
POST /yonghu/fund-freeze-mine
|
||||
@@ -110,17 +137,8 @@ class FundFreezeMineView(APIView):
|
||||
total_dongjie = sum((Decimal(r['dongjie_yue']) for r in roles), Decimal('0.00'))
|
||||
total_withdrawable = sum((Decimal(r['withdrawable']) for r in roles), Decimal('0.00'))
|
||||
|
||||
# 用户可见说明:优先打手规则,否则取任意已配置角色
|
||||
display_reason = ''
|
||||
if club_id:
|
||||
cfgs = list(ClubFundFreezeConfig.query.filter(club_id=club_id, enabled=True))
|
||||
prefer = next((c for c in cfgs if c.role == ROLE_DASHOU), None) or (cfgs[0] if cfgs else None)
|
||||
if prefer and prefer.remark:
|
||||
display_reason = prefer.remark
|
||||
if not display_reason:
|
||||
any_cfg = ClubFundFreezeConfig.query.filter(club_id=club_id).exclude(remark='').first()
|
||||
if any_cfg:
|
||||
display_reason = any_cfg.remark or ''
|
||||
reasons = _freeze_display_reasons(club_id)
|
||||
display_reason = reasons.get(ROLE_DASHOU) or _default_freeze_reason()
|
||||
|
||||
return Response({
|
||||
'code': 200,
|
||||
@@ -132,10 +150,8 @@ class FundFreezeMineView(APIView):
|
||||
'total_dongjie': _money(total_dongjie),
|
||||
'total_withdrawable': _money(total_withdrawable),
|
||||
'has_freeze': total_dongjie > 0,
|
||||
'display_reason': display_reason or (
|
||||
'部分佣金暂存为冻结保障金,用于订单售后与纠纷保障;'
|
||||
'按俱乐部规则到期或达标后自动转入可提现余额,冻结中金额不可提现。'
|
||||
),
|
||||
'display_reason': display_reason,
|
||||
'freeze_display_reasons': reasons,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user