Showing
3 changed files
with
26 additions
and
5 deletions
@@ -68,7 +68,7 @@ const setMultiResourceByProductBaseInfo = (data) => { | @@ -68,7 +68,7 @@ const setMultiResourceByProductBaseInfo = (data) => { | ||
68 | 68 | ||
69 | if (uid) { | 69 | if (uid) { |
70 | multiResourcesUrl['FavoriteData::getUidProductFav'] = | 70 | multiResourcesUrl['FavoriteData::getUidProductFav'] = |
71 | - yield favoriteProductService.getUidProductFavAsync(uid, productId, isOnlyUrl); | 71 | + yield favoriteProductService.isFavoriteAsync(uid, productId, isOnlyUrl); |
72 | } | 72 | } |
73 | })(); | 73 | })(); |
74 | }; | 74 | }; |
@@ -94,7 +94,7 @@ const getProductFavoriteData = (uid, pid, bid) => { | @@ -94,7 +94,7 @@ const getProductFavoriteData = (uid, pid, bid) => { | ||
94 | let productData = getMultiDataByResourceName('FavoriteData::getUidProductFav'); | 94 | let productData = getMultiDataByResourceName('FavoriteData::getUidProductFav'); |
95 | 95 | ||
96 | if (!productData) { | 96 | if (!productData) { |
97 | - productData = yield favoriteProductService.getUidProductFavAsync(uid, pid); | 97 | + productData = yield favoriteProductService.isFavoriteAsync(uid, pid); |
98 | } | 98 | } |
99 | result.product = productData.code === 200 && productData.data ? true : false; | 99 | result.product = productData.code === 200 && productData.data ? true : false; |
100 | } | 100 | } |
@@ -4,12 +4,11 @@ | @@ -4,12 +4,11 @@ | ||
4 | 4 | ||
5 | const library = '../../../library'; | 5 | const library = '../../../library'; |
6 | const API = require(`${library}/api`).API; | 6 | const API = require(`${library}/api`).API; |
7 | -const ServiceAPI = require(`${library}/api`).ServiceAPI; | ||
8 | const sign = require(`${library}/sign`); | 7 | const sign = require(`${library}/sign`); |
9 | 8 | ||
10 | const api = new API(); | 9 | const api = new API(); |
11 | 10 | ||
12 | -module.exports.getUidProductFavAsync = function (uid, pid) { | 11 | +module.exports.isFavoriteAsync = function (uid, pid) { |
13 | return api.get('', sign.apiSign({ | 12 | return api.get('', sign.apiSign({ |
14 | method: 'app.favorite.isFavorite', | 13 | method: 'app.favorite.isFavorite', |
15 | id: pid, | 14 | id: pid, |
@@ -17,3 +16,21 @@ module.exports.getUidProductFavAsync = function (uid, pid) { | @@ -17,3 +16,21 @@ module.exports.getUidProductFavAsync = function (uid, pid) { | ||
17 | type: 'product' | 16 | type: 'product' |
18 | })); | 17 | })); |
19 | }; | 18 | }; |
19 | + | ||
20 | +module.exports.createAsync = function (uid, pid) { | ||
21 | + return api.get('', sign.apiSign({ | ||
22 | + method: 'app.favorite.add', | ||
23 | + id: pid, | ||
24 | + uid: uid, | ||
25 | + type: 'product' | ||
26 | + })); | ||
27 | +}; | ||
28 | + | ||
29 | +module.exports.deleteAsync = function (uid, pid) { | ||
30 | + return api.get('', sign.apiSign({ | ||
31 | + method: 'app.favorite.cancel', | ||
32 | + fav_id: pid, | ||
33 | + uid: uid, | ||
34 | + type: 'product' | ||
35 | + })); | ||
36 | +}; |
@@ -6,4 +6,8 @@ | @@ -6,4 +6,8 @@ | ||
6 | 6 | ||
7 | const favoriteProductAPI = require('./favorite-product-api'); | 7 | const favoriteProductAPI = require('./favorite-product-api'); |
8 | 8 | ||
9 | -module.exports.getUidProductFavAsync = favoriteProductAPI.getUidProductFavAsync; | 9 | +module.exports.isFavoriteAsync = favoriteProductAPI.isFavoriteAsync; |
10 | + | ||
11 | +module.exports.createAsync = favoriteProductAPI.createAsync; | ||
12 | + | ||
13 | +module.exports.deleteAsync = favoriteProductAPI.deleteAsync; |
-
Please register or login to post a comment