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
+6 -6
View File
@@ -1,6 +1,6 @@
from fastapi import APIRouter, Depends, HTTPException, Query
from sqlalchemy.ext.asyncio import AsyncSession
from typing import Annotated, Optional
from typing import Optional
from app.database import get_db
from app.services.notification import NotificationService
from app.api.v1.deps import get_current_user_id
@@ -14,7 +14,7 @@ async def list_notifications(
size: int = Query(20, ge=1, le=100),
unread_only: bool = Query(False),
user_id: str = Depends(get_current_user_id),
db: Annotated[AsyncSession, Depends(get_db)] = None,
db: AsyncSession = Depends(get_db),
):
service = NotificationService(db)
return await service.list_notifications(user_id, page, size, unread_only)
@@ -23,7 +23,7 @@ async def list_notifications(
@router.get("/unread-count")
async def unread_count(
user_id: str = Depends(get_current_user_id),
db: Annotated[AsyncSession, Depends(get_db)] = None,
db: AsyncSession = Depends(get_db),
):
service = NotificationService(db)
count = await service.get_unread_count(user_id)
@@ -34,7 +34,7 @@ async def unread_count(
async def mark_read(
notification_id: str,
user_id: str = Depends(get_current_user_id),
db: Annotated[AsyncSession, Depends(get_db)] = None,
db: AsyncSession = Depends(get_db),
):
service = NotificationService(db)
success = await service.mark_read(user_id, notification_id)
@@ -46,7 +46,7 @@ async def mark_read(
@router.post("/read-all")
async def mark_all_read(
user_id: str = Depends(get_current_user_id),
db: Annotated[AsyncSession, Depends(get_db)] = None,
db: AsyncSession = Depends(get_db),
):
service = NotificationService(db)
count = await service.mark_all_read(user_id)
@@ -57,7 +57,7 @@ async def mark_all_read(
async def delete_notification(
notification_id: str,
user_id: str = Depends(get_current_user_id),
db: Annotated[AsyncSession, Depends(get_db)] = None,
db: AsyncSession = Depends(get_db),
):
service = NotificationService(db)
success = await service.delete_notification(user_id, notification_id)