item-api.js 1.27 KB
/**
 * 商品基本信息
 * @author: yyq<yanqing.yang@yoho.cn>
 * @date: 2016/7/11
 */
'use strict';

const api = global.yoho.API;

const getProductBaseAsync = (productId, uid, skn) => {
    let params = {
        method: 'h5.product.data',
        productId: productId
    };

    if (uid) {
        params.uid = uid;
    }

    if (skn) {
        params.product_skn = skn;
    }

    return api.get('', params, { cache: true });
};

const getUserIsFav = (uid, productId) => {
    return api.get('', {
        method: 'app.favorite.isFavorite',
        id: productId,
        uid: uid,
        type: 'product'
    }, { cache: true });
};

const getsizeInfoAsync = (skn) => {
    return api.get('', {
        method: 'h5.product.intro',
        productskn: skn
    }, { cache: true });
};

const getComfortAsync = productId => {
    return api.get('', {
        method: 'web.productComfort.data',
        product_id: productId
    }, {
        cache: true,
        code: 200
    });
};

const getModelTryAsync = skn => {
    return api.get('', {
        method: 'web.productModelTry.data',
        product_skn: skn
    }, {
        cache: true,
        code: 200
    });
};

module.exports = {
    getProductBaseAsync,
    getUserIsFav,
    getsizeInfoAsync,
    getComfortAsync,
    getModelTryAsync
};