favorite-brand-api.js 945 Bytes
/**
 * Created by TaoHuang on 2016/6/14.
 */

'use strict';

const api = require('./favorite-api');
const serviceApi = global.yoho.SingleAPI;

const _ = require('lodash');

const isFavoriteAsync = _.partial(api.isFavAsync, _, _, 'brand');

const addFavAsync = _.partial(api.addFavAsync, _, _, 'brand');

const cancelFavAsync = _.partial(api.cancelFavAsync, _, _, 'brand');

const getShopFavNumAsync = (sid) => {
    return serviceApi.post('favorite/queryFavoriteCountByShopIds', {
        favIds: sid,
        type: 'shop',
        method: 'app.favorite.queryFavoriteCountByShopIds'
    });
};

const getBrandIdNumAsync = (bid) => {
    return serviceApi.post('favorite/queryFavoriteCountByBrandId', {
        brandId: bid,
        type: 'brand',
        method: 'app.favorite.queryFavoriteCountByBrandId'
    });
};

module.exports = {
    isFavoriteAsync,
    addFavAsync,
    cancelFavAsync,
    getShopFavNumAsync,
    getBrandIdNumAsync
};