From f1f86f709a0ddad02c82bd1aa55e0749174b4e58 Mon Sep 17 00:00:00 2001 From: xuluna <10015938+xuluna@users.noreply.github.com> Date: Wed, 29 Apr 2020 02:09:08 -0400 Subject: [PATCH] feat: add route for uniqlo styling book - woman (#4585) --- docs/shopping.md | 16 +++++++++++++--- lib/router.js | 3 +++ lib/routes/uniqlo/stylingbook.js | 24 ++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 lib/routes/uniqlo/stylingbook.js diff --git a/docs/shopping.md b/docs/shopping.md index ed2dca1ee9..21e4c86077 100644 --- a/docs/shopping.md +++ b/docs/shopping.md @@ -83,9 +83,9 @@ For instance, in https://www.leboncoin.fr/recherche/?**category=10&locations=Par ### 最新商品 -| 全部 | 闪购 | 秒发 | 跨境 | 尾货专场 | -| -------- | ------- | --- | ------- | ------ | -| home | shangou | miaofa | csborder | weihuo | +| 全部 | 闪购 | 秒发 | 跨境 | 尾货专场 | +| ---- | ------- | ------ | -------- | -------- | +| home | shangou | miaofa | csborder | weihuo | @@ -235,6 +235,16 @@ For instance, in https://www.leboncoin.fr/recherche/?**category=10&locations=Par +## 优衣库 + +### Stylingbook + + +| 女式 | 男式 | 小孩 | 婴儿 | +| ----- | ---- | ---- | ---- | +| women | men | kids | baby | + + ## 有赞 ### 商品上新 diff --git a/lib/router.js b/lib/router.js index 4f97f83a66..bc253e4936 100755 --- a/lib/router.js +++ b/lib/router.js @@ -2598,6 +2598,9 @@ router.get('/axis-studios/:type/:tag?', require('./routes/axis-studios/work')); // 人民邮电出版社 router.get('/ptpress/book/:type?', require('./routes/ptpress/book')); +// uniqlo styling book +router.get('/uniqlo/stylingbook/:category?', require('./routes/uniqlo/stylingbook')); + // 本地宝焦点资讯 router.get('/bendibao/news/:city', require('./routes/bendibao/news')); diff --git a/lib/routes/uniqlo/stylingbook.js b/lib/routes/uniqlo/stylingbook.js new file mode 100644 index 0000000000..c3b03c62a5 --- /dev/null +++ b/lib/routes/uniqlo/stylingbook.js @@ -0,0 +1,24 @@ +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const category = ctx.params.category ? ctx.params.category : 'women'; + const url = `https://style.uniqlo.com/api/v2/styleSearch.json?dptId=${category}&lang=en&limit=50&locale=my&offset=0`; + + const response = await got({ + method: 'get', + url: url, + }); + + const data = response.data.result.styles; + + ctx.state.data = { + title: `Uniqlo styling book`, + link: `https://www.uniqlo.com/my/stylingbook/pc/${category}`, + description: `Uniqlo styling book`, + item: data.map((item) => ({ + title: item.styleId, + description: ``, + link: `https://www.uniqlo.com/my/stylingbook/pc/style/` + item.styleId, + })), + }; +};