product.productBundle.js
1.88 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
module.exports = function (app) {
app.get("/product/bundle/index", "product.productBundle.Index", function(req, res) {
this.$extend = {
moduleName: "营销管理",
pageName: "套餐管理"
}
});
app.get("/product/bundle/add", "product.productBundle.Edit", function(req, res) {
this.$extend = {
moduleName: "营销管理",
pageName: "增加套餐",
action: "/product/bundle/save"
}
});
app.get("/product/bundle/import", "product.productBundle.Import", function(req, res) {
this.$extend = {
moduleName: "营销管理",
pageName: "套餐导入"
}
});
app.get("/product/bundle/:id", "product.productBundle.Edit", "productBundle_findProductBundleByID", function(apiReq) {
// 日期处理
apiReq.data.beginTimeStr = toDate(apiReq.data.startTime);
apiReq.data.endTimeStr = toDate(apiReq.data.endTime);
if (apiReq.data.productSkn) {
apiReq.data.skns = apiReq.data.productSkn.split(",");
}
this.$extend = {
moduleName: "营销管理",
pageName: "编辑套餐",
action: "/product/bundle/save",
data: apiReq.data
}
});
app.post("/product/bundle/list", "productBundle_productBundleList");
app.post("/product/bundle/stop", "productBundle_productBundleStop");
app.post("/product/bundle/save", "productBundle_productBundleSaveOrUpdate");
app.post("/product/bundle/sync", "productBundle_syncProductBundleToFront");
}
function toDate(seconds) {
if (!seconds || seconds <= 0) { return ''; }
var date = new Date(seconds * 1000);
return fixTwo(date.getFullYear()) + '-' + fixTwo((date.getMonth() + 1)) + '-' + fixTwo(date.getDate());
}
function fixTwo(number) {
return number < 10? "0" + number: number;
}