detail.js 1.04 KB
/**
 *
 * @author: Aiden Xu<aiden.xu@yoho.cn>
 * @date: 2016/07/25
 */
'use strict';

// const _ = require('lodash');

// const helpers = global.yoho.helpers;
const serviceAPI = global.yoho.ServiceAPI;
const URI_PACKAGE_ARTICLE = 'guang/service/v2/article/';
const Prmoise = require('bluebird');
const camelCase = global.yoho.camelCase;

/**
 * 资讯详情
 */
const model = {
    index(params) {
        return Prmoise.coroutine(function*() {
            const article = yield serviceAPI.get(URI_PACKAGE_ARTICLE + 'getArticle', params);
            const content = yield serviceAPI.get(URI_PACKAGE_ARTICLE + 'getArticleContent', params);
            const brands = yield serviceAPI.get(URI_PACKAGE_ARTICLE + 'getBrand', params);
            const other = yield serviceAPI.get(URI_PACKAGE_ARTICLE + 'getOtherArticle', Object.assign({
                tags: article.data.tag,
                offset: 0,
                limit: 3
            }, params));

            return camelCase([article, content, brands, other]);
        })();
    }
};

module.exports = model;