Authored by htoooth

refactor file

@@ -21,7 +21,7 @@ const commentAPI = require('./detail-comment-api'); @@ -21,7 +21,7 @@ const commentAPI = require('./detail-comment-api');
21 const consultAPI = require('./detail-consult-api'); 21 const consultAPI = require('./detail-consult-api');
22 const hotAreaAPI = require('./detail-hotarea-api'); 22 const hotAreaAPI = require('./detail-hotarea-api');
23 const brandAPI = require('./brand-api'); 23 const brandAPI = require('./brand-api');
24 -const favoriteAPI = require('./favorite-api'); 24 +const favoriteBrandService = require('./favorite-service');
25 const shopAPI = require('./shop-api'); 25 const shopAPI = require('./shop-api');
26 const searchAPI = require('./search-api'); 26 const searchAPI = require('./search-api');
27 const homeHandle = require('./home-handle'); 27 const homeHandle = require('./home-handle');
@@ -65,7 +65,7 @@ const setMultiResourceByProductBaseInfo = (data) => { @@ -65,7 +65,7 @@ const setMultiResourceByProductBaseInfo = (data) => {
65 65
66 if (uid) { 66 if (uid) {
67 multiResourcesUrl['FavoriteData::getUidProductFav'] = 67 multiResourcesUrl['FavoriteData::getUidProductFav'] =
68 - yield favoriteAPI.getUidProductFavAsync(uid, productId, isOnlyUrl); 68 + yield favoriteBrandService.getUidProductFavAsync(uid, productId, isOnlyUrl);
69 } 69 }
70 })(); 70 })();
71 }; 71 };
@@ -91,13 +91,13 @@ const getProductFavoriteData = (uid, pid, bid) => { @@ -91,13 +91,13 @@ const getProductFavoriteData = (uid, pid, bid) => {
91 let productData = getMultiDataByResourceName('FavoriteData::getUidProductFav'); 91 let productData = getMultiDataByResourceName('FavoriteData::getUidProductFav');
92 92
93 if (!productData) { 93 if (!productData) {
94 - productData = yield favoriteAPI.getUidProductFavAsync(uid, pid); 94 + productData = yield favoriteBrandService.getUidProductFavAsync(uid, pid);
95 } 95 }
96 result.product = productData.code === 200 && productData.data ? true : false; 96 result.product = productData.code === 200 && productData.data ? true : false;
97 } 97 }
98 98
99 if (bid) { 99 if (bid) {
100 - let brandData = yield favoriteAPI.isFavoriteBrandAsync(uid, bid); 100 + let brandData = yield favoriteBrandService.isFavoriteBrandAsync(uid, bid);
101 101
102 result.brand = brandData.code && brandData.code === 200 ? true : false; 102 result.brand = brandData.code && brandData.code === 200 ? true : false;
103 } 103 }
@@ -794,7 +794,7 @@ function getProductComfortAsync(productId) { @@ -794,7 +794,7 @@ function getProductComfortAsync(productId) {
794 let comfort = getMultiDataByResourceName('ItemData::getProductComfort'); 794 let comfort = getMultiDataByResourceName('ItemData::getProductComfort');
795 795
796 if (!comfort) { 796 if (!comfort) {
797 - comfort = yield favoriteAPI.getProductComfortAsync(productId); 797 + comfort = yield favoriteBrandService.getProductComfortAsync(productId);
798 } 798 }
799 799
800 if (comfort.data) { 800 if (comfort.data) {
  1 +'use strict';
  2 +
1 const library = '../../../library'; 3 const library = '../../../library';
2 const API = require(`${library}/api`).API; 4 const API = require(`${library}/api`).API;
3 const ServiceAPI = require(`${library}/api`).ServiceAPI; 5 const ServiceAPI = require(`${library}/api`).ServiceAPI;
4 const sign = require(`${library}/sign`); 6 const sign = require(`${library}/sign`);
  7 +
5 const api = new API(); 8 const api = new API();
6 const serviceAPI = new ServiceAPI(); 9 const serviceAPI = new ServiceAPI();
7 10
8 -module.exports.getUidProductFavAsync = function (uid, pid, isUrl) {  
9 - isUrl; 11 +module.exports.getUidProductFavAsync = function (uid, pid) {
10 return api.get('', sign.apiSign({ 12 return api.get('', sign.apiSign({
11 method: 'app.favorite.isFavorite', 13 method: 'app.favorite.isFavorite',
12 id: pid, 14 id: pid,
  1 +/**
  2 + * Created by TaoHuang on 2016/6/13.
  3 + */
  4 +
  5 +'use strict';
  6 +
  7 +const favoriteBrandAPI = require('./favorite-brand-api');
  8 +
  9 +module.exports.changeFavoriteBrandAsync = favoriteBrandAPI.changeFavoriteBrandAsync;
  10 +
  11 +module.exports.isFavoriteBrandAsync = favoriteBrandAPI.isFavoriteBrandAsync;
  12 +
  13 +module.exports.getUidProductFavAsync = favoriteBrandAPI.getUidProductFavAsync;
1 -/**  
2 - * Created by TaoHuang on 2016/6/13.  
3 - */  
4 -  
5 -'use strict';  
6 -  
7 -const Promise = require('bluebird');  
8 -const co = Promise.coroutine;  
9 -const moment = require('moment');  
10 -const _ = require('lodash');  
11 -  
12 -const favoriteAPI = require('./favorite-api');  
13 -  
14 -module.exports.changeFavoriteBrandAsync = (uid, brandId) => {  
15 - return favoriteAPI.changeFavoriteBrandAsync(uid, brandId);  
16 -}  
@@ -13,7 +13,7 @@ const cRoot = './controllers'; @@ -13,7 +13,7 @@ const cRoot = './controllers';
13 const detail = require(`${cRoot}/detail`); 13 const detail = require(`${cRoot}/detail`);
14 14
15 // 收藏品牌 15 // 收藏品牌
16 -const favorite = require(`${cRoot}/favorite`); 16 +const favorite = require(`${cRoot}/favorite-brand`);
17 17
18 // 商品促销controller 18 // 商品促销controller
19 const sale = require(`${cRoot}/sale`); 19 const sale = require(`${cRoot}/sale`);