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