From 921941a36d8efbc98293db3484f44430b5549937 Mon Sep 17 00:00:00 2001 From: XingQue Date: Fri, 10 Jul 2026 21:53:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=97=A0=20package=20=E7=9A=84=E6=89=93?= =?UTF-8?q?=E6=AC=BE=E5=8D=95=E4=B8=8D=E5=86=8D=E9=95=BF=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=94=B6=E6=AC=BE=E5=A4=84=E7=90=86=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 微信查单 not_found/失败且本地无 package 时立即允许重新发起收款。 Co-authored-by: Cursor --- users/tixian_shenhe_services.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/users/tixian_shenhe_services.py b/users/tixian_shenhe_services.py index b0a9196..7952a80 100644 --- a/users/tixian_shenhe_services.py +++ b/users/tixian_shenhe_services.py @@ -1186,10 +1186,18 @@ def mark_transfer_success(auto_record, *, wechat_transfer_no=None, with_accounti def _sync_record_from_wx_query(auto_record, wx_data): """根据微信查单结果修正本地打款记录,返回 (action, payload)""" if wx_data.get('_not_found'): + if auto_record.zhuangtai == 0 and not _parse_package_info(auto_record.wechat_package): + _mark_transfer_attempt_failed( + auto_record, '微信未找到该打款单,请重新发起收款', close_audit=False, + ) + return RECONCILE_ALLOW_NEW, {} age = timezone.now() - auto_record.CreateTime if auto_record.zhuangtai == 0 and age < timedelta(minutes=PENDING_QUERY_GRACE_MINUTES): + local = _maybe_wait_confirm_from_local(auto_record) + if local: + return local return RECONCILE_PENDING, { - 'msg': '有收款处理中,请稍后再试', + 'msg': '收款处理中,请稍后再试', 'tixian_id': auto_record.tixian_id, } if auto_record.zhuangtai == 0: @@ -1307,6 +1315,14 @@ def reconcile_shenhe_wechat_bills(shenhe_danhao): '对账查单不可用 shenhe_danhao=%s bill=%s,尝试本地 package 或短 grace', shenhe_danhao, rec.tixian_id, ) + local_wait = _maybe_wait_confirm_from_local(rec) + if local_wait: + return local_wait + if rec.zhuangtai == 0 and not _parse_package_info(rec.wechat_package): + _mark_transfer_attempt_failed( + rec, '微信查单暂不可用,请重新发起收款', close_audit=False, + ) + continue if rec.zhuangtai == 0: age = timezone.now() - rec.CreateTime if age >= timedelta(minutes=PENDING_QUERY_GRACE_MINUTES):