From 97040c552e041ab35e009b9203ca23479463305e Mon Sep 17 00:00:00 2001 From: XingQue Date: Mon, 27 Jul 2026 01:12:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=85=E5=80=BC=E6=8A=95=E8=AF=89?= =?UTF-8?q?=E4=BB=85=E5=85=81=E8=AE=B8=E5=B7=B2=E6=94=AF=E4=BB=98=E6=B5=81?= =?UTF-8?q?=E6=B0=B4=EF=BC=88=E5=89=8D=E5=90=8E=E7=AB=AF=E7=A1=AC=E6=8B=A6?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- gongdan/services.py | 10 +++++++++- gongdan/views.py | 9 +++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gongdan/services.py b/gongdan/services.py index e111ff7..e265c9e 100644 --- a/gongdan/services.py +++ b/gongdan/services.py @@ -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: diff --git a/gongdan/views.py b/gongdan/views.py index a2b1c9d..8014d77 100644 --- a/gongdan/views.py +++ b/gongdan/views.py @@ -330,6 +330,15 @@ class ChongzhiRecordListView(APIView): leixing = request.data.get('leixing') if leixing not in (None, ''): qs = qs.filter(leixing=int(leixing)) + # 投诉选单:仅已支付;普通充值记录页不传此参数则展示全部状态 + only_paid = str( + request.data.get('only_paid') + or request.data.get('for_complaint') + or '' + ).lower() in ('1', 'true', 'yes') + if only_paid: + from products.czjilu_types import CZJILU_PAID_STATUS + qs = qs.filter(zhuangtai=CZJILU_PAID_STATUS) total = qs.count() start = max(page - 1, 0) * page_size type_map = {