fix(transfer): expose PROVIDERS via ServerEnv, use env.PROVIDERS in transfer_check.dspy

This commit is contained in:
yumoqing 2026-07-17 12:08:14 +08:00
parent 7f2607450b
commit ba1e649814
2 changed files with 4 additions and 10 deletions

View File

@ -265,6 +265,7 @@ def load_unipay():
env.get_pay_fee = get_pay_fee
env.sor_get_pay_fee = sor_get_pay_fee
env.PaymentLog = PaymentLog
env.PROVIDERS = PROVIDERS
add_startup(setup_callback_path)

View File

@ -1,9 +1,10 @@
"""手动检查转账邮件并完成入账"""
tcode = str(params_kw.tcode)
env = request._run_ns
debug(f'transfer_check.dspy: tcode={tcode}')
try:
provider = PROVIDERS.get('transfer')
provider = env.PROVIDERS.get('transfer')
if provider is None:
return {"widgettype": "Message", "options": {"timeout": 3, "title": "错误", "message": "转账渠道未初始化"}}
@ -31,7 +32,6 @@ try:
if matched is None:
return {"widgettype": "Message", "options": {"timeout": 3, "title": "未匹配", "message": f"暂未找到转账码 {tcode} 的到账邮件,请确认已转账并稍后重试"}}
env = request._run_ns
db = DBPools()
dbname = get_module_dbname('unipay')
async with db.sqlorContext(dbname) as sor:
@ -64,11 +64,4 @@ try:
except Exception as e:
exception(f'transfer_check.dspy error: {e}')
return {
"widgettype": "Message",
"options": {
"timeout": 5,
"title": "错误",
"message": f"处理失败: {e}"
}
}
return {"widgettype": "Message", "options": {"timeout": 5, "title": "错误", "message": f"处理失败: {e}"}