feat: 添加 FF14 国际服新闻及通知(Lodestone) (#5944)

Co-authored-by: Harry Cheng <i@reimu.moe>
This commit is contained in:
Harry Cheng
2020-10-19 15:29:48 +01:00
committed by GitHub
co-authored by Harry Cheng
parent 8a92dbbd59
commit b0ebd5e2b8
3 changed files with 48 additions and 1 deletions
+16 -1
View File
@@ -490,12 +490,27 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的
### 最终幻想 14 国服
<Route author="Kiotlin" example="/ff14/ff14_zh/news" path="/ff14/ff14_zh/:type" :paramsDesc="['分类名']"/>
<Route author="Kiotlin" example="/ff14/ff14_zh/news" path="/ff14/ff14_zh/:type" :paramsDesc="['分类名']">
| 新闻 | 公告 | 活动 | 广告 | 所有 |
| ---- | -------- | ------ | --------- | ---- |
| news | announce | events | advertise | all |
</Route>
### 最终幻想 14 国际服 (Lodestone)
<Route author="chengyuhui" example="/ff14/ff14_global/na/all" path="/ff14/ff14_global/:lang/:type" :paramsDesc="['地区', '分类名']">
| 北美 | 欧洲(英语) | 法国 | 德国 | 日本 |
| ---- | ------------ | ---- | ---- | ---- |
| na | eu | fr | de | jp |
| 话题 | 公告 | 维护 | 更新 | 服务状态 | 开发者博客 |
| ------ | ------- | ----------- | ------- | -------- | ---------- |
| topics | notices | maintenance | updates | status | developers |
</Route>
## きららファンタジア|奇拉拉幻想曲
### 公告
+1
View File
@@ -1890,6 +1890,7 @@ router.get('/arknights/news', require('./routes/arknights/news'));
// ff14
router.get('/ff14/ff14_zh/:type', require('./routes/ff14/ff14_zh'));
router.get('/ff14/ff14_global/:lang/:type', require('./routes/ff14/ff14_global'));
// 学堂在线
router.get('/xuetangx/course/:cid/:type', require('./routes/xuetangx/course_info'));
+31
View File
@@ -0,0 +1,31 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const type = ctx.params.type;
const lang = ctx.params.lang;
const response = await got({
method: 'get',
url: `http://${lang}.lodestonenews.com/news/${type}`,
});
let data;
if (type === 'all') {
data = [];
Object.values(response.data).forEach((arr) => (data = data.concat(arr)));
} else {
data = response.data;
}
ctx.state.data = {
title: `FFXIV Lodestone updates (${type})`,
link: `https://${lang}.finalfantasyxiv.com/lodestone/news/`,
item: data.map(({ id, url, title, time, description, image }) => ({
title,
link: url,
description: `<img src="${image}"><br>${description}<br>`,
pubDate: time,
guid: id,
})),
};
};