fix: 无 package 的打款单不再长时间提示收款处理中

微信查单 not_found/失败且本地无 package 时立即允许重新发起收款。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-10 21:53:59 +08:00
parent e1a3c07cef
commit 921941a36d

View File

@@ -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):