list.js
1.15 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
/**
* product list Model
*/
'use strict';
const path = require('path');
const api = global.yoho.API;
const camelCase = global.yoho.camelCase;
const prettyFilter = require(path.join(global.utils, '/beautify/filters'));
const processProductList = require(path.join(global.utils, '/beautify/product')).processProductList;
let list = {
/**
* 商品搜索
* @param {[type]} params [description]
* @return {[type]} [description]
*/
search(params) {
return api.post('', {
method: 'app.search.sales',
limit: 4,
saleType: 2,
yh_channel: 3
}, {
cache: true,
code: 200
})
.then(result => {
prettyFilter(result.data.filter);
result.data.productList = processProductList(result.data.productList);
result = camelCase(result);
return result;
});
},
getFilters(params) {
return api.post('', {
method: 'app.search.sales'
}, {
cache: true,
code: 200
})
.then(result => {
});
}
};
module.exports = list;