index.js 521 Bytes
'use strict';

const headerModel = require('../../../doraemon/models/header');

const headerNav = (req, res, next) => {
    let channel = req.query.channel || req.yoho.channel;

    headerModel.getHeaderSubNav(channel).then(result => {
        let resData = {code: 400};

        if (result && result.length) {
            Object.assign(resData, {
                code: 200,
                data: result[0]
            });
        }

        res.send(resData);
    }).catch(next);
};

module.exports = {
    headerNav
};