brand-api.js 2.3 KB
/**
 * Created by PhpStorm.
 * User: Targaryen
 * Date: 2016/7/19
 * Time: 14:02
 */
'use strict';
const api = global.yoho.API;

const yhChannel = {
    men: {
        channel: '1'
    },
    women: {
        channel: '2'
    },
    lifestyle: {
        channel: '4'
    }
};

module.exports = {

    /**
     * 从接口获取品牌店铺数据
     * @returns {*}
     */
    getShopInfoData(params) {
        let finalParams = {
            method: 'app.shops.getIntro',
            shop_id: params.shopId
        };

        if (params.uid) {
            Object.assign(finalParams, {
                uid: params.uid
            });
        }

        return api.get('', finalParams);
    },

    /**
     * 通过品牌域名获取品牌信息
     * @param params
     */
    getBrandInfoByDomain(params) {
        return api.get('', {
            method: 'web.brand.byDomain',
            domain: params.domain
        });
    },


    getShopsDecoratorList(params) {
        return api.get('', {
            method: 'app.shopsdecorator.getList',

        });
    },

    /**
     * 从接口获取品牌店铺商品数据
     * @returns {*}
     */
    getBrandShopGoodsOriginData(params) {
        return api.get('', {
            method: ''
        });
    },

    /**
     * 收藏取消收藏店铺
     * @param params
     * @returns {*}
     */
    collectShopOriginData(params) {
        let finalParams = {
            id: params.shopId,
            fav_id: params.shopId,
            uid: params.uid,
            type: params.type
        };

        if (isFav) {
            Object.assign(finalParams, {
                method: 'app.favorite.add'
            });
        } else {
            Object.assign(finalParams, {
                method: 'app.favorite.cancel'
            });
        }
        return api.get('', finalParams);
    },

    /**
     * 从接口获取品牌列表页数据
     * @returns {*}
     */
    getBrandListOriginData(params) {
        return api.get('', {
            method: 'app.brand.newBrandList',
            yh_channel: yhChannel[params.channel].channel
        });
    },

    /**
     * 从接口获取全部分类数据
     * @returns {*}
     */
    getCateListData(params) {
        return api.get('', Object.assign(params, {
            method: 'app.sort.get'
        })
        );
    }
};