refactor(backend): 重命名后端项目为 gym-manage-api,修改包名为 cn.novalon.gym.manage

This commit is contained in:
张翔
2026-04-17 18:35:50 +08:00
parent 666189b676
commit deb961c427
916 changed files with 108360 additions and 38328 deletions
+59
View File
@@ -0,0 +1,59 @@
#!/usr/bin/env python3
"""
检查用户管理页面的请求
"""
from playwright.sync_api import sync_playwright
import time
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
context = browser.new_context()
page = context.new_page()
# 监听网络请求
def handle_request(request):
if '/api/' in request.url and not request.url.endswith('.ts'):
headers = request.headers
print(f"\n请求: {request.method} {request.url}")
if 'authorization' in headers:
print(f" Authorization: {headers['authorization'][:50]}...")
else:
print(f" ⚠️ 没有Authorization头!")
def handle_response(response):
if '/api/' in response.url and not response.url.endswith('.ts'):
print(f"响应: {response.status} {response.url}")
if response.status == 401:
print(f" ⚠️ 401错误!")
page.on('request', handle_request)
page.on('response', handle_response)
# 登录
print("登录...")
page.goto("http://localhost:3002/login")
page.wait_for_load_state("networkidle")
page.fill('input[placeholder="请输入用户名"]', 'admin')
page.fill('input[placeholder="请输入密码"]', 'admin123')
page.click('button:has-text("登录")')
# 等待Token
for i in range(10):
time.sleep(1)
token = page.evaluate("localStorage.getItem('token')")
if token:
print(f"\n登录成功")
break
# 访问用户管理
print("\n\n访问用户管理...")
page.goto("http://localhost:3002/users")
page.wait_for_load_state("networkidle")
time.sleep(3)
print(f"\n最终URL: {page.url}")
token_after = page.evaluate("localStorage.getItem('token')")
print(f"Token: {'存在' if token_after else '不存在'}")
browser.close()