activity.yohoCoinActivity.js 1.87 KB
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;
}