增加: 淘宝众筹 (#1389)

Closes #1364
This commit is contained in:
凉凉
2019-01-14 00:24:05 +08:00
committed by DIYgod
parent c83de01bfd
commit c495afb92c
3 changed files with 61 additions and 0 deletions

View File

@@ -2207,6 +2207,16 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运
</route> </route>
### 淘宝众筹
<route name="众筹项目" author="xyqfer" example="/taobao/zhongchou/all" path="/taobao/zhongchou/:type?" :paramsDesc="['类型, 默认为 `all` 全部']">
| 全部 | 科技 | 食品 | 动漫 | 设计 | 公益 | 娱乐 | 影音 | 书籍 | 游戏 | 其他 |
| ---- | ---- | ----------- | ---- | ------ | ---- | ---- | ----- | ---- | ---- | ----- |
| all | tech | agriculture | acg | design | love | tele | music | book | game | other |
</route>
## 游戏资讯 ## 游戏资讯
### 3DMGame ### 3DMGame

View File

@@ -956,4 +956,8 @@ router.get('/qdaily', require('./routes/qdaily/index'));
// 京东众筹 // 京东众筹
router.get('/jingdong/zhongchou/:type/:status/:sort', require('./routes/jingdong/zhongchou')); router.get('/jingdong/zhongchou/:type/:status/:sort', require('./routes/jingdong/zhongchou'));
// 淘宝众筹
router.get('/taobao/zhongchou/:type?', require('./routes/taobao/zhongchou'));
module.exports = router; module.exports = router;

View File

@@ -0,0 +1,47 @@
const axios = require('../../utils/axios');
module.exports = async (ctx) => {
const { type = 'all' } = ctx.params;
const map = {
all: '',
tech: '121288001',
agriculture: '123330001,125672021',
acg: '122018001',
design: '121292001,126176002,126202001',
love: '121280001',
tele: '121284001',
music: '121278001',
book: '121274002',
game: '122020001',
other: '125706031,125888001,125886001,123332001',
};
const url = `https://izhongchou.taobao.com/dream/ajax/getProjectList.htm?page=1&pageSize=20&projectType=${encodeURIComponent(map[type])}&type=6&status=&sort=1&_ksTS=${Date.now()}_104&callback=`;
const response = await axios({
method: 'get',
url: url,
});
const items = response.data.data.map((item) => {
const title = item.name;
const link = `https://izhongchou.taobao.com/dreamdetail.htm?id=${item.id}`;
const description = `
<img referrerpolicy="no-referrer" src="https:${item.image}"><br><br>
<strong>达成率:</strong> ${item.finish_per}%<br>
<strong>已筹金额:</strong> ${item.curr_money}元<br>
<strong>支持人数:</strong> ${item.buy_amount}<br>
`;
return {
title,
link,
description,
guid: item.id,
};
});
ctx.state.data = {
title: `淘宝众筹-${type}`,
link: 'https://izhongchou.taobao.com/index.htm',
item: items,
};
};