增加:Westore-新品 (#974)

* 增加:有品-每日上新

* 修复 summary 字段错误

* 将 youpin 模块转移至 mi 目录下,并更新文档

* 增加:Westore
This commit is contained in:
凉凉 2018-10-26 11:00:58 +08:00 committed by DIYgod
parent 5b28a7263d
commit 780cbfce17
3 changed files with 47 additions and 0 deletions

View File

@ -1657,6 +1657,10 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运
</route>
### Westore
<route name="新品" author="xyqfer" example="/westore/new" path="/westore/new"/>
## 小说·文学·阅读
### 观止(每日一文)

View File

@ -689,6 +689,9 @@ router.get('/chouti/:subject?', require('./routes/chouti'));
// 西安电子科技大学
router.get('/xidian/jwc/:category?', require('./routes/xidian/jwc'));
// Westore
router.get('/westore/new', require('./routes/westore/new'));
// 优酷
router.get('/youku/channel/:channelId/:embed?', require('./routes/youku/channel'));

40
routes/westore/new.js Normal file
View File

@ -0,0 +1,40 @@
const axios = require('../../utils/axios');
module.exports = async (ctx) => {
const link = 'https://umall.vip.qq.com/v2/?_wv=1025&_wwv=4&product=32482&path=/category/list-ip&query=ip%253D20372%2526type%253Dip%2526isDetail%253D1%2526sortType%253D3#/category/list-ip?ip=20372&type=ip&isDetail=1&sortType=3';
const response = await axios({
method: 'post',
url: 'https://uapi.vip.qq.com/Api/api.brand.productssrf',
data: {
page: 1,
per_page: 20,
asc: 0,
brand_id: 20372,
sort_type: 3,
adtag2: 'search_mr',
scence: 'ipdetail',
},
headers: {
Referer: link,
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
},
});
ctx.state.data = {
title: 'Westore',
link,
description: '微信周边',
item: response.data.brands.map(({ name, img, vipprice, id }) => {
const description = `
<img src="https:${img}" referrerpolicy="no-referrer" /><br>
<strong>价格:</strong> ${+vipprice / 100}
`;
return {
title: name,
description: description,
link: `https://umall.vip.qq.com/v2/?_wv=1025&_wwv=4&product=32482&path=/product/${id}`,
};
}),
};
};