preference.js 940 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 library = '../../../library';
const utils = '../../../utils';
const API = require(`${library}/api`).API;
const sign = require(`${library}/sign`);
const _ = require('lodash');
const productProcess = require(`${utils}/product-process`);
var api = new API();

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

    return api.get('', sign.apiSign({
        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;
    });
};