channel-gender.js 479 Bytes
'use strict';

const path = require('path');
const utilsPath = path.join(global.utils, '/constant');
const channelDict = require(utilsPath).channelDict;


// 如果 没有 gender, 根据channel,设置gender
// Notice: 如果 没有 channel,则不设 gender
exports.channelGender = (req, res, next) => {
    if (!req.query.hasOwnProperty('gender')) {
        const channel = channelDict(req.yoho.channel);

        channel && (req.query.gender = channel);
    }

    next();
};