增加:旅法师营地-各类游戏资讯 (#982)

- 实现--> #876
- 增加文档分类:游戏资讯
将 3DMGame 和 旅法师营地 归于此类
This commit is contained in:
Shadow
2018-10-28 01:50:39 +08:00
committed by DIYgod
parent 72d0f1f707
commit 16c4361a27
3 changed files with 74 additions and 12 deletions

View File

@@ -1693,6 +1693,34 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运
<route name="新品" author="xyqfer" example="/westore/new" path="/westore/new"/>
## 游戏资讯
### 3DMGame
<route name="新闻中心" author="zhboner" example="/3dm/news" path="/3dm/news"/>
<route name="游戏资讯" author="sinchang jacky2001114 HenryQW" example="/3dm/detroitbecomehuman/news" path="/3dm/:name/:type" :paramsDesc="['游戏的名字, 可以在专题页的 url 中找到', '资讯类型']">
| 新闻 | 攻略 | 下载资源 | 区块链快讯 |
| ---- | ---- | -------- | ---------- |
| news | gl | resource | blockchain |
</route>
### 旅法师营地
<route name="旅法师营地" author="qwertyuiop6" example="/lfsyd/1" path="/lfsyd/:typecode" :paramsDesc="['订阅分区类型']">
| 主页资讯 | 炉石传说 | 万智牌 | 昆特牌 | 游戏王  |  电子游戏 |  手机游戏 |  桌面游戏 |
| -------- | -------- | ------ | ------ | -------- | ---------- | ---------- | ---------- |
| 1 | 2 | 3 | 14 | 16 | 4 | 22 | 9 |
| 影之诗 | Artifact   | 玩家杂谈 | 营地电台  | 2047   | 魂武 |
| ------ | ----------- | -------- | ---------- | ------- | ---- |
| 17 | 67 | 21 | 5 | 62 | 68 |
</route>
## 小说·文学·阅读
### 观止(每日一文)
@@ -1881,18 +1909,6 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运
</route>
### 3DMGame
<route name="新闻中心" author="zhboner" example="/3dm/news" path="/3dm/news"/>
<route name="游戏资讯" author="sinchang jacky2001114 HenryQW" example="/3dm/detroitbecomehuman/news" path="/3dm/:name/:type" :paramsDesc="['游戏的名字, 可以在专题页的 url 中找到', '资讯类型']">
| 新闻 | 攻略 | 下载资源 | 区块链快讯 |
| ---- | ---- | -------- | ---------- |
| news | gl | resource | blockchain |
</route>
### 机核网
<route name="分类" author="MoguCloud" example="/gcores/category/1" path="/gcores/category/:category" :paramsDesc="['分类名']">

View File

@@ -323,6 +323,9 @@ router.get('/nytimes/morning_post', require('./routes/nytimes/morning_post'));
router.get('/3dm/:name/:type', require('./routes/3dm/game'));
router.get('/3dm/news', require('./routes/3dm/news_center'));
// 旅法师营地
router.get('/lfsyd/:typecode', require('./routes/lfsyd/index'));
// 喜马拉雅
router.get('/ximalaya/album/:classify/:id', require('./routes/ximalaya/album'));
router.get('/ximalaya/album/:id', require('./routes/ximalaya/album'));

43
routes/lfsyd/index.js Normal file
View File

@@ -0,0 +1,43 @@
const axios = require('../../utils/axios');
module.exports = async (ctx) => {
const code_dict = {
'1': 'home',
'2': 'heartstone',
'3': 'mtg',
'4': 'videogame',
'17': 'verse',
'16': 'yugioh',
'67': 'artifact',
'62': 'twozerofortyseven',
'9': 'boardgame',
'22': 'mobilegame',
'21': 'yingdi',
'5': 'yingdistation',
'68': 'hunwu',
'14': 'gwent',
};
const host = 'https://www.iyingdi.com';
const game = code_dict[ctx.params.typecode];
const seed = `${game === 'home' ? 'daily/direction?direction=before&date=-1' : 'seed/v2?web=1&seed='}`;
const url = `${host}/feed/list/${seed}${ctx.params.typecode}&system=web`;
const response = await axios.get(url);
const feeds = response.data.feeds;
const items = feeds.map((element) => {
const date = new Date(element.feed.created * 1000);
const video = element.feed.clazz === 'video' ? 'clazz=video&' : '';
return {
title: element.feed.title,
description: element.feed.description,
pubDate: `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`,
link: `${host}/web/article/${game}/${element.feed.sourceID.split('/')[0]}?${video}title=${encodeURI(element.feed.seedTitle)}&remark=seed`,
};
});
ctx.state.data = {
title: `旅法师营地 -${ctx.params.typecode === '1' ? '首页资讯' : feeds['0'].feed.seedTitle}`,
link: `${url}`,
item: items,
};
};