7b62c2f8b4
## H5 底部导航修复 (Bug #10) - 精简 App.vue,移除重复 tabbar,仅保留全局样式 - uni-page 设置 height: calc(100% - 50px) + overflow-y: auto - 内容区域精确停在底部导航上方,独立滚动不再叠加 - 恢复 custom-tab-bar 组件 ## 项目进度文档 - PROGRESS.md 更新至 10 个 Bug 修复 - 新增 H5 底部导航修复记录 - 新增历史变更条目
74 lines
2.2 KiB
Python
74 lines
2.2 KiB
Python
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
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/customers")
|
|
async def customer_analytics(
|
|
user_id: str = Depends(get_current_user_id),
|
|
db: Annotated[AsyncSession, Depends(get_db)] = None,
|
|
):
|
|
service = AnalyticsService(db)
|
|
return await service.get_customer_stats(user_id)
|
|
|
|
|
|
@router.get("/translations")
|
|
async def translation_analytics(
|
|
user_id: str = Depends(get_current_user_id),
|
|
db: Annotated[AsyncSession, Depends(get_db)] = None,
|
|
):
|
|
service = AnalyticsService(db)
|
|
return await service.get_translation_stats(user_id)
|
|
|
|
|
|
@router.get("/quotations")
|
|
async def quotation_analytics(
|
|
user_id: str = Depends(get_current_user_id),
|
|
db: Annotated[AsyncSession, Depends(get_db)] = None,
|
|
):
|
|
service = AnalyticsService(db)
|
|
return await service.get_quotation_stats(user_id)
|
|
|
|
|
|
@router.get("/messages")
|
|
async def message_analytics(
|
|
user_id: str = Depends(get_current_user_id),
|
|
db: Annotated[AsyncSession, Depends(get_db)] = None,
|
|
):
|
|
service = AnalyticsService(db)
|
|
return await service.get_message_stats(user_id)
|
|
|
|
|
|
@router.get("/overview")
|
|
async def overview(
|
|
user_id: str = Depends(get_current_user_id),
|
|
db: Annotated[AsyncSession, Depends(get_db)] = None,
|
|
):
|
|
service = AnalyticsService(db)
|
|
customers = await service.get_customer_stats(user_id)
|
|
translations = await service.get_translation_stats(user_id)
|
|
quotations = await service.get_quotation_stats(user_id)
|
|
messages = await service.get_message_stats(user_id)
|
|
marketing = await service.get_marketing_stats(user_id)
|
|
return {
|
|
"customers": customers,
|
|
"translations": translations,
|
|
"quotations": quotations,
|
|
"messages": messages,
|
|
"marketing": marketing,
|
|
}
|
|
|
|
|
|
@router.get("/marketing")
|
|
async def marketing_analytics(
|
|
user_id: str = Depends(get_current_user_id),
|
|
db: Annotated[AsyncSession, Depends(get_db)] = None,
|
|
):
|
|
service = AnalyticsService(db)
|
|
return await service.get_marketing_stats(user_id)
|