search-api.js 1.35 KB
/**
 * Created by TaoHuang on 2016/6/14.
 */


'use strict';

const api = global.yoho.SearchAPI;

const yohoApi = global.yoho.API;

const getSortByConditionAsync = (condition) => {
    return api.get('sortgroup.json', condition);
};

/**
 * 获取商品列表
 * @return
 */
const getProductList = (params) => {
    let finalParams = {
        limit: 60,
        method: 'app.search.li'
    };

    Object.assign(finalParams, params);
    return yohoApi.get('', finalParams);
};

/**
 * 获取分类列表
 * @return
 */
const getSortList = (params) => {
    let finalParams = {
        //method: 'web.regular.groupsort'
        method: 'app.search.li'
    };

    Object.assign(finalParams, params);
    return yohoApi.get('', finalParams);
};

/**
 * 获取分类图文介绍
 * @return
 */
const getSortIntroList = (params) => {
    return yohoApi.get('', params);
};

/**
 * 获取分类左侧广告
 * @return
 */
const getSortads = (params) => {
    return yohoApi.get('', params);
};

/**
 * 获取品牌folder
 * @return
 */
const getBrandFolder = (params) => {
    return yohoApi.get('', params);
};

/**
 * 一周新品上架
 * @return
 */
const getWeekNew = (params) => {
    return yohoApi.get('', params);
};

module.exports = {
    getSortByConditionAsync,
    getProductList,
    getSortList,
    getSortIntroList,
    getSortads,
    getBrandFolder,
    getWeekNew
};