seckill-detail.js
1.02 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
/**
* [商品获取数据]
*/
'use strict';
const _ = require('lodash');
const api = global.yoho.API;
const newDetail = {
/**
* 获取秒杀列表
*/
getSeckillData(param) {
let params = {
method: 'app.seckill.data',
product_skn: param.productskn
};
return api.get('', params, {
code: 200
})
// mock
.catch()
.then(result => {
let data = {};
if (result.data) {
data = result.data;
if (data.storageSum > 0) {
data.storageSum = 1;
}
if (data.secKillSku) {
_.forEach(data.secKillSku, item => {
if (item.storageNum > 0) {
item.storageNum = 1;
}
});
}
} else {
data.status = 0;
}
return data;
});
}
};
module.exports = newDetail;