favorite.js 1.08 KB
/**
 * 我的收藏查询
 * @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 = {
    getFavoriteProduct(param) {
        let p = {
            method: 'web.favorite.product'
        };

        return API.get('', _.assign(p, param));
    },

    getFavoriteBrand(param) {
        let p = {
            method: 'app.favorite.brand'
        };

        return API.get('', _.assign(p, param));
    },

    getFavoriteEditoreial(param) {
        return ServiceAPI.get('guang/api/*/favorite/getUserFavArticleList', param);
    },

    cancelFavorite(uid, ids, type) {
        let p = {
            method: 'web.favorite.cancel',
            uid: uid,
            favIds: ids,
            type: type
        };

        return API.post('', p);
    },

    cancelEditorialFavorite(uid, ids) {
        return ServiceAPI.get('guang/api/*/favorite/cancelFavorite', {
            article_id: ids,
            uid: uid
        });
    }
};

module.exports = favorite;