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.product import ProductService
from app.api.v1.deps import get_current_user_id
@@ -44,7 +44,7 @@ async def list_products(
page: int = Query(1, ge=1),
size: int = Query(20, ge=1, le=100),
user_id: str = Depends(get_current_user_id),
db: Annotated[AsyncSession, Depends(get_db)] = None,
db: AsyncSession = Depends(get_db),
):
service = ProductService(db)
return await service.list_products(user_id, category, page, size)
@@ -54,7 +54,7 @@ async def list_products(
async def get_product(
product_id: str,
user_id: str = Depends(get_current_user_id),
db: Annotated[AsyncSession, Depends(get_db)] = None,
db: AsyncSession = Depends(get_db),
):
service = ProductService(db)
product = await service.get_product(user_id, product_id)
@@ -67,7 +67,7 @@ async def get_product(
async def create_product(
data: ProductCreate,
user_id: str = Depends(get_current_user_id),
db: Annotated[AsyncSession, Depends(get_db)] = None,
db: AsyncSession = Depends(get_db),
):
service = ProductService(db)
product = await service.create_product(user_id, data.dict())
@@ -79,7 +79,7 @@ async def update_product(
product_id: str,
data: ProductUpdate,
user_id: str = Depends(get_current_user_id),
db: Annotated[AsyncSession, Depends(get_db)] = None,
db: AsyncSession = Depends(get_db),
):
service = ProductService(db)
product = await service.update_product(user_id, product_id, data.dict(exclude_unset=True))
@@ -92,7 +92,7 @@ async def update_product(
async def delete_product(
product_id: str,
user_id: str = Depends(get_current_user_id),
db: Annotated[AsyncSession, Depends(get_db)] = None,
db: AsyncSession = Depends(get_db),
):
service = ProductService(db)
deleted = await service.delete_product(user_id, product_id)