function success(res, msg = '操作成功', data = {}, code = 200) {
    return res.status(code).json({
        code,
        msg,
        data,
    })
}

function fail(res, code = 500, msg = '服务器内部错误', data = {}) {
    return res.status(code).json({
        code,
        msg,
        data,
    })
}

module.exports = {
    success,
    fail,
}
