favorite.js
863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* 收藏相关接口
* @author: yyq<yanqing.yang@yoho.cn>
* @date: 2016/7/17
*/
'use strict';
const FavAPI = require('./favorite-api');
const toggleFavProduct = (productId, uid, isadd) => {
if (isadd) {
return FavAPI.addFavAsync(uid, productId, 'product');
} else {
return FavAPI.cancelFavAsync(uid, productId, 'product');
}
};
const toggleFavBrand = (brandId, uid, isadd) => {
if (isadd) {
return FavAPI.addFavAsync(uid, brandId, 'brand');
} else {
return FavAPI.cancelFavAsync(uid, brandId, 'brand');
}
};
const toggleFavShop = (shopId, uid, isadd) => {
if (isadd) {
return FavAPI.addFavAsync(uid, shopId, 'shop');
} else {
return FavAPI.cancelFavAsync(uid, shopId, 'shop');
}
};
module.exports = {
toggleFavProduct,
toggleFavBrand,
toggleFavShop
};