preference.js 789 Bytes
/*
 * @Author: Targaryen
 * @Date:   2016-05-18 11:42:11
 * @Last Modified by:   Targaryen
 * @Last Modified time: 2016-05-30 13:48:17
 */

'use strict';
const _ = require('lodash');
const productProcess = require(`${global.utils}/product-process`);

const api = global.yoho.API;

module.exports = (data) => {
    let finalResult;

    return api.get('', {
        method: 'h5.preference.Search',
        productskn: data.productskn,
        yhchannel: data.yhchannel,
        brandId: data.brandId
    }).then(result => {
        if (!_.isEmpty(result) && result.code === 200) {
            // 为你优选数据处理,接口没有数据,待处理,待验证
            finalResult = productProcess.processProductList(result.data);
        }

        return finalResult;
    });
};