list.js 844 Bytes
/**
 *  product list Model
 */
'use strict';
const api = global.yoho.API;
const camelCase = global.yoho.camelCase;
const path = require('path');
const processProductList = require(path.join(global.utils, '/product-process')).processProductList;


let list = {

    /**
     * 商品搜索
     * @param  {[type]} params [description]
     * @return {[type]}        [description]
     */
    search(params) {
        return api.post('', {
            method: 'app.search.sales',
            limit: 4,
            saleType: 2,
            yh_channel: 3
        }, {
            cache: true,
            code: 200
        })
        .then(result => {
            result = camelCase(result);
            result.data.productList = processProductList(result.data.productList);
            return result;
        });
    }
};


module.exports = list;