article.js 575 Bytes
/**
 * 文章controller
 * @author: leo <qi.li@yoho.cn>
 * @date: 23/06/2017
 */
const mysqlCli = global.yoho.utils.mysqlCli;

const TABLE_ACT_ARTICLE = 'act_article';

function all(req, res) {
    mysqlCli.changeDatabase(mysqlCli.database).then(() => {
        mysqlCli.query(`select * from ${TABLE_ACT_ARTICLE}`)
            .then(result => {
                res.json({
                    code: 200,
                    data: {
                        total: result.length
                    }
                });
            });
    });
}

module.exports = {
    all
};