similar.js
980 Bytes
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
'use strict';
const utils = '../../../utils';
const _ = require('lodash');
const productProcess = require(`${utils}/product-process`);
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
list(params) {
let options = {
data: {
method: 'app.search.findLike',
product_skn: params.skn
},
param: {
code: 200
}
};
return this.get(options).then(result => {
let resu = {
goodInfo: [],
list: []
};
if (_.get(result, 'data', false)) {
resu.goodInfo = productProcess.processProductList(result.data);
}
if (_.get(result, 'data.product_list', false)) {
resu.list = productProcess.processProductList(result.data.product_list);
}
return resu;
});
}
};