grade-new.js 2.04 KB
'use strict';

const mRoot = '../models';
const headerModel = require('../../../doraemon/models/header'); // 头部model
const gradeNewModel = require(`${mRoot}/grade-new`);

exports.index = (req, res, next) => {
    let responseData = {
        module: 'home',
        page: 'grade-new',
        pageHeader: headerModel.setNav({
            navTitle: '会员等级'
        }),
        title: '会员等级',
        width750: true,
        localCss: true,
        pageFooter: true
    };

    let params = {
        uid: req.user.uid,
        channel: req.query.channel || 1
    };

    req.ctx(gradeNewModel).index(params).then(result => {
        res.render('grade-new/index', Object.assign(responseData, result));
    }).catch(next);
};

exports.content = (req, res, next) => {
    let responseData = {
        module: 'home',
        page: 'grade-new',
        pageHeader: headerModel.setNav({
            navTitle: '会员等级'
        }),
        title: '会员等级',
        width750: true,
        localCss: true,
        pageFooter: true
    };

    let params = {
        uid: req.user.uid,
        channel: req.query.channel || 1
    };

    req.ctx(gradeNewModel).index(params).then(result => {
        res.render('grade-new/content', Object.assign(responseData, result));
    }).catch(next);
};

exports.grow = (req, res, next) => {
    let responseData = {
        module: 'home',
        page: 'grade-new',
        pageHeader: headerModel.setNav({
            navTitle: '成长记录'
        }),
        title: '成长记录',
        width750: true,
        localCss: true,
        pageFooter: true
    };

    let params = {
        uid: req.user.uid,
        page: 1
    };

    req.ctx(gradeNewModel).grow(params).then(result => {
        res.render('grade-new/grow', Object.assign(responseData, result));
    }).catch(next);
};

exports.getHis = (req, res, next) => {
    let params = {
        uid: req.user.uid,
        page: req.query.page
    };

    req.ctx(gradeNewModel).getHisAjax(params).then(result => {
        res.json(result);
    }).catch(next);
};