brand.js
967 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
/**
* 品牌操作Models
* @author: chenfeng<feng.chen@yoho.cn>
* @date: 2016/09/07
*/
'use strict';
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
/**
* [收藏品牌或者商品]
* @param {[int]} uid [用户ID]
* @param {[int]} id [品牌ID]
* @param {Boolean} isBrand [是品牌还是商品]
* @param {string} opt [操作(ok:表示确定,cancel:表示取消)]
* @return {[array]}
*/
favoriteBrand(uid, id, opt, isBrand) {
let param = {
uid: uid,
type: isBrand ? 'brand' : 'product'
};
if (opt === 'ok') {
param.id = id;
param.method = 'app.favorite.add';
} else {
param.fav_id = id;
param.method = 'app.favorite.cancel';
}
return this.post({
data: param,
api: global.yoho.API
});
}
};