secret-switch.js 437 Bytes
/**
 * 设置cache controller
 * @author: xiaoxiao<xiaoxiao.hao@yoho.cn>
 * @date: 2016/12/21
 */

'use strict';
const cache = global.yoho.cache;

const index = (req, res, next) => {
    const param = req.query['com.yohobuy.customerservice.enabled'];
    let status = param === 'true';

    cache.set('customerServiceSwitch', status, 0).then(result => {
        res.json(result);
    }).catch(next);

};

module.exports = {
    index
};