update pay ui

This commit is contained in:
2025-12-14 14:26:01 +08:00
parent 1862e26baf
commit 39ed5562f1
3 changed files with 26 additions and 13 deletions

12
app.py
View File

@@ -4956,10 +4956,13 @@ def generate_jssdk_signature(url, appid, appsecret):
def api_wechat_jssdk_config():
"""获取微信 JS-SDK 签名配置(用于开放标签)"""
try:
print(f"[JS-SDK Config] 收到请求")
data = request.get_json() or {}
url = data.get('url')
print(f"[JS-SDK Config] URL: {url}")
if not url:
print(f"[JS-SDK Config] 错误: 缺少 url 参数")
return jsonify({
'code': 400,
'message': '缺少必要参数 url',
@@ -4969,8 +4972,11 @@ def api_wechat_jssdk_config():
# URL 校验:必须是允许的域名
from urllib.parse import urlparse
parsed = urlparse(url)
allowed_domains = ['valuefrontier.cn', 'www.valuefrontier.cn', 'localhost', '127.0.0.1']
if parsed.netloc.split(':')[0] not in allowed_domains:
# 扩展允许的域名列表,包括 API 域名
allowed_domains = ['valuefrontier.cn', 'www.valuefrontier.cn', 'api.valuefrontier.cn', 'localhost', '127.0.0.1']
domain = parsed.netloc.split(':')[0]
print(f"[JS-SDK Config] 解析域名: {domain}")
if domain not in allowed_domains:
return jsonify({
'code': 400,
'message': 'URL 域名不在允许范围内',
@@ -4982,11 +4988,13 @@ def api_wechat_jssdk_config():
url = url.split('#')[0]
# 生成签名(使用公众号配置)
print(f"[JS-SDK Config] 开始生成签名...")
config = generate_jssdk_signature(
url=url,
appid=WECHAT_MP_APPID,
appsecret=WECHAT_MP_APPSECRET
)
print(f"[JS-SDK Config] 签名生成完成: {config is not None}")
if not config:
return jsonify({