...
|
...
|
@@ -122,7 +122,7 @@ const _redutionCount = (uid)=> { |
|
|
};
|
|
|
|
|
|
|
|
|
const favoriteProductList = (uid, page, limit, selectedSort, subscribe, reduction, promotion, query) => {
|
|
|
const favoriteProductListAsync = (uid, page, limit, selectedSort, subscribe, reduction, promotion, query) => {
|
|
|
return co(function*() {
|
|
|
let result = {
|
|
|
sort: {},
|
...
|
...
|
@@ -205,7 +205,7 @@ const favoriteProductList = (uid, page, limit, selectedSort, subscribe, reductio |
|
|
})();
|
|
|
};
|
|
|
|
|
|
const favoriteBrandList = (uid, page, limit)=> {
|
|
|
const favoriteBrandListAsync = (uid, page, limit)=> {
|
|
|
return co(function*() {
|
|
|
let result = {
|
|
|
brands: {
|
...
|
...
|
@@ -277,14 +277,38 @@ const favoriteArticleListAsync = (uid, udid, page, limit)=> { |
|
|
})();
|
|
|
};
|
|
|
|
|
|
const newProductAsync = (uid, page, limit, id) => {
|
|
|
return co(function * () {
|
|
|
let products = yield favoriteApi.favoriteBrandData(uid, page, limit);
|
|
|
|
|
|
return _.get(products, 'data.brand_list', []).reduce((total, cur) => {
|
|
|
if (id !== cur.brand_id) {
|
|
|
return total;
|
|
|
}
|
|
|
|
|
|
if (cur.new_product_num === 0) {
|
|
|
return total;
|
|
|
}
|
|
|
|
|
|
total = _.concat(total, _.take(_.get(cur, 'new_product', []), 20).map((pro) => {
|
|
|
return {
|
|
|
img: pro.default_images,
|
|
|
url: helpers.getUrlBySkc(pro.product_id, _.get(pro, 'goods[0].id', ''), _.get(pro, 'cnAlphabet')),
|
|
|
name: pro.product_name,
|
|
|
salePrice: pro.sales_price === pro.market_price ? '' : pro.sales_price,
|
|
|
marketPrice: pro.market_price
|
|
|
};
|
|
|
}));
|
|
|
|
|
|
return total;
|
|
|
}, []);
|
|
|
})();
|
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
|
getFavoriteTabs,
|
|
|
favoriteBrandList,
|
|
|
favoriteProductList,
|
|
|
favoriteArticleListAsync
|
|
|
favoriteBrandListAsync,
|
|
|
favoriteProductListAsync,
|
|
|
favoriteArticleListAsync,
|
|
|
newProductAsync
|
|
|
}; |
...
|
...
|
|