feat: add 孔夫子旧书网用户动态 (#5570)
Co-authored-by: Henry Wang <hi@henry.wang>
This commit is contained in:
@@ -155,6 +155,12 @@ count 的取值范围为 1-12,为防止请求次数过多,推荐设置为 5
|
||||
|
||||
</Route>
|
||||
|
||||
## 孔夫子旧书网
|
||||
|
||||
### 用户动态
|
||||
|
||||
<Route author="nczitzk" example="/kongfz/people/5032170" path="/kongfz/people/:id" :paramsDesc="['用户 id, 可在对应用户页 URL 中找到']"/>
|
||||
|
||||
## 飘天文学
|
||||
|
||||
### 章节
|
||||
|
||||
@@ -3124,6 +3124,9 @@ router.get('/fjnews/fz/30', require('./routes/fjnews/fznews'));
|
||||
// 九江新闻jjnews
|
||||
router.get('/fjnews/jjnews', require('./routes/fjnews/jjnews'));
|
||||
|
||||
// 孔夫子旧书网
|
||||
router.get('/kongfz/people/:id', require('./routes/kongfz/people'));
|
||||
|
||||
// 小刀娱乐网
|
||||
router.get('/x6d/:id?', require('./routes/x6d/index'));
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const userUrl = `https://t.kongfz.com/api/getFeedList?userId=${ctx.params.id}&size=20`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: userUrl,
|
||||
});
|
||||
|
||||
const list = response.data.result.feedList.map((item) => ({
|
||||
title: item.title || item.postTime,
|
||||
link: `https://t.kongfz.com/detail/${item.feedId}`,
|
||||
description: item.type === 'text' ? item.content : `<a href="https://t.kongfz.com/detail/${item.feedId}">商品上架</a>`,
|
||||
pubDate: new Date(item.postDateTime).toUTCString(),
|
||||
}));
|
||||
|
||||
const userInfo = response.data.result.userInfo;
|
||||
|
||||
ctx.state.data = {
|
||||
title: `孔夫子旧书网 - ${userInfo.nickname}`,
|
||||
link: userInfo.shareUrl,
|
||||
item: list,
|
||||
description: `${userInfo.sign}`,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user