favorite.js
1.61 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
* 我的收藏查询
* @author: jiangfeng<jeff.jiang@yoho.cn>
* @date: 16/7/19
*/
'use strict';
const _ = require('lodash');
const API = global.yoho.API;
const ServiceAPI = global.yoho.ServiceAPI;
const favorite = {
/**
* 查询收藏的商品
* @param param
* @returns {*}
*/
getFavoriteProduct(param) {
let p = {
method: 'web.favorite.product'
};
return API.get('', _.assign(p, param));
},
/**
* 查询收藏的店铺、品牌
* @param param
* @returns {*}
*/
getFavoriteBrand(param) {
let p = {
method: 'app.favorite.brand'
};
return API.get('', _.assign(p, param));
},
/**
* 查询收藏的资讯
* @param param
* @returns {*}
*/
getFavoriteEditoreial(param) {
param.app_type = 1;
return ServiceAPI.get('guang/api/*/favorite/getUserFavArticleList', param);
},
/**
* 取消收藏 商品、店铺
* @param uid
* @param ids
* @param type
* @returns {*|type[]}
*/
cancelFavorite(uid, ids, type) {
let p = {
method: 'web.favorite.cancel',
uid: uid,
favIds: ids,
type: type
};
return API.post('', p);
},
/**
* 取消收藏资讯
* @param uid
* @param ids
* @returns {*}
*/
cancelEditorialFavorite(uid, ids) {
return ServiceAPI.get('guang/api/*/favorite/cancelFavorite', {
article_id: ids,
uid: uid,
app_type: 1
});
}
};
module.exports = favorite;