Authored by htoooth

refactor file

... ... @@ -21,7 +21,7 @@ const commentAPI = require('./detail-comment-api');
const consultAPI = require('./detail-consult-api');
const hotAreaAPI = require('./detail-hotarea-api');
const brandAPI = require('./brand-api');
const favoriteAPI = require('./favorite-api');
const favoriteBrandService = require('./favorite-service');
const shopAPI = require('./shop-api');
const searchAPI = require('./search-api');
const homeHandle = require('./home-handle');
... ... @@ -65,7 +65,7 @@ const setMultiResourceByProductBaseInfo = (data) => {
if (uid) {
multiResourcesUrl['FavoriteData::getUidProductFav'] =
yield favoriteAPI.getUidProductFavAsync(uid, productId, isOnlyUrl);
yield favoriteBrandService.getUidProductFavAsync(uid, productId, isOnlyUrl);
}
})();
};
... ... @@ -91,13 +91,13 @@ const getProductFavoriteData = (uid, pid, bid) => {
let productData = getMultiDataByResourceName('FavoriteData::getUidProductFav');
if (!productData) {
productData = yield favoriteAPI.getUidProductFavAsync(uid, pid);
productData = yield favoriteBrandService.getUidProductFavAsync(uid, pid);
}
result.product = productData.code === 200 && productData.data ? true : false;
}
if (bid) {
let brandData = yield favoriteAPI.isFavoriteBrandAsync(uid, bid);
let brandData = yield favoriteBrandService.isFavoriteBrandAsync(uid, bid);
result.brand = brandData.code && brandData.code === 200 ? true : false;
}
... ... @@ -794,7 +794,7 @@ function getProductComfortAsync(productId) {
let comfort = getMultiDataByResourceName('ItemData::getProductComfort');
if (!comfort) {
comfort = yield favoriteAPI.getProductComfortAsync(productId);
comfort = yield favoriteBrandService.getProductComfortAsync(productId);
}
if (comfort.data) {
... ...
'use strict';
const library = '../../../library';
const API = require(`${library}/api`).API;
const ServiceAPI = require(`${library}/api`).ServiceAPI;
const sign = require(`${library}/sign`);
const api = new API();
const serviceAPI = new ServiceAPI();
module.exports.getUidProductFavAsync = function (uid, pid, isUrl) {
isUrl;
module.exports.getUidProductFavAsync = function (uid, pid) {
return api.get('', sign.apiSign({
method: 'app.favorite.isFavorite',
id: pid,
... ...
/**
* Created by TaoHuang on 2016/6/13.
*/
'use strict';
const favoriteBrandAPI = require('./favorite-brand-api');
module.exports.changeFavoriteBrandAsync = favoriteBrandAPI.changeFavoriteBrandAsync;
module.exports.isFavoriteBrandAsync = favoriteBrandAPI.isFavoriteBrandAsync;
module.exports.getUidProductFavAsync = favoriteBrandAPI.getUidProductFavAsync;
... ...
/**
* Created by TaoHuang on 2016/6/13.
*/
'use strict';
const Promise = require('bluebird');
const co = Promise.coroutine;
const moment = require('moment');
const _ = require('lodash');
const favoriteAPI = require('./favorite-api');
module.exports.changeFavoriteBrandAsync = (uid, brandId) => {
return favoriteAPI.changeFavoriteBrandAsync(uid, brandId);
}
... ... @@ -13,7 +13,7 @@ const cRoot = './controllers';
const detail = require(`${cRoot}/detail`);
// 收藏品牌
const favorite = require(`${cRoot}/favorite`);
const favorite = require(`${cRoot}/favorite-brand`);
// 商品促销controller
const sale = require(`${cRoot}/sale`);
... ...