fix: 会员支付打印微信完整错误并支持配置 V2 商户密钥

- 统一下单 XML 安全解析,日志输出 raw_response 与 err_code_des
- 下单前打印 club/appid/mch_id/key_source 诊断
- 后台 club-manage 可保存 config_json.mch_key(V2 MD5 密钥,非 api_v3_key)
- 未配 mch_key 时告警:回落全局密钥易导致签名错误

回退: git reset --hard backup-before-wx-v2-diag-20260710

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-10 20:05:00 +08:00
parent e0fa112da6
commit 3660fa4cc7
3 changed files with 142 additions and 59 deletions

View File

@@ -443,9 +443,11 @@ class ClubManageView(APIView):
'sort_order': club.sort_order,
}
if full:
cfg_json = club.config_json or {}
base.update({
'wx_secret': club.wx_secret,
'api_v3_key': club.api_v3_key,
'mch_key': cfg_json.get('mch_key') or cfg_json.get('shanghumiyao') or '',
'cert_serial_no': club.cert_serial_no,
'private_key_path': club.private_key_path,
'platform_cert_dir': club.platform_cert_dir,
@@ -494,6 +496,12 @@ class ClubManageView(APIView):
if field in request.data:
setattr(club, field, request.data[field])
update_fields.append(field)
if 'mch_key' in request.data:
cfg = dict(club.config_json or {})
cfg['mch_key'] = (request.data.get('mch_key') or '').strip()
club.config_json = cfg
if 'config_json' not in update_fields:
update_fields.append('config_json')
if update_fields:
club.save(update_fields=update_fields)
return Response({