35 lines
957 B
Python
35 lines
957 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from app.api.endpoints import analysis, lottery, prediction
|
|
|
|
app = FastAPI(
|
|
title="彩票数据分析系统",
|
|
description="支持双色球和大乐透的数据管理、统计分析和智能选号功能",
|
|
version="1.0.0"
|
|
)
|
|
|
|
# 配置CORS
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# 注册路由
|
|
app.include_router(analysis.router, prefix="/api/analysis", tags=["analysis"])
|
|
app.include_router(lottery.router, prefix="/api/v1/lottery", tags=["lottery"])
|
|
app.include_router(prediction.router,
|
|
prefix="/api/v1/prediction", tags=["prediction"])
|
|
|
|
|
|
@app.get("/")
|
|
def read_root():
|
|
return {"message": "欢迎使用彩票数据分析系统"}
|
|
|
|
|
|
@app.get("/health")
|
|
def health_check():
|
|
return {"status": "healthy", "message": "系统运行正常"}
|