Files
YunNanProject/Routes/BigScreenController.py

28 lines
868 B
Python
Raw Normal View History

2025-09-10 15:07:50 +08:00
from fastapi import APIRouter
2025-09-10 15:11:25 +08:00
import json
2025-09-10 15:42:32 +08:00
from Model.RenkouModel import RenkouModel
2025-09-10 15:07:50 +08:00
2025-09-10 15:42:32 +08:00
# 创建APIRouter实例
2025-09-10 15:07:50 +08:00
router = APIRouter(prefix="/bigscreen", tags=["大屏展示"])
2025-09-10 15:42:32 +08:00
# 定义路由
2025-09-10 15:21:56 +08:00
@router.get("/")
async def root():
return {"message": "Welcome to YunNan Education World!"}
2025-09-10 15:07:50 +08:00
2025-09-10 15:11:25 +08:00
@router.get("/chart/bar")
async def get_bar_chart_config():
2025-09-10 15:42:32 +08:00
return RenkouModel.generate_population_chart_config()
2025-09-10 15:21:56 +08:00
@router.get("/population/chart/{year}")
async def get_population_chart_config(year: str = "2024"):
2025-09-10 15:42:32 +08:00
return RenkouModel.generate_population_chart_config(year)
2025-09-10 15:21:56 +08:00
@router.get("/population/urbanization")
async def get_urbanization_rate_chart_config():
2025-09-10 15:42:32 +08:00
return RenkouModel.generate_urbanization_rate_chart_config()
2025-09-10 15:21:56 +08:00
@router.get("/population/data")
async def get_population_data():
2025-09-10 15:42:32 +08:00
return {"data": RenkouModel.load_population_data()}