'commit'
This commit is contained in:
27
Routes/BigScreenController.py
Normal file
27
Routes/BigScreenController.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from fastapi import APIRouter
|
||||
import json
|
||||
from Model.RenkouModel import RenkouModel
|
||||
|
||||
# 创建APIRouter实例
|
||||
router = APIRouter(prefix="/bigscreen", tags=["大屏展示"])
|
||||
|
||||
# 定义路由
|
||||
@router.get("/")
|
||||
async def root():
|
||||
return {"message": "Welcome to YunNan Education World!"}
|
||||
|
||||
@router.get("/chart/bar")
|
||||
async def get_bar_chart_config():
|
||||
return RenkouModel.generate_population_chart_config()
|
||||
|
||||
@router.get("/population/chart/{year}")
|
||||
async def get_population_chart_config(year: str = "2024"):
|
||||
return RenkouModel.generate_population_chart_config(year)
|
||||
|
||||
@router.get("/population/urbanization")
|
||||
async def get_urbanization_rate_chart_config():
|
||||
return RenkouModel.generate_urbanization_rate_chart_config()
|
||||
|
||||
@router.get("/population/data")
|
||||
async def get_population_data():
|
||||
return {"data": RenkouModel.load_population_data()}
|
Reference in New Issue
Block a user