feat: club 表独立 mch_key 字段,后台明确区分 APIv2 收款与 APIv3 提现

- 新增 club.mch_key 列并迁移 config_json 历史数据,api_v3_key 保持独立
- club-manage 读写 mch_key;支付读 club.mch_key 优先,兼容 config_json 回落
- 提现查单返回商户号改读俱乐部 V3 配置;不影响其他业务逻辑

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-10 21:34:32 +08:00
parent 017d176790
commit 49ad57bbb2
6 changed files with 78 additions and 20 deletions

View File

@@ -18,8 +18,11 @@ def _xml_text(root, tag, default=''):
return node.text
def _resolve_v2_mch_key(cfg_json, fallback_key):
def _resolve_v2_mch_key(club, cfg_json, fallback_key):
"""V2 JSAPI 统一下单用的商户 API 密钥32 位 MD5 密钥,不是 api_v3_key"""
column_key = (getattr(club, 'mch_key', None) or '').strip() if club else ''
if column_key:
return column_key, 'club.mch_key'
cfg_json = cfg_json or {}
for field in ('mch_key', 'shanghumiyao', 'WEIXIN_SHANGHUMIYAO'):
val = (cfg_json.get(field) or '').strip()
@@ -51,7 +54,7 @@ def get_wechat_v2_config(club_id=None):
return fallback
cfg_json = club.config_json or {}
mch_key, key_source = _resolve_v2_mch_key(cfg_json, fallback['key'])
mch_key, key_source = _resolve_v2_mch_key(club, cfg_json, fallback['key'])
mini_appid = get_club_miniapp_appid(club)
wx_a = (club.wx_appid or '').strip()
pay_a = (club.pay_app_id or '').strip()