upload project source code
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
'''
|
||||
Author: caoziyuan ziyuan.cao@zhuying.com
|
||||
Date: 2025-12-23 14:08:15
|
||||
LastEditors: caoziyuan ziyuan.cao@zhuying.com
|
||||
LastEditTime: 2025-12-23 14:24:55
|
||||
FilePath: \naming-backend\app\api\v1\module_common\calendar\controller.py
|
||||
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
'''
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from datetime import date
|
||||
from fastapi import APIRouter, Query
|
||||
|
||||
from app.common.response import SuccessResponse
|
||||
from app.api.v1.module_common.calendar.service import CalendarService
|
||||
|
||||
# 定义路由
|
||||
CalendarRouter = APIRouter(prefix="/calendar", tags=["万年历"])
|
||||
|
||||
|
||||
@CalendarRouter.get("/today", summary="获取今日万年历", description="获取今天的农历信息、宜忌等(无需登录)")
|
||||
async def get_today_calendar() -> SuccessResponse:
|
||||
"""
|
||||
获取今日万年历信息
|
||||
|
||||
返回格式:
|
||||
{
|
||||
"lunar": "腊月 十二",
|
||||
"year": "甲辰年",
|
||||
"solar": "2024.01.22",
|
||||
"yi": ["出行", "开市", "交易", "裁衣"],
|
||||
"ji": ["动土", "安葬", "破土", "作灶"]
|
||||
}
|
||||
"""
|
||||
data = CalendarService.get_calendar_info()
|
||||
return SuccessResponse(data=data)
|
||||
|
||||
|
||||
@CalendarRouter.get("/date", summary="获取指定日期万年历", description="获取指定日期的农历信息、宜忌等(无需登录)")
|
||||
async def get_date_calendar(
|
||||
year: int = Query(..., description="年份,如:2024"),
|
||||
month: int = Query(..., ge=1, le=12, description="月份,1-12"),
|
||||
day: int = Query(..., ge=1, le=31, description="日期,1-31")
|
||||
) -> SuccessResponse:
|
||||
"""
|
||||
获取指定日期的万年历信息
|
||||
"""
|
||||
data = CalendarService.get_calendar_info(year, month, day)
|
||||
return SuccessResponse(data=data)
|
||||
Reference in New Issue
Block a user