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:
@@ -1,6 +1,5 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from typing import Annotated
|
||||
from app.database import get_db
|
||||
from app.services.analytics import AnalyticsService
|
||||
from app.api.v1.deps import get_current_user_id
|
||||
@@ -11,7 +10,7 @@ router = APIRouter()
|
||||
@router.get("/customers")
|
||||
async def customer_analytics(
|
||||
user_id: str = Depends(get_current_user_id),
|
||||
db: Annotated[AsyncSession, Depends(get_db)] = None,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
service = AnalyticsService(db)
|
||||
return await service.get_customer_stats(user_id)
|
||||
@@ -20,7 +19,7 @@ async def customer_analytics(
|
||||
@router.get("/translations")
|
||||
async def translation_analytics(
|
||||
user_id: str = Depends(get_current_user_id),
|
||||
db: Annotated[AsyncSession, Depends(get_db)] = None,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
service = AnalyticsService(db)
|
||||
return await service.get_translation_stats(user_id)
|
||||
@@ -29,7 +28,7 @@ async def translation_analytics(
|
||||
@router.get("/quotations")
|
||||
async def quotation_analytics(
|
||||
user_id: str = Depends(get_current_user_id),
|
||||
db: Annotated[AsyncSession, Depends(get_db)] = None,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
service = AnalyticsService(db)
|
||||
return await service.get_quotation_stats(user_id)
|
||||
@@ -38,7 +37,7 @@ async def quotation_analytics(
|
||||
@router.get("/messages")
|
||||
async def message_analytics(
|
||||
user_id: str = Depends(get_current_user_id),
|
||||
db: Annotated[AsyncSession, Depends(get_db)] = None,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
service = AnalyticsService(db)
|
||||
return await service.get_message_stats(user_id)
|
||||
@@ -47,7 +46,7 @@ async def message_analytics(
|
||||
@router.get("/overview")
|
||||
async def overview(
|
||||
user_id: str = Depends(get_current_user_id),
|
||||
db: Annotated[AsyncSession, Depends(get_db)] = None,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
service = AnalyticsService(db)
|
||||
customers = await service.get_customer_stats(user_id)
|
||||
@@ -67,7 +66,7 @@ async def overview(
|
||||
@router.get("/marketing")
|
||||
async def marketing_analytics(
|
||||
user_id: str = Depends(get_current_user_id),
|
||||
db: Annotated[AsyncSession, Depends(get_db)] = None,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
service = AnalyticsService(db)
|
||||
return await service.get_marketing_stats(user_id)
|
||||
|
||||
Reference in New Issue
Block a user