fix: 充值投诉仅允许已支付流水(前后端硬拦)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-27 01:12:30 +08:00
parent 332fde50a3
commit 97040c552e
2 changed files with 18 additions and 1 deletions

View File

@@ -156,8 +156,16 @@ def validate_type_refs(leixing, order_id=None, chongzhi_id=None, fadan_id=None,
if not chongzhi_id:
raise GongdanError('充值投诉请填写充值记录ID', 'need_chongzhi_id')
from products.models import Czjilu
if not Czjilu.query.filter(dingdan_id=chongzhi_id).exists():
from products.czjilu_types import CZJILU_PAID_STATUS
cz = Czjilu.query.filter(dingdan_id=chongzhi_id).first()
if not cz:
raise GongdanError('充值记录不存在请核对充值ID', 'chongzhi_not_found')
try:
z = int(cz.zhuangtai) if cz.zhuangtai is not None else None
except (TypeError, ValueError):
z = None
if z != CZJILU_PAID_STATUS:
raise GongdanError('仅已支付的充值单可投诉', 'chongzhi_not_paid')
return None, chongzhi_id, None, None
if leixing == TYPE_PENALTY: