Skip to content

Commit 2fcd4f9

Browse files
authored
Revert "feat: 新增md转json脚本"
1 parent 9d3c011 commit 2fcd4f9

File tree

3 files changed

+53
-199
lines changed

3 files changed

+53
-199
lines changed

Diff for: package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
"start": "NODE_ENV=production node bin/www",
77
"dev": "NODE_ENV=development ./node_modules/.bin/nodemon bin/www",
88
"prd": "pm2 start bin/www",
9-
"test": "echo \"Error: no test specified\" && exit 1",
10-
"md2json": "node ./utils/transforMd2json.js"
9+
"test": "echo \"Error: no test specified\" && exit 1"
1110
},
1211
"dependencies": {
1312
"@koa/cors": "^3.1.0",
14-
"commonmark": "^0.29.3",
1513
"debug": "^4.1.1",
1614
"koa": "^2.7.0",
1715
"koa-bodyparser": "^4.2.1",

Diff for: routes/dailyProblem.js

+52-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const router = require("koa-router")();
22
const solutions = require("../static/solution/solutions.json");
3-
const problems = require("../static/problem/problem.json");
43
const { decrypt } = require("../utils/crypto");
54

65
const { success, fail } = require("../utils/request");
@@ -18,9 +17,58 @@ router.get("/api/v1/daily-problem", async (ctx) => {
1817
// 3. 根据 Day 几 计算出具体返回哪一个题目
1918
// !!注意: 如果用户指定的时间大于今天,则返回”题目不存在,仅支持查询历史每日一题“
2019

21-
const day = getDay(ctx.query.date || new Date().getTime()); // 用户指定的实际
22-
if (day in problems) {
23-
ctx.body = success(problems[day]);
20+
const date = getDay(ctx.query.date || new Date().getTime()); // 用户指定的实际
21+
if (date === 2) {
22+
ctx.body = success({
23+
day: 2,
24+
title: "821. 字符的最短距离",
25+
link: "https://leetcode-cn.com/problems/plus-one",
26+
tags: ["基础篇", "数组"], // 目前所有 README 都是没有的。因此如果没有的话,你可以先不返回,有的话就返回。后面我慢慢补
27+
pres: ["数组的遍历(正向遍历和反向遍历)"],
28+
description: `
29+
给定一个字符串 S 和一个字符 C。返回一个代表字符串 S 中每个字符到字符串 S 中的字符 C 的最短距离的数组。
30+
31+
示例 1:
32+
33+
输入: S = "loveleetcode", C = 'e'
34+
输出: [3, 2, 1, 0, 1, 0, 0, 1, 2, 2, 1, 0]
35+
说明:
36+
37+
- 字符串 S 的长度范围为 [1, 10000]。
38+
- C 是一个单字符,且保证是字符串 S 里的字符。
39+
- S 和 C 中的所有字母均为小写字母。
40+
41+
`,
42+
});
43+
} else if (date <= 1) {
44+
ctx.body = success({
45+
day: 1,
46+
title: "66. 加一",
47+
whys: [
48+
"1. 由于是大家第一次打卡,因此出一个简单题。虽然是简单题,但是如果将加 1 改为加任意的数字,那么就变成了一个非常常见的面试题",
49+
],
50+
link: "https://leetcode-cn.com/problems/plus-one",
51+
tags: ["基础篇", "数组"], // 目前所有 README 都是没有的。因此如果没有的话,你可以先不返回,有的话就返回。后面我慢慢补
52+
pres: ["数组的遍历(正向遍历和反向遍历)"],
53+
description: `
54+
给定一个由整数组成的非空数组所表示的非负整数,在该数的基础上加一。
55+
56+
最高位数字存放在数组的首位, 数组中每个元素只存储单个数字。
57+
58+
你可以假设除了整数 0 之外,这个整数不会以零开头。
59+
60+
示例 1:
61+
62+
输入: [1,2,3]
63+
输出: [1,2,4]
64+
解释: 输入数组表示数字 123。
65+
示例 2:
66+
67+
输入: [4,3,2,1]
68+
输出: [4,3,2,2]
69+
解释: 输入数组表示数字 4321。
70+
`,
71+
});
2472
} else {
2573
ctx.body = fail({
2674
message: "当前暂时没有每日一题,请联系当前讲师进行处理~",

Diff for: utils/transforMd2json.js

-192
This file was deleted.

0 commit comments

Comments
 (0)