favorite-product-api.js
769 Bytes
/**
* Created by TaoHuang on 2016/6/13.
*/
'use strict';
const _ = require('lodash');
const FavoriteApiModel = require('./favorite-api');
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
this.favoriteApi = new FavoriteApiModel(ctx);
this.createAsync = _.partial(this.favoriteApi.addFavAsync.bind(this.favoriteApi), _, _, 'product');
this.deleteAsync = _.partial(this.favoriteApi.cancelFavAsync.bind(this.favoriteApi), _, _, 'product');
}
isFavoriteAsync(uid, pid) {
return this.get({
data: {
method: 'app.favorite.isFavorite',
id: pid,
uid: uid,
type: 'product'
}
});
}
};