106 lines
3.1 KiB
Python
106 lines
3.1 KiB
Python
from fastapi import APIRouter, Depends, HTTPException
|
|
from sqlalchemy.orm import Session
|
|
from typing import Dict
|
|
from ...core.database import get_db
|
|
from ...services.advanced_analysis import AdvancedAnalysisService
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/missing-value/{lottery_type}")
|
|
def get_missing_value_analysis(
|
|
lottery_type: str,
|
|
periods: int = 100,
|
|
db: Session = Depends(get_db)
|
|
):
|
|
"""获取遗漏值分析"""
|
|
if lottery_type not in ['ssq', 'dlt']:
|
|
raise HTTPException(status_code=400, detail="Invalid lottery type")
|
|
|
|
service = AdvancedAnalysisService(db)
|
|
return service.get_missing_value_analysis(lottery_type, periods)
|
|
|
|
|
|
@router.get("/sum-value/{lottery_type}")
|
|
def get_sum_value_analysis(
|
|
lottery_type: str,
|
|
periods: int = 100,
|
|
db: Session = Depends(get_db)
|
|
):
|
|
"""获取和值分析"""
|
|
if lottery_type not in ['ssq', 'dlt']:
|
|
raise HTTPException(status_code=400, detail="Invalid lottery type")
|
|
|
|
service = AdvancedAnalysisService(db)
|
|
return service.get_sum_value_analysis(lottery_type, periods)
|
|
|
|
|
|
@router.get("/ac-value/{lottery_type}")
|
|
def get_ac_value_analysis(
|
|
lottery_type: str,
|
|
periods: int = 100,
|
|
db: Session = Depends(get_db)
|
|
):
|
|
"""获取AC值分析"""
|
|
if lottery_type not in ['ssq', 'dlt']:
|
|
raise HTTPException(status_code=400, detail="Invalid lottery type")
|
|
|
|
service = AdvancedAnalysisService(db)
|
|
return service.get_ac_value_analysis(lottery_type, periods)
|
|
|
|
|
|
@router.get("/prime-composite/{lottery_type}")
|
|
def get_prime_composite_analysis(
|
|
lottery_type: str,
|
|
periods: int = 100,
|
|
db: Session = Depends(get_db)
|
|
):
|
|
"""获取质合比分析"""
|
|
if lottery_type not in ['ssq', 'dlt']:
|
|
raise HTTPException(status_code=400, detail="Invalid lottery type")
|
|
|
|
service = AdvancedAnalysisService(db)
|
|
return service.get_prime_composite_analysis(lottery_type, periods)
|
|
|
|
|
|
@router.get("/road-012/{lottery_type}")
|
|
def get_road_012_analysis(
|
|
lottery_type: str,
|
|
periods: int = 100,
|
|
db: Session = Depends(get_db)
|
|
):
|
|
"""获取012路分析"""
|
|
if lottery_type not in ['ssq', 'dlt']:
|
|
raise HTTPException(status_code=400, detail="Invalid lottery type")
|
|
|
|
service = AdvancedAnalysisService(db)
|
|
return service.get_road_012_analysis(lottery_type, periods)
|
|
|
|
|
|
@router.get("/span/{lottery_type}")
|
|
def get_span_analysis(
|
|
lottery_type: str,
|
|
periods: int = 100,
|
|
db: Session = Depends(get_db)
|
|
):
|
|
"""获取跨度分析"""
|
|
if lottery_type not in ['ssq', 'dlt']:
|
|
raise HTTPException(status_code=400, detail="Invalid lottery type")
|
|
|
|
service = AdvancedAnalysisService(db)
|
|
return service.get_span_analysis(lottery_type, periods)
|
|
|
|
|
|
@router.get("/comprehensive/{lottery_type}")
|
|
def get_comprehensive_analysis(
|
|
lottery_type: str,
|
|
periods: int = 100,
|
|
db: Session = Depends(get_db)
|
|
):
|
|
"""获取综合分析"""
|
|
if lottery_type not in ['ssq', 'dlt']:
|
|
raise HTTPException(status_code=400, detail="Invalid lottery type")
|
|
|
|
service = AdvancedAnalysisService(db)
|
|
return service.get_comprehensive_analysis(lottery_type, periods)
|