update pay ui
This commit is contained in:
91
app.py
91
app.py
@@ -4190,8 +4190,50 @@ def wechat_callback():
|
|||||||
update_wechat_session(state, {'status': new_status, 'user_info': {'user_id': user.id}})
|
update_wechat_session(state, {'status': new_status, 'user_info': {'user_id': user.id}})
|
||||||
print(f"✅ 微信扫码状态已更新: {new_status}, user_id: {user.id}")
|
print(f"✅ 微信扫码状态已更新: {new_status}, user_id: {user.id}")
|
||||||
|
|
||||||
# PC 模式直接跳转到首页
|
# ⚡ PC 扫码模式:返回简单页面,不重定向(避免 iframe 导航整个页面)
|
||||||
return redirect('/home')
|
# 前端会通过轮询检测到状态变化,自动关闭弹窗
|
||||||
|
return '''
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>授权成功</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 100vh;
|
||||||
|
margin: 0;
|
||||||
|
background: #f5f5f5;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||||
|
}
|
||||||
|
.success {
|
||||||
|
text-align: center;
|
||||||
|
color: #52c41a;
|
||||||
|
}
|
||||||
|
.success svg {
|
||||||
|
width: 64px;
|
||||||
|
height: 64px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
.success p {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="success">
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||||
|
<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path>
|
||||||
|
<polyline points="22 4 12 14.01 9 11.01"></polyline>
|
||||||
|
</svg>
|
||||||
|
<p>授权成功</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
''', 200
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"❌ 微信登录失败: {e}")
|
print(f"❌ 微信登录失败: {e}")
|
||||||
@@ -4203,7 +4245,50 @@ def wechat_callback():
|
|||||||
if wechat_session_exists(state):
|
if wechat_session_exists(state):
|
||||||
update_wechat_session(state, {'status': 'auth_failed', 'error': str(e)})
|
update_wechat_session(state, {'status': 'auth_failed', 'error': str(e)})
|
||||||
|
|
||||||
return redirect('/home?error=login_failed')
|
# ⚡ 返回错误页面,不重定向
|
||||||
|
return '''
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>授权失败</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 100vh;
|
||||||
|
margin: 0;
|
||||||
|
background: #f5f5f5;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||||
|
}
|
||||||
|
.error {
|
||||||
|
text-align: center;
|
||||||
|
color: #ff4d4f;
|
||||||
|
}
|
||||||
|
.error svg {
|
||||||
|
width: 64px;
|
||||||
|
height: 64px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
.error p {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="error">
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||||
|
<circle cx="12" cy="12" r="10"></circle>
|
||||||
|
<line x1="15" y1="9" x2="9" y2="15"></line>
|
||||||
|
<line x1="9" y1="9" x2="15" y2="15"></line>
|
||||||
|
</svg>
|
||||||
|
<p>授权失败,请重试</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
''', 200
|
||||||
|
|
||||||
|
|
||||||
@app.route('/api/auth/login/wechat', methods=['POST'])
|
@app.route('/api/auth/login/wechat', methods=['POST'])
|
||||||
|
|||||||
Reference in New Issue
Block a user