醉诗词全端项目开发
分页查询诗词,可按标题、作者、类型、标签筛选。
/poetry
| 参数名 | 类型 | 是否必填 | 说明 | 示例 |
|---|---|---|---|---|
| title | string | 否 | 诗词标题 | 静夜思 |
| author | string | 否 | 作者 | 李白 |
| type | string | 否 | 类型 | 古诗 |
| tags | string[] | 否 | 标签 | ['思乡'] |
| page | number | 否 | 页码(默认 1) | 1 |
| pageSize | number | 否 | 每页条数(默认 20) | 10 |
https://poetry.codefe.cn/api/authors
{
"code": 0,
"data": [
{
"id": 21578,
"title": "静夜思",
"author": "李白",
"type": "古诗",
"tags": ["思乡"],
"source": "唐诗三百首",
"createdAt": "2025-04-28T13:00:00.000Z",
"updatedAt": "2025-04-28T13:00:00.000Z"
}
// ...
],
"message": "success"
}
根据诗词 ID 获取单条诗词详情。
/poetry/:id
| 参数名 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| id | number | 是 | 诗词 ID |
https://poetry.codefe.cn/api/authors
{
"code": 0,
"data": {
"id": 21578,
"title": "登鹳雀楼",
"author": "王之涣",
"type": "五言绝句",
"tags": ["登高", "励志"],
"source": "唐诗三百首",
"content": ["白日依山尽,黄河入海流。欲穷千里目,更上一层楼。"],
"createdAt": "2025-04-28T12:00:00.000Z",
"updatedAt": "2025-04-28T12:00:00.000Z"
},
"message": "success"
}
错误响应示例
{
"statusCode": 400,
"message": "ID is required",
"error": "Bad Request"
}
{
"statusCode": 400,
"message": "Invalid ID",
"error": "Bad Request"
}
查询所有存在的作者(去重后)。
/authorshttps://poetry.codefe.cn/api/authors
{
"code": 0,
"data": [
"李白",
"杜甫",
"白居易"
],
"message": "success"
}
查询所有存在的诗词类型(去重后)。
/poetryprops/typeshttps://poetry.codefe.cn/api/poetryprops/types

{
"code": 0,
"data": [
"chuCi",
"shiJing",
"lunYu",
"yuanQu",
"tangShi",
"songCi"
],
"message": "success"
}
查询所有指定类型的诗词数据。
GET/poetry
poetry?type=chuCi
| 参数 | 值 | 是否必须 |
|---|---|---|
| type | chuCi shiJing lunYu yuanQu tangShi songCi |
是 |
| page |
数字类型,指定页码。例如:1。默认第 1 页 |
否 |
| pageSize |
数字类型,当前页的数组长度。例如:10。默认 20 条数据 |
否 |
| ... | ... | ... |
https://poetry.codefe.cn/api/poetry?type=chuCi
{
"code": 0,
"data": {
"total": 262,
"list": [
{
"id": 381,
"title": "湘春夜月",
"author": {
"id": 15,
"name": "黄孝迈"
},
"type": "songCi",
"tags": [
"宋词三百首"
],
"source": "ancientPoetry",
"status": "approved",
"dynasty": "song",
"submitter": {
"id": 1,
"name": "root",
"email": "root@example.com"
},
"createdAt": "2025-05-08T11:43:21.316Z",
"updatedAt": "2025-05-08T11:43:21.316Z",
"content": [
"近清明。",
"翠禽枝上消魂。",
"可惜一片清歌,都付与黄昏。",
"欲共柳花低诉,怕柳花轻薄,不解伤春。",
"念楚乡旅宿,柔情别绪,谁与温存。",
"空樽夜泣,青山不语,残月当门。",
"翠玉楼前,惟是有、一波湘水,摇荡湘云。",
"天长梦短,问甚时、重见桃根。",
"这次第,算人间没个并刀,翦断心上愁痕。"
]
}
]
},
"message": "success"
}
查询所有存在的标签(打平并去重后)。
GET/poetryprops/tagshttps://poetry.codefe.cn/api/poetryprops/tags
{
"code": 0,
"data": [
"山水",
"爱情",
"边塞",
"田园"
],
"message": "success"
}
查询当天日历详情信息
GEThttps://poetry.codefe.cn/api/poetryprops/lunar
{
"code": 0,
"data": {
"gregoriandate": "2025-05-13",
"lunardate": "2025-4-16",
"lunar_festival": "",
"festival": "",
"fitness": "除服.疗病.出行.拆卸.入宅",
"taboo": "求官.上任.开张.搬家.探病",
"shenwei": "喜神:正南 福神:东南 财神:正南 阳贵:正东 阴贵:东南 ",
"taishen": "仓库忌修弄,碓须忌,厨灶莫相干胎神在外西北停留6天",
"chongsha": "马日冲(丙子)鼠",
"suisha": "岁煞北",
"wuxingjiazi": "水",
"wuxingnayear": "佛灯火",
"wuxingnamonth": "白腊金",
"xingsu": "北方室火猪-吉",
"pengzu": "壬不泱水 午不苫盖",
"jianshen": "除",
"tiangandizhiyear": "乙巳",
"tiangandizhimonth": "辛巳",
"tiangandizhiday": "壬午",
"lmonthname": "孟夏",
"shengxiao": "蛇",
"lubarmonth": "四月",
"lunarday": "十六",
"jieqi": ""
},
"message": "success"
}
const carouselItems = [
{
src: "/97854999-9a48-4c4b-ad2e-d65340bae59f.jpg",
title: "处暑无三日,新凉直万金 | 处暑",
},
{
src: "/8822a76b-1e99-47aa-a933-f50cef3e3e03.jpg",
title: "七夕 | 在古诗词中读懂中国式浪漫",
},
{
src: "/77847fc9-ac8f-4ade-9914-ce7e3b089912.jpg",
title: "四面垂杨十里荷,问云何处最花多",
},
{
src: "/2a10254d-0fc1-4f6b-b077-642d178afa2a.jpg",
title: "秋夜长,风急雨急,雨急风急,秋夜长 | 秋夜",
},
{
src: "/9fa3ea33-43a1-4e6d-9da9-4f441a0f8361.jpg",
title: "关于立秋的古诗词,你知道几首?",
}
]
const poetrySelections = [
{
title: "诗 经",
desc: "关关雎鸠,在河之洲。窈窕淑女,君子好逑。",
bg: "#4b5c6b",
filter: { type: "shiJing" }
},
{
title: "楚 辞",
desc: "帝高阳之苗裔兮,朕皇考曰伯庸。",
bg: "#3e6b4b",
filter: { type: "chuCi" }
},
{
title: "论 语",
desc: "学而时习之,不亦说乎?",
bg: "#4b6b7d",
filter: { type: "lunYu" }
},
{
title: "唐诗三百首",
desc: "錦瑟無端五十絃,一絃一柱思華年。",
bg: "#6b4b3e",
filter: { type: "tangShi" }
},
{
title: "宋词三百首",
desc: "回首向来萧瑟处, 归去, 也无风雨也无晴。",
bg: "#7d7c4b",
filter: { type: "songCi" }
},
{
title: "元曲三百首",
desc: "无男儿只一身,担寂寞受孤闷;",
bg: "#5c4b6b",
filter: { type: "yuanQu" }
},
];
const poetryContentList = [
{
content: "遂古之初,谁传道之?",
author: "屈原",
title: "天问"
},
{
content: "学而时习之,不亦说乎?有朋自远方来,不亦乐乎?",
author: "孔子",
title: "学而篇"
},
{
content: "关关雎鸠,在河之洲。窈窕淑女,君子好逑。",
author: "无名氏",
title: "关雎"
},
{
content: "君不見黃河之水天上來,奔流到海不復回。",
author: "李白",
title: "鼓吹曲辭 將進酒"
},
{
content: "錦瑟無端五十絃,一絃一柱思華年。",
author: "李商隐",
title: "錦瑟"
},
{
content: "閑坐悲君亦自悲,百年都是幾多時。",
author: "元稹",
title: "遣悲懷三首 三"
},
{
content: "无意苦争春,一任群芳妒。",
author: "陆游",
title: "卜算子"
},
{
content: "六朝旧事随流水,但寒烟、芳草凝绿。",
author: "王安石",
title: "桂枝香"
},
{
content: "梦後楼台高锁,酒醒帘幕低垂。",
author: "晏几道",
title: "临江仙"
},
{
content: "见我这般微微喘息,语言恍惚,脚步儿查梨。",
author: "关汉卿",
title: "诈妮子调风月・满庭芳"
}
]
export const DYNASTY_MAP = {
chunQiu: '春秋',
zhanGuo: '战国',
qin: '秦',
han: '汉',
sui: '隋',
tang: '唐',
song: '宋',
yuan: '元',
ming: '明',
qing: '清',
} as const;
export const POETRY_TYPE_MAP = {
chuCi: '楚辞',
lunYu: '论语',
shiJing: '诗经',
songCi: '宋词',
tangShi: '唐诗',
yuanQu: '元曲',
} as const;
export const POETRY_SOURCE_MAP = {
ancientPoetry: '古诗词',
systemUser: '系统用户',
} as const;
export const POETRY_STATUS_MAP = {
pending: '待审核',
approved: '审核通过',
notApproved: '审核未通过',
} as const;
备注
{ code: 0, data, message: 'success' } 格式。