recommend.js 788 Bytes
/**
 * 推荐商品(店铺推荐|为您优选|最近浏览)model
 * @author: wsl<shuiling.wang@yoho.cn>
 * @date: 2016/11/21
 */

'use strict';

const _ = require('lodash');
const api = global.yoho.API;
const logger = global.yoho.logger;

const getRecommendProduct = (params) => {
    params = {
        yh_channel: 4,
        udid: '0f528764d624db129b32c21fbca0cb8d6',
        limit: 5,
        rec_pos: 100003
    };

    return api.get('app.home.newPreference', params).then((data) => {
        if (data.code === 200 && data.data.length > 0) {
            console.log(data);
            return data.data;
        } else {
            logger.error('get recommend product data code is not 200');
            return [];
        }
    });
};

module.exports = {
    getRecommendProduct
};