channel.js 761 Bytes
'use strict';
const api = global.yoho.ServiceAPI;
const contentCode = require('../../../config/content-code');
const resourcesProcess = require('../../../utils/resources-process');

let channel = {
    getResourcesData(params) {
        let code;

        if (params.channel) {
            code = contentCode.channel[params.channel];
        } else if (params.contentCode) {
            code = params.contentCode;
        } else {
            code = contentCode.channel.men;
        }
        return api.get('operations/api/v5/resource/get', {
            content_code: code
        }, {
            cache: true,
            code: 200
        }).then(result => {
            return resourcesProcess(result.data);
        });
    }
};

module.exports = channel;