activity.yohoCoinActivity.js
1.87 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
module.exports = function (app) {
app.get("/activity/yohocoin/index", "activity.yohocoin.Index", function (req, res) {
this.$extend = {
moduleName:"运营管理",
pageName:"有货币领取"
}
});
app.get("/activity/yohocoin/add", "activity.yohocoin.Edit", function (req, res) {
this.$extend = {
moduleName:"运营管理",
pageName:"有货币领取设置",
action:'/yohoCoinActivity/saveOrUpdateYohoCoinActivity'
}
});
app.get("/activity/yohocoin/update/:id", "activity.yohocoin.Edit", "yohoCoinActivity_getYohoCoinActivity", function (rs,req,res) {
// 日期处理
rs.data.beginTimeStr = toDate(rs.data.beginTime);
rs.data.endTimeStr = toDate(rs.data.endTime);
this.$extend = {
moduleName:"运营管理",
pageName:"有货币领取设置",
action : '/yohoCoinActivity/saveOrUpdateYohoCoinActivity',
data: rs.data
}
});
// 列表
app.post("/yohoCoinActivity/getYohoCoinActivityList", "yohoCoinActivity_getYohoCoinActivityList");
// 详情
app.post("/yohoCoinActivity/getYohoCoinActivity", "yohoCoinActivity_getYohoCoinActivity");
// 新增更新
app.post("/yohoCoinActivity/saveOrUpdateYohoCoinActivity", "yohoCoinActivity_saveOrUpdateYohoCoinActivity");
//关闭活动
app.post("/yohoCoinActivity/delYohoCoinActivity","yohoCoinActivity_delYohoCoinActivity");
}
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()) + ' ' + fixTwo(date.getHours()) + ':' + fixTwo(date.getMinutes()) + ':' + fixTwo(date.getSeconds());
}
function fixTwo(number) {
return number < 10? "0" + number: number;
}