favorite-product-api.js 799 Bytes
/**
 * Created by TaoHuang on 2016/6/13.
 */

const library = '../../../library';
const API = require(`${library}/api`).API;
const sign = require(`${library}/sign`);

const api = new API();

module.exports.isFavoriteAsync = function (uid, pid) {
    return api.get('', sign.apiSign({
        method: 'app.favorite.isFavorite',
        id: pid,
        uid: uid,
        type: 'product'
    }));
};

module.exports.createAsync = function (uid, pid) {
    return api.get('', sign.apiSign({
        method: 'app.favorite.add',
        id: pid,
        uid: uid,
        type: 'product'
    }));
};

module.exports.deleteAsync = function (uid, pid) {
    return api.get('', sign.apiSign({
        method: 'app.favorite.cancel',
        fav_id: pid,
        uid: uid,
        type: 'product'
    }));
};