Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add zhimap #6227 #6246

Merged
merged 3 commits into from
Nov 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/study.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,16 @@ pageClass: routes

</Route>

## zhimap 思维导图社区

<Route author="laampui" example="/zhimap/820156a42e9a490796c7fd56916aa95b/1" path="/zhimap/:categoryUuid?/:recommend?" :paramsDesc="['分类 uuid,见下表,默认为33b67d1bad1d4e37812f71d42764af34', '1 为按推荐排序,0 为按最新排序,默认为 0']">

| 热门 | 学科 | 学习 | 语言 | 工作 | 提升 | 生活 | 互联网 | 教育 | 其他 | 行业 | 服务发布 | 医疗 |
| -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- |
| 33b67d1bad1d4e37812f71d42764af34 | 9434268e893a46aa9a1a231059849984 | 820156a42e9a490796c7fd56916aa95b | 959c81f606ca495c882c7e461429eb2a | 5af4bca5496e4733a2d582690627e25f | 5300988dff564756b5d462cea8a865b7 | 02fdcc2ab6374bc6b9b9717e70c87723 | 437d434fe9eb410a94dcefb889994e2b | 9747cbf78f96492c973aa6ab23925eee | d4c3a92a9cf64da7b187763211dc6ff6 | 58231ab9cef34af7819c3f6e2160c007 | 73d89972bee0457997c983d7fca19f9f | 853ce8b3a4c24b87a03f66af95c5e06c |

</Route>

## 杭州市国家普通话测试网报信息

### 考试信息
Expand Down
3 changes: 3 additions & 0 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -3512,6 +3512,9 @@ router.get('/uisdc/news', require('./routes/uisdc/news'));
router.get('/uisdc/zt/:title?', require('./routes/uisdc/zt'));
router.get('/uisdc/topic/:title?/:sort?', require('./routes/uisdc/topic'));

// Zhimap 知识导图社区
router.get('/zhimap/:categoryUuid?/:recommend?', require('./routes/zhimap/index'));

// Fantia
router.get('/fantia/search/:type?/:caty?/:peroid?/:order?/:rating?/:keyword?', require('./routes/fantia/search'));
router.get('/fantia/user/:id', require('./routes/fantia/user'));
Expand Down
37 changes: 37 additions & 0 deletions lib/routes/zhimap/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const got = require('@/utils/got');

module.exports = async (ctx) => {
const categoryUuid = ctx.params.categoryUuid || '33b67d1bad1d4e37812f71d42764af34';
const recommend = ctx.params.recommend || 0;

const title = {
'02fdcc2ab6374bc6b9b9717e70c87723': '生活',
'5af4bca5496e4733a2d582690627e25f': '工作',
'33b67d1bad1d4e37812f71d42764af34': '热门',
'73d89972bee0457997c983d7fca19f9f': '服务发布',
'437d434fe9eb410a94dcefb889994e2b': '互联网',
'853ce8b3a4c24b87a03f66af95c5e06c': '医疗',
'959c81f606ca495c882c7e461429eb2a': '语言',
'9747cbf78f96492c973aa6ab23925eee': '教育',
'58231ab9cef34af7819c3f6e2160c007': '行业',
'820156a42e9a490796c7fd56916aa95b': '学习',
'5300988dff564756b5d462cea8a865b7': '提升',
'9434268e893a46aa9a1a231059849984': '学科',
d4c3a92a9cf64da7b187763211dc6ff6: '其他',
};

const response = await got.get(`https://zhimap.com/restful/pub/publication/list?categoryUuid=${categoryUuid}&recommend=${recommend}&page=0&size=10`);

const item = response.data.data.content.map((item) => ({
author: item.author.nickname,
title: item.publicationInfo.abstracts,
pubDate: new Date(item.mindMap.createTime),
link: `https://zhimap.com/mmap/${item.mindMap.uuid}`,
}));

ctx.state.data = {
title: `Zhimap 知识导图社区 - ${title[categoryUuid]}`,
link: `https://zhimap.com/gallery`,
item,
};
};