user.js 646 Bytes
/**
 * 用户controller
 * @author: feng.chen<feng.chen@yoho.cn>
 * @date: 2017/04/13
 */
'use strict';

const Context = require('../common/context');

const userModel = require('./user-model');

class UserController extends Context {

    login(req, res, next) {
        userModel.login(this.ctx, req.body.username, req.body.password).then((result) => {
            return res.json({
                code: 200,
                data: result
            });
        }).catch(next);
    }
    logout(req, res) {
        return res.json({
            code: 200,
            data: '登出成功'
        });
    }
}

module.exports = UserController;