From fba1c40217eb24989e6fcfd5e122f9d10cf63fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=89=E5=87=89?= Date: Tue, 6 Nov 2018 19:45:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0:=20=E6=8E=A2=E7=89=A9=20(#10?= =?UTF-8?q?60)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/README.md | 4 ++++ router.js | 3 +++ routes/tanwu/products.js | 27 +++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 routes/tanwu/products.js diff --git a/docs/README.md b/docs/README.md index 66bf769c48..c9ce55613a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2195,3 +2195,7 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运 ### 搜狗 + +### 探物 + + diff --git a/router.js b/router.js index 72bad69bce..08a1f33240 100644 --- a/router.js +++ b/router.js @@ -752,4 +752,7 @@ router.get('/hko/weather', require('./routes/hko/weather')); // sankakucomplex router.get('/sankakucomplex/post', require('./routes/sankakucomplex/post')); +// 探物 +router.get('/tanwu/products', require('./routes/tanwu/products')); + module.exports = router; diff --git a/routes/tanwu/products.js b/routes/tanwu/products.js new file mode 100644 index 0000000000..3cca9b4b0e --- /dev/null +++ b/routes/tanwu/products.js @@ -0,0 +1,27 @@ +const axios = require('../../utils/axios'); + +module.exports = async (ctx) => { + const response = await axios({ + method: 'get', + url: 'https://api.tanwuapp.com/iOS/2.0.0/products?rentType=0&pageSize=1000&pageNum=1&clientType=web:h5', + }); + + const data = response.data.details.allProductList.data; + + ctx.state.data = { + title: '探物', + link: 'https://m.tanwuapp.com', + description: '探物是一个科技数码产品租赁平台,旨在把市面上最新、最酷、最实用的科技产品带去给用户,传播科技便捷生活、共享丰富生活的价值理念。', + item: data.map(({ productName, productImageSrc, productRent, rentUnit, productId, appraiseAvgScore }) => ({ + title: productName, + link: `https://m.tanwuapp.com/?source=mobile#/productDetails?productId=${productId}`, + description: ` +
+ ${productName}

+ 价格: ¥${productRent} / ${rentUnit}
+ 评分: ${appraiseAvgScore} + `, + guid: productId, + })), + }; +};