Blame view

apps/home/controllers/grade-new.js 2.84 KB
lijing 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
'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);
};
lijing authored
29
lijing authored
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
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);
};
lijing authored
53
exports.grow = (req, res, next) => {
lijing authored
54 55 56 57 58 59 60 61 62 63 64 65
    let responseData = {
        module: 'home',
        page: 'grade-new',
        pageHeader: headerModel.setNav({
            navTitle: '成长记录'
        }),
        title: '成长记录',
        width750: true,
        localCss: true,
        pageFooter: true
    };
lijing authored
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
    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);
lijing authored
85
};
郭成尧 authored
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104

/**
 * 会员升级引导页面
 */
exports.upgrade = (req, res) => {
    let responseData = {
        module: 'home',
        page: 'grade-new',
        pageHeader: headerModel.setNav({
            navTitle: '会员等级'
        }),
        title: '会员等级',
        width750: true,
        localCss: true,
        pageFooter: true
    };

    res.render('grade-new/upgrade', responseData);
};
郭成尧 authored
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123

/**
 * 会员升级引导页面 for app
 */
exports.upgradeApp = (req, res) => {
    let responseData = {
        module: 'home',
        page: 'grade-app',
        pageHeader: headerModel.setNav({
            navTitle: '会员等级'
        }),
        title: '会员等级',
        width750: true,
        localCss: true,
        pageFooter: true
    };

    res.render('grade-new/upgrade-app', responseData);
};