From c495afb92c76e345c7fe8db51df38d25ebed5e42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=89=E5=87=89?= Date: Mon, 14 Jan 2019 00:24:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0:=20=E6=B7=98=E5=AE=9D?= =?UTF-8?q?=E4=BC=97=E7=AD=B9=20(#1389)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #1364 --- docs/README.md | 10 ++++++++ lib/router.js | 4 +++ lib/routes/taobao/zhongchou.js | 47 ++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 lib/routes/taobao/zhongchou.js diff --git a/docs/README.md b/docs/README.md index 88b70e01a4..c1d6982b2f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2207,6 +2207,16 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运 +### 淘宝众筹 + + + +| 全部 | 科技 | 食品 | 动漫 | 设计 | 公益 | 娱乐 | 影音 | 书籍 | 游戏 | 其他 | +| ---- | ---- | ----------- | ---- | ------ | ---- | ---- | ----- | ---- | ---- | ----- | +| all | tech | agriculture | acg | design | love | tele | music | book | game | other | + + + ## 游戏资讯 ### 3DMGame diff --git a/lib/router.js b/lib/router.js index 29bd3e006c..f08a217901 100644 --- a/lib/router.js +++ b/lib/router.js @@ -956,4 +956,8 @@ router.get('/qdaily', require('./routes/qdaily/index')); // 京东众筹 router.get('/jingdong/zhongchou/:type/:status/:sort', require('./routes/jingdong/zhongchou')); + +// 淘宝众筹 +router.get('/taobao/zhongchou/:type?', require('./routes/taobao/zhongchou')); + module.exports = router; diff --git a/lib/routes/taobao/zhongchou.js b/lib/routes/taobao/zhongchou.js new file mode 100644 index 0000000000..fc40a7902f --- /dev/null +++ b/lib/routes/taobao/zhongchou.js @@ -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 = ` +

+ 达成率: ${item.finish_per}%
+ 已筹金额: ${item.curr_money}元
+ 支持人数: ${item.buy_amount}
+ `; + + return { + title, + link, + description, + guid: item.id, + }; + }); + + ctx.state.data = { + title: `淘宝众筹-${type}`, + link: 'https://izhongchou.taobao.com/index.htm', + item: items, + }; +};