common.js
636 Bytes
/**
* 公共服务
* @author: leo <qi.li@yoho.cn>
* @date: 11/10/2018
*/
const Common = require('../models/common');
const commonController = {
async getResource(req, res, next) {
const {contentCode} = req.query;
try {
let result = await req.ctx(Common).resource(contentCode);
if (result.code === 200) {
return res.json({
code: 200,
data: result.data,
message: '获取成功'
});
}
} catch (e) {
next();
}
}
};
module.exports = commonController;