favorite-brand-api.js
1.15 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
/**
* Created by TaoHuang on 2016/6/14.
*/
'use strict';
const ApiService = require('./favorite-api');
const _ = require('lodash');
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
this.api = new ApiService(ctx);
this.isFavoriteAsync = _.partial(this.api.isFavAsync.bind(this.api), _, _, 'brand');
this.addFavAsync = _.partial(this.api.addFavAsync.bind(this.api), _, _, 'brand');
this.cancelFavAsync = _.partial(this.api.cancelFavAsync.bind(this.api), _, _, 'brand');
}
getShopFavNumAsync(sid) {
return this.post({
data: {
favIds: sid,
type: 'shop',
method: 'app.favorite.queryFavoriteCountByShopIds'
},
url: '/favorite',
api: global.yoho.SingleAPI
});
}
getBrandIdNumAsync(bid) {
return this.post({
data: {
brandId: bid,
type: 'brand',
method: 'app.favorite.queryFavoriteCountByBrandId',
},
url: '/favorite',
api: global.yoho.SingleAPI
});
}
};