resouces.js
1.09 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
/**
* 资源位查询
*
* @author: jiangfeng<jeff.jiang@yoho.cn>
*/
'use strict';
const api = global.yoho.ServiceAPI;
const logger = global.yoho.logger;
const Resources = {
/**
* 获取新品到着-列表页-banner 资源位
* @returns {Promise.<T>}
*/
newProductBanner(channel) {
let codes = {
men: '3d3127b220073fbcda738c8ba26561e5',
women: '2aaf9519b31d1f21c537032f496e7450',
lifestyle: '422bfdb9b410598e11c3e72bd4ee664e'
};
let params = {
content_code: codes[channel]
};
return api.get('/operations/api/v5/resource/get', params).then(result => {
if (result && result.code === 200 && result.data) {
let data = result.data;
if (data.length > 0) {
let d = data[0].data;
return d ? d[0] : {};
}
}
return {};
}).catch(e => {
logger.error('get new product list banner error', e);
return {};
});
}
};
module.exports = Resources;