global.js
1.13 KB
'use strict';
const utils = '../../../utils';
const productProcess = require(`${utils}/product-process`);
const globalapi = global.yoho.GlobalAPI;
exports.list = (param) => {
return globalapi.get('product/api/v2/detail/getlist', param).then((result) => {
if (!result || !result.data) {
return {};
}
return {
filter: productProcess.processFilter(result.data.filter || []),
list: result.data.product_list.map((data) => {
return {
product_url: `//m.yohobuy.com/product/global/${data.product_skn}.html`,
product_img: data.default_images,
price: data.formart_final_price,
product_name: data.product_name,
country_name: data.country_name,
is_stock: data.is_stock,
is_limited: data.is_limited,
is_plane: data.is_plane
};
})
};
});
};
exports.getBrand = (param) => {
return globalapi.get('editor/api/v1/brand/get', param).then((data) => {
return data.data || {};
});
};