Authored by htoooth

refactor brand

@@ -17,7 +17,7 @@ module.exports.changeFavoriteBrand = (req, res, next) => { @@ -17,7 +17,7 @@ module.exports.changeFavoriteBrand = (req, res, next) => {
17 let brandId = req.body.brandId; 17 let brandId = req.body.brandId;
18 18
19 if (uid && brandId) { 19 if (uid && brandId) {
20 - service.changeFavoriteBrandAsync(uid, brandId).then(result => { 20 + service.changeAsync(uid, brandId).then(result => {
21 res.json(result) 21 res.json(result)
22 }).catch(next); 22 }).catch(next);
23 } else if (!uid) { 23 } else if (!uid) {
@@ -100,7 +100,7 @@ const getProductFavoriteData = (uid, pid, bid) => { @@ -100,7 +100,7 @@ const getProductFavoriteData = (uid, pid, bid) => {
100 } 100 }
101 101
102 if (bid) { 102 if (bid) {
103 - let brandData = yield favoriteBrandService.isFavoriteBrandAsync(uid, bid); 103 + let brandData = yield favoriteBrandService.isFavoriteAsync(uid, bid);
104 104
105 result.brand = brandData.code && brandData.code === 200 ? true : false; 105 result.brand = brandData.code && brandData.code === 200 ? true : false;
106 } 106 }
@@ -8,14 +8,14 @@ const sign = require(`${library}/sign`); @@ -8,14 +8,14 @@ const sign = require(`${library}/sign`);
8 const api = new API(); 8 const api = new API();
9 const serviceAPI = new ServiceAPI(); 9 const serviceAPI = new ServiceAPI();
10 10
11 -module.exports.isFavoriteBrandAsync = function (uid, bid) { 11 +module.exports.isFavoriteAsync = function (uid, bid) {
12 return serviceAPI.get('shops/service/v1/favorite/getUidBrandFav', sign.apiSign({ 12 return serviceAPI.get('shops/service/v1/favorite/getUidBrandFav', sign.apiSign({
13 uid: uid, 13 uid: uid,
14 brandId: bid 14 brandId: bid
15 })); 15 }));
16 }; 16 };
17 17
18 -module.exports.changeFavoriteBrandAsync = function (uid, brandId) { 18 +module.exports.changeAsync = function (uid, brandId) {
19 return serviceAPI.get('guang/service/v2/favorite/toggleBrand', sign.apiSign({ 19 return serviceAPI.get('guang/service/v2/favorite/toggleBrand', sign.apiSign({
20 uid: uid, 20 uid: uid,
21 brand_id: brandId 21 brand_id: brandId
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 6
7 const favoriteBrandAPI = require('./favorite-brand-api'); 7 const favoriteBrandAPI = require('./favorite-brand-api');
8 8
9 -module.exports.changeFavoriteBrandAsync = favoriteBrandAPI.changeFavoriteBrandAsync; 9 +module.exports.changeAsync = favoriteBrandAPI.changeAsync;
10 10
11 -module.exports.isFavoriteBrandAsync = favoriteBrandAPI.isFavoriteBrandAsync; 11 +module.exports.isFavoriteAsync = favoriteBrandAPI.isFavoriteAsync;
12 12