Blame view

apps/3party/controllers/activate.js 938 Bytes
王水玲 authored
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
/**
 * 激活点击统计 controller
 * @author: wsl<shuiling.wang@yoho.cn>
 * @date: 2017/03/21
 */

'use strict';

const Model = require('../models/activate');

const index = (req, res, next) => {
    let uid = req.user.uid;

    Model.canLogin(uid).then(canLogin => {
        if (canLogin === 'N') {
            return next();
        } else {
            res.render('activate', {
                module: '3party',
                page: 'activate',
                layout: false
            });
        }
    }).catch(next);
};

const getList = (req, res, next) => {
    let uid = req.user.uid;

    Model.getList({
        uid: uid,
        activateTimeBegin: req.query.startTime ? req.query.startTime + ' 00:00:00' : '',
        activateTimeEnd: req.query.endTime ? req.query.endTime + ' 23:59:59' : ''
    }).then(result => {
        res.json(result.data.list);
    }).catch(next);
};


module.exports = {
    index,
    getList
};