fix(route): ff14 修改 pubDate 为原文发布时间 (#7234)

* fix: 修改 pubDate 为原文发布时间

* refactor(route): migrate to v2

Co-authored-by: TonyRL <TonyRL@users.noreply.github.com>
This commit is contained in:
ZeroClad
2022-02-16 05:22:05 +08:00
committed by GitHub
co-authored by TonyRL
parent c15aee0d38
commit 0eb8c08a96
8 changed files with 64 additions and 16 deletions
+19
View File
@@ -62,6 +62,25 @@ Language codes
<RouteEn author="Zyx-A" example="/epicgames/freegames" path="/epicgames/freegames"/>
## FINAL FANTASY XIV
### FINAL FANTASY XIV (The Lodestone)
<RouteEn author="chengyuhui" example="/ff14/global/na/all" path="/ff14/global/:lang/:type?" :paramsDesc="['Region', 'Category, `all` by default']">
Region
| North Ameria | Europe | France | Germany | Japan |
| ------------ | ------ | ------ | ------- | ----- |
| na | eu | fr | de | jp |
Category
| all | topics | notices | maintenance | updates | status | developers |
| --- | ------ | ------- | ----------- | ------- | -------- | ---------- |
</RouteEn>
## Gamer Secret
### Latest News
+7 -6
View File
@@ -765,13 +765,13 @@ Example`https://www.iyingdi.com/tz/people/55547` id 是 `55547`
### 用户文章
<Route author="ztmzzz" example="/lolapp/article/ee97e19c-4a64-4637-b916-b9ee23744d1f" path="/lolapp/article/:uuid" :paramsDesc="['用户UUID,可在文章html中获取']"/>
<Route author="ztmzzz" example="/lolapp/article/ee97e19c-4a64-4637-b916-b9ee23744d1f" path="/lolapp/article/:uuid" :paramsDesc="['用户UUID可在文章html中获取']"/>
## 最终幻想 14
### 最终幻想 14 国服
<Route author="Kiotlin" example="/ff14/ff14_zh/news" path="/ff14/ff14_zh/:type" :paramsDesc="['分类名']">
<Route author="Kiotlin" example="/ff14/zh/news" path="/ff14/zh/:type?" :paramsDesc="['分类名,预设为 `all`']">
| 新闻 | 公告 | 活动 | 广告 | 所有 |
| ---- | -------- | ------ | --------- | ---- |
@@ -781,14 +781,15 @@ Example`https://www.iyingdi.com/tz/people/55547` id 是 `55547`
### 最终幻想 14 国际服 Lodestone
<Route author="chengyuhui" example="/ff14/ff14_global/na/all" path="/ff14/ff14_global/:lang/:type" :paramsDesc="['地区', '分类名']">
<Route author="chengyuhui" example="/ff14/global/na/all" path="/ff14/global/:lang/:type?" :paramsDesc="['地区', '分类名,预设为 `all`']">
| 北美 | 欧洲(英语) | 法国 | 德国 | 日本 |
| ---- | ------------ | ---- | ---- | ---- |
| na | eu | fr | de | jp |
| 话题 | 公告 | 维护 | 更新 | 服务状态 | 开发者博客 |
| ------ | ------- | ----------- | ------- | -------- | ---------- |
| topics | notices | maintenance | updates | status | developers |
| 所有 | 话题 | 公告 | 维护 | 更新 | 服务状态 | 开发者博客 |
| ---- | ------ | ------- | ----------- | ------- | -------- | ---------- |
| all | topics | notices | maintenance | updates | status | developers |
</Route>
+3 -3
View File
@@ -1915,9 +1915,9 @@ router.get('/arknights/japan', lazyloadRouteHandler('./routes/arknights/japan'))
// 塞壬唱片
router.get('/siren/news', lazyloadRouteHandler('./routes/siren/index'));
// ff14
router.get('/ff14/ff14_zh/:type', lazyloadRouteHandler('./routes/ff14/ff14_zh'));
router.get('/ff14/ff14_global/:lang/:type', lazyloadRouteHandler('./routes/ff14/ff14_global'));
// ff14 migrated to v2
// router.get('/ff14/ff14_zh/:type', lazyloadRouteHandler('./routes/ff14/ff14_zh'));
// router.get('/ff14/ff14_global/:lang/:type', lazyloadRouteHandler('./routes/ff14/ff14_global'));
// 学堂在线
router.get('/xuetangx/course/:cid/:type', lazyloadRouteHandler('./routes/xuetangx/course_info'));
@@ -1,8 +1,11 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
const { art } = require('@/utils/render');
const path = require('path');
module.exports = async (ctx) => {
const type = ctx.params.type;
const lang = ctx.params.lang;
const type = ctx.params.type ?? 'all';
const response = await got({
method: 'get',
@@ -23,8 +26,11 @@ module.exports = async (ctx) => {
item: data.map(({ id, url, title, time, description, image }) => ({
title,
link: url,
description: `<img src="${image}"><br>${description}<br>`,
pubDate: time,
description: art(path.join(__dirname, 'templates/description.art'), {
image,
description,
}),
pubDate: parseDate(time),
guid: id,
})),
};
@@ -1,8 +1,12 @@
const got = require('@/utils/got');
const timezone = require('@/utils/timezone');
const { parseDate } = require('@/utils/parse-date');
const { art } = require('@/utils/render');
const path = require('path');
module.exports = async (ctx) => {
const referer = 'http://ff.sdo.com/web8/index.html';
const type = ctx.params.type;
const referer = 'https://ff.sdo.com/web8/index.html';
const type = ctx.params.type ?? 'all';
const type_number = {
news: '5310',
@@ -29,8 +33,11 @@ module.exports = async (ctx) => {
item: data.map(({ Title, Summary, Author, PublishDate, HomeImagePath }) => ({
title: Title,
link: Author,
description: `<img src="${HomeImagePath}"/><br>${Summary}`,
pubDate: timezone(new Date(PublishDate), +8),
description: art(path.join(__dirname, 'templates/description.art'), {
image: HomeImagePath,
description: Summary,
}),
pubDate: timezone(parseDate(PublishDate), +8),
})),
};
};
+4
View File
@@ -0,0 +1,4 @@
module.exports = {
'/global/:lang/:type?': ['chengyuhui'],
'/zh/:type?': ['Kiotlin', 'ZeroClad', '15x15G'],
};
+7
View File
@@ -0,0 +1,7 @@
module.exports = (router) => {
router.get('/global/:lang/:type?', require('./ff14_global'));
router.get('/zh/:type?', require('./ff14_zh'));
// Deprecated
router.get('/ff14_global/:lang/:type?', require('./ff14_global'));
router.get('/ff14_zh/:type?', require('./ff14_zh'));
};
+4
View File
@@ -0,0 +1,4 @@
{{ if image }}
<img src="{{ image }}"/><br>
{{ /if }}
{{ description }}