-
+
-
农历: {{ lunarBirthday }}
+
+ {{ lunarBirthday }}
+
diff --git a/main.py b/main.py
index 0a6b773..044580d 100644
--- a/main.py
+++ b/main.py
@@ -12,7 +12,6 @@
from slowapi.middleware import SlowAPIMiddleware
from src.limiter import limiter, get_real_ipaddr
-from src.date_router import router as date_router
from src.chatgpt_router import router as chatgpt_router
from src.divination_router import router as divination_router
from src.user_router import router as user_router
@@ -37,7 +36,6 @@
allow_headers=["*"],
)
-app.include_router(date_router)
app.include_router(chatgpt_router)
app.include_router(divination_router)
app.include_router(user_router)
diff --git a/requirements.txt b/requirements.txt
index 33ad385..343b546 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,5 +4,4 @@ uvicorn==0.21.1
openai==0.27.4
python-multipart==0.0.6
slowapi==0.1.8
-sxtwl==2.0.6
pyjwt==2.7.0
diff --git a/src/date_router.py b/src/date_router.py
deleted file mode 100644
index 4a988a4..0000000
--- a/src/date_router.py
+++ /dev/null
@@ -1,42 +0,0 @@
-import datetime
-import logging
-import sxtwl
-
-from fastapi import APIRouter
-
-router = APIRouter()
-_logger = logging.getLogger(__name__)
-
-Gan = ["甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"]
-Zhi = ["子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"]
-ShX = ["鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"]
-ymc = ["正", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"]
-rmc = ["初一", "初二", "初三", "初四", "初五", "初六", "初七", "初八", "初九", "初十",
- "十一", "十二", "十三", "十四", "十五", "十六", "十七", "十八", "十九", "二十",
- "廿一", "廿二", "廿三", "廿四", "廿五", "廿六", "廿七", "廿八", "廿九", "三十", "卅一"]
-XiZ = ['摩羯', '水瓶', '双鱼', '白羊', '金牛', '双子', '巨蟹', '狮子', '处女', '天秤', '天蝎', '射手']
-WeekCn = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
-
-
-@router.get("/api/date")
-async def change_date(date: str, is_lunar: bool = False) -> str:
- if is_lunar:
- # 从农历年月日获取一天的信息
- return ""
- solar_date = datetime.datetime.strptime(
- date, '%Y-%m-%d %H:%M:%S'
- )
- # 从公历年月日获取一天的信息
- lunar_date = sxtwl.fromSolar(
- solar_date.year, solar_date.month, solar_date.day)
- yTG = lunar_date.getYearGZ(True)
-
- return "{}年 {}{}年 {}{}月{} {}座".format(
- ShX[yTG.dz],
- Gan[yTG.tg],
- Zhi[yTG.dz],
- '闰' if lunar_date.isLunarLeap() else '',
- ymc[lunar_date.getLunarMonth() - 1],
- rmc[lunar_date.getLunarDay() - 1],
- XiZ[lunar_date.getConstellation() - 1]
- )