redshop-process.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
/*
* @Author: Targaryen
* @Date: 2017-03-23 11:02:31
* @Last Modified by: Targaryen
* @Last Modified time: 2017-03-23 14:19:26
*/
/* 红人店铺数据处理 */
const _ = require('lodash');
/**
* 红人店铺楼层数据处理工具
*/
const _tools = {
carouselImage(data) {
return data;
},
title(data) {
return data;
},
singleImage(data) {
return data;
},
doubleImage(data) {
return data;
},
tripleImage(data) {
return data;
},
sknList(data) {
return data;
}
};
/**
* 处理红人店铺楼层
* @param {*} decoratorsData
*/
const floor = (decoratorsData) => {
let finalData = [];
_.forEach(decoratorsData, value => {
switch (value.module_type) {
case 'CarouselImage':
finalData.push(_tools.carouselImage(value.data));
break;
case 'Title':
finalData.push(_tools.title(value.data));
break;
case 'SingleImage':
finalData.push(_tools.singleImage(value.data));
break;
case 'DoubleImage':
finalData.push(_tools.doubleImage(value.data));
break;
case 'TripleImage':
finalData.push(_tools.tripleImage(value.data));
break;
case 'SknList':
finalData.push(_tools.sknList(value.data));
break;
default:
break;
}
});
return finalData;
};
const shopIntro = (params) => {
if (params) {
params.short_intro = _.get(params, 'shop_intro', '').replace(/<.*?>/g, '');
}
return params;
};
module.exports = {
floor,
shopIntro
};