feat: silent wechat login, marketing tab optimization, admin page foundation

- Add silent WeChat login for MP/browser environments
- Fix Python 3.6 compatibility (remove typing.Annotated usage)
- Marketing page: tab-based content generation with category support
- Translate page: add auto-detect language default
- Homepage: add TTS playback, announcement ticker, remove redundant quick-actions
- Fix FAB button overlap with custom tabbar on customers/quotation pages
- Make openai/anthropic imports lazy for Python 3.6 compat
This commit is contained in:
TradeMate Dev
2026-05-14 00:30:48 +08:00
parent f70dd24c7d
commit 23a31f7c00
30 changed files with 485 additions and 269 deletions
+5 -6
View File
@@ -1,6 +1,5 @@
from fastapi import APIRouter, Depends, HTTPException, Query
from sqlalchemy.ext.asyncio import AsyncSession
from typing import Annotated
from app.database import get_db
from app.services.admin import AdminService
from app.api.v1.deps import get_current_user
@@ -17,7 +16,7 @@ async def require_admin(current_user: dict = Depends(get_current_user)) -> dict:
@router.get("/dashboard")
async def get_dashboard(
_: dict = Depends(require_admin),
db: Annotated[AsyncSession, Depends(get_db)] = None,
db: AsyncSession = Depends(get_db),
):
service = AdminService(db)
return await service.get_dashboard()
@@ -28,7 +27,7 @@ async def list_users(
page: int = Query(1, ge=1),
size: int = Query(20, ge=1, le=100),
_: dict = Depends(require_admin),
db: Annotated[AsyncSession, Depends(get_db)] = None,
db: AsyncSession = Depends(get_db),
):
service = AdminService(db)
return await service.list_users(page, size)
@@ -39,7 +38,7 @@ async def update_user_tier(
target_user_id: str,
data: dict,
_: dict = Depends(require_admin),
db: Annotated[AsyncSession, Depends(get_db)] = None,
db: AsyncSession = Depends(get_db),
):
service = AdminService(db)
tier = data.get("tier")
@@ -55,7 +54,7 @@ async def update_user_tier(
async def toggle_user_active(
target_user_id: str,
_: dict = Depends(require_admin),
db: Annotated[AsyncSession, Depends(get_db)] = None,
db: AsyncSession = Depends(get_db),
):
service = AdminService(db)
success = await service.toggle_user_active(target_user_id)
@@ -66,7 +65,7 @@ async def toggle_user_active(
@router.get("/health")
async def system_health(
db: Annotated[AsyncSession, Depends(get_db)] = None,
db: AsyncSession = Depends(get_db),
):
service = AdminService(db)
return await service.get_system_health()