From ccee3ba12bee4600674b336a81c3500def237c00 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 15 Jul 2026 13:45:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=90=AF=E7=94=A8=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=92=8C=E8=BD=AC=E8=B4=A6=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=B8=A0=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - recharge.ui: 下拉列表添加微信支付和转账支付选项 - user_recharge.dspy: 扩展provider校验,支持wechat/transfer - wechat.py: 修复description字段兼容payment_name - transfer.py: 导入DBPools + 修复tcode拼写错误 --- unipay/providers/transfer.py | 3 ++- unipay/providers/wechat.py | 2 +- wwwroot/recharge.ui | 8 ++++++++ wwwroot/user_recharge.dspy | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/unipay/providers/transfer.py b/unipay/providers/transfer.py index 55aa554..2168918 100644 --- a/unipay/providers/transfer.py +++ b/unipay/providers/transfer.py @@ -9,6 +9,7 @@ from appPublic.timeUtils import curDateString, timestampstr from email.parser import Parser from email.header import decode_header from email.utils import parseaddr +from sqlor.dbpools import DBPools from ..core import Gateway @@ -101,7 +102,7 @@ class TransferGateway(Gateway): dbname = env.get_module_dbname('unipay') async with db.sqlorContext(dbname) as sor: sql = "select * from transfercode where tcode=${tcode}$ and status='0'" - ns.tcoce = await self.new_tcode(sor) + ns.tcode = await self.new_tcode(sor) await sor.C('transfercode', ns.copy()) url = env.entire_url('transfer_info.ui') query_str = urllib.parse.urlencode(ns) diff --git a/unipay/providers/wechat.py b/unipay/providers/wechat.py index a3f6dd0..55f359d 100644 --- a/unipay/providers/wechat.py +++ b/unipay/providers/wechat.py @@ -148,7 +148,7 @@ class WechatGateway(Gateway): body = { "appid": self.appid, "mchid": self.mchid, - "description": payload["subject"], + "description": payload.get("subject") or payload.get("payment_name", "充值"), "out_trade_no": payload["out_trade_no"], "notify_url": payload["notify_url"], "amount": { diff --git a/wwwroot/recharge.ui b/wwwroot/recharge.ui index aa476ea..c51b1ef 100644 --- a/wwwroot/recharge.ui +++ b/wwwroot/recharge.ui @@ -14,6 +14,14 @@ { "value":"alipay", "text":"支付宝" + }, + { + "value":"wechat", + "text":"微信支付" + }, + { + "value":"transfer", + "text":"转账支付" } ] }, diff --git a/wwwroot/user_recharge.dspy b/wwwroot/user_recharge.dspy index daf70bf..7eaf5d1 100644 --- a/wwwroot/user_recharge.dspy +++ b/wwwroot/user_recharge.dspy @@ -5,7 +5,7 @@ if params_kw.amount is None: "message": "需输入充值金额" } } -if params_kw.provider != 'alipay': +if params_kw.provider not in ('alipay', 'wechat', 'transfer'): return { "status": "error", "data": {