popular-shop.js
1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/**
* desc: 店铺装修----红人店铺
*/
'use strict';
const api = global.yoho.API;
const singleAPI = global.yoho.SingleAPI;
/**
* 频道
* @type {{}}
*/
const yhChannel = {
boys: 1,
girls: 2,
kids: 3,
lifestyle: 4
};
/**
* 获取红人店铺 banner
* doc: http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/商品列表/店铺装修.md
* @param int shopId 店铺id
*/
exports.getBanner = shopId => {
let params = {
method: 'app.popular.shop.banner',
shop_id: shopId
};
return api.get('', params, {cache: true, code: 200});
};
/**
* 获取店铺 介绍
* @param int shopId 店铺id
*/
exports.getIntro = shopId => {
let params = {
method: 'app.shops.getIntro',
shop_id: shopId
};
return api.get('', params, {cache: true, code: 200});
};
/**
* 查询红人店铺对应的装修元素
*
* @param int shopId 店铺id
*/
exports.getShopsdecorator = shopId => {
let params = {
method: 'app.popular.shopsdecorator',
shop_id: shopId
};
return api.get('', params, {cache: true, code: 200});
};
/**
* 获取店铺下面的所有分类
* @param {int} shopId 店铺id
* @param {string} channel 频道
* @return array
*/
exports.getShopCategory = (shopId, channel) => {
return api.get('', {
method: 'app.shop.getSortInfo',
yh_channel: yhChannel[channel],
shop_id: shopId
});
};
/**
* 店铺收藏数量
*/
exports.favCount = (shopId, uid, channel, udid) => {
return singleAPI.get('favorite', {
method: 'app.favorite.queryFavoriteCountByShopIds',
favIds: shopId,
type: 'shop',
udid: udid,
uid: uid,
physical_channel: yhChannel[channel],
});
};