Authored by htoooth

refactor favorite product

... ... @@ -21,7 +21,10 @@ const commentAPI = require('./detail-comment-api');
const consultAPI = require('./detail-consult-api');
const hotAreaAPI = require('./detail-hotarea-api');
const brandAPI = require('./brand-api');
const favoriteBrandService = require('./favorite-service');
const favoriteBrandService = require('./favorite-brand-service');
const favoriteProductService = require('./favorite-product-service');
const shopAPI = require('./shop-api');
const searchAPI = require('./search-api');
const homeHandle = require('./home-handle');
... ... @@ -65,7 +68,7 @@ const setMultiResourceByProductBaseInfo = (data) => {
if (uid) {
multiResourcesUrl['FavoriteData::getUidProductFav'] =
yield favoriteBrandService.getUidProductFavAsync(uid, productId, isOnlyUrl);
yield favoriteProductService.getUidProductFavAsync(uid, productId, isOnlyUrl);
}
})();
};
... ... @@ -91,7 +94,7 @@ const getProductFavoriteData = (uid, pid, bid) => {
let productData = getMultiDataByResourceName('FavoriteData::getUidProductFav');
if (!productData) {
productData = yield favoriteBrandService.getUidProductFavAsync(uid, pid);
productData = yield favoriteProductService.getUidProductFavAsync(uid, pid);
}
result.product = productData.code === 200 && productData.data ? true : false;
}
... ...
... ... @@ -8,15 +8,6 @@ const sign = require(`${library}/sign`);
const api = new API();
const serviceAPI = new ServiceAPI();
module.exports.getUidProductFavAsync = function (uid, pid) {
return api.get('', sign.apiSign({
method: 'app.favorite.isFavorite',
id: pid,
uid: uid,
type: 'product'
}));
};
module.exports.isFavoriteBrandAsync = function (uid, bid) {
return serviceAPI.get('shops/service/v1/favorite/getUidBrandFav', sign.apiSign({
uid: uid,
... ...
... ... @@ -10,4 +10,3 @@ module.exports.changeFavoriteBrandAsync = favoriteBrandAPI.changeFavoriteBrandAs
module.exports.isFavoriteBrandAsync = favoriteBrandAPI.isFavoriteBrandAsync;
module.exports.getUidProductFavAsync = favoriteBrandAPI.getUidProductFavAsync;
... ...
/**
* Created by TaoHuang on 2016/6/13.
*/
const library = '../../../library';
const API = require(`${library}/api`).API;
const ServiceAPI = require(`${library}/api`).ServiceAPI;
const sign = require(`${library}/sign`);
const api = new API();
module.exports.getUidProductFavAsync = function (uid, pid) {
return api.get('', sign.apiSign({
method: 'app.favorite.isFavorite',
id: pid,
uid: uid,
type: 'product'
}));
};
... ...
/**
* Created by TaoHuang on 2016/6/13.
*/
'use strict';
const favoriteProductAPI = require('./favorite-product-api');
module.exports.getUidProductFavAsync = favoriteProductAPI.getUidProductFavAsync;
... ...