Skip to content

Commit e25c90c

Browse files
author
lucifer
committed
chore: 仅支持历史查询,不支持未来时间
1 parent 15feb28 commit e25c90c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

routes/dailyProblem.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ router.get("/api/v1/daily-problem", async (ctx) => {
1212
// 1. 如果用户指定了时间,则获取指定时间,否则获取今天
1313
// 2. 根据上一步计算的时间和活动开始时间计算当前是 Day 几
1414
// 3. 根据 Day 几 计算出具体返回哪一个题目
15+
// !!注意: 如果用户指定的时间大于今天,则返回”题目不存在,仅支持查询历史每日一题“
1516

1617
const date = ctx.query.date; // 用户指定的实际
1718

@@ -72,6 +73,8 @@ router.get("/api/v1/daily-problem", async (ctx) => {
7273
router.get("/api/v1/daily-problem/solution", async (ctx) => {
7374
// 逻辑和上面类似,只是返回值为 Markdown
7475

76+
// !!注意: 如果用户指定的 day 大于今天对应的day,则返回”题解不存在,仅支持查询历史官方题解“
77+
7578
const day = ctx.query.day || getCurrentDay(); // 用户指定的实际第几天(注意这里的 day 是数字,含义为第 day 天)
7679
if (day in solutions) {
7780
ctx.body = success({

0 commit comments

Comments
 (0)