feat: add lkong digest (#3132)

This commit is contained in:
hoilc
2019-09-25 12:03:03 +08:00
committed by DIYgod
parent aeca3bd1cf
commit 991d9ff551
3 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -81,7 +81,7 @@ pageClass: routes
### 分区
<Route author="ma6254" example="/lkong/forum/60" path="/lkong/forum/:id?" :paramsDesc="['分区 id, 可在分区的URL里找到']"/>
<Route author="ma6254" example="/lkong/forum/60" path="/lkong/forum/:id/:digest?" :paramsDesc="['分区 id, 可在分区的URL里找到','默认获取全部主题,任意值则只获取精华主题']"/>
### 帖子
+1 -1
View File
@@ -1594,7 +1594,7 @@ router.get('/yidoutang/case/:type', require('./routes/yidoutang/case.js'));
router.get('/kaiyan/index', require('./routes/kaiyan/index'));
// 龙空
router.get('/lkong/forum/:id', require('./routes/lkong/forum'));
router.get('/lkong/forum/:id/:digest?', require('./routes/lkong/forum'));
router.get('/lkong/thread/:id', require('./routes/lkong/thread'));
// router.get('/lkong/user/:id', require('./routes/lkong/user'));
+5 -3
View File
@@ -2,6 +2,8 @@ const got = require('@/utils/got');
module.exports = async (ctx) => {
const id = ctx.params.id;
const type_path = ctx.params.digest ? '/digest' : '';
const type_name = ctx.params.digest ? ' 精华' : '';
const response = await got({
method: 'get',
@@ -11,7 +13,7 @@ module.exports = async (ctx) => {
const response_forum_item = await got({
method: 'get',
url: `http://lkong.cn/forum/index.php?mod=data&sars=forum/${id}`,
url: `http://lkong.cn/forum/index.php?mod=data&sars=forum/${id}${type_path}`,
});
const data = response_forum_item.data;
@@ -64,8 +66,8 @@ module.exports = async (ctx) => {
);
ctx.state.data = {
title: `龙空 ${forumconfig.name}`,
link: `http://lkong.cn/forum/${id}`,
title: `龙空 ${forumconfig.name}${type_name}`,
link: `http://lkong.cn/forum/${id}${type_path}`,
description: forumconfig.blackboard,
image: `http://img.lkong.cn/forumavatar/000/00/00/${id}_avatar_middle.jpg`,
item: items,