feat: add route for uniqlo styling book - woman (#4585)

This commit is contained in:
xuluna
2020-04-29 02:09:08 -04:00
committed by GitHub
parent d48150562f
commit f1f86f709a
3 changed files with 40 additions and 3 deletions

View File

@@ -83,9 +83,9 @@ For instance, in https://www.leboncoin.fr/recherche/?**category=10&locations=Par
### 最新商品
<Route author="MeXunco" example="/wineyun/home" path="/wineyun/:category" :paramsDesc="['分类名']" >
| 全部 | 闪购 | 秒发 | 跨境 | 尾货专场 |
| -------- | ------- | --- | ------- | ------ |
| home | shangou | miaofa | csborder | weihuo |
| 全部 | 闪购 | 秒发 | 跨境 | 尾货专场 |
| ---- | ------- | ------ | -------- | -------- |
| home | shangou | miaofa | csborder | weihuo |
</Route>
@@ -235,6 +235,16 @@ For instance, in https://www.leboncoin.fr/recherche/?**category=10&locations=Par
<Route author="HenryQW" example="/ikea/uk/offer" path="/ikea/uk/offer"/>
## 优衣库
### Stylingbook
<Route author="LunaXu" example="/uniqlo/stylingbook/women" path="/uniqlo/stylingbook/:category?" :paramsDesc="['类别']">
| 女式 | 男式 | 小孩 | 婴儿 |
| ----- | ---- | ---- | ---- |
| women | men | kids | baby |
</Route>
## 有赞
### 商品上新

View File

@@ -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'));

View File

@@ -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: `<img src="${item.styleImgUrl}">`,
link: `https://www.uniqlo.com/my/stylingbook/pc/style/` + item.styleId,
})),
};
};