Authored by lijing

收藏记录优化

... ... @@ -157,55 +157,56 @@ const myDetails = (params) => {
* @param params
*/
const recordContent = (uid, udid, page, limit) => {
if (uid) {
return api.get('', {
method: 'app.browse.product',
uid: uid,
limit: limit,
page: page
}, {code: 200}).then((result) => {
return api.get('', {
method: 'app.browse.product',
uid: uid,
limit: limit,
page: page
}, {code: 200}).then((result) => {
let resu = {};
let resu = {};
if (result && result.code === 200) {
if (result && result.code === 200) {
let list = result;
let list = result;
if (!result || page === '1' && result.data.total === 0) {
resu.walkwayUrl = helpers.urlFormat('/product/new');
resu.noRecord = true;
if (!result || page === '1' && result.data.total === 0) {
resu.walkwayUrl = helpers.urlFormat('/product/new');
resu.noRecord = true;
return resu;
}
return resu;
}
if (list.data && list.data.product_list) {
resu = {
browseRecord: []
};
_.forEach(list.data.product_list, function(val) {
let obj = {
productList: []
if (list.data && list.data.product_list) {
resu = {
browseRecord: []
};
obj = _.assign(obj, {
product_name: val.product_name,
product_skn: val.product_skn,
storage: val.storage,
image: val.image,
link: '/product/show_' + val.product_skn + '.html',
sales_price: val.sales_price,
market_price: (val.market_price - val.sales_price) > 0 ? val.market_price : false,
invalidGoods: val.status === 0
_.forEach(list.data.product_list, function(val) {
let obj = {
productList: []
};
obj = _.assign(obj, {
product_name: val.product_name,
product_skn: val.product_skn,
storage: val.storage,
image: val.image,
link: '/product/show_' + val.product_skn + '.html',
sales_price: val.sales_price,
market_price: (val.market_price - val.sales_price) > 0 ? val.market_price : false,
invalidGoods: val.status === 0
});
resu.browseRecord.push(obj);
});
}
resu.browseRecord.push(obj);
});
return resu;
}
return resu;
}
});
});
}
};
/**
... ...
... ... @@ -56,7 +56,7 @@ router.get('/mycurrency', currencyController.myCurrency); // yoho币总数
router.get('/currencyDetail', currencyController.currencyDetail); // yoho币列表
router.post('/ajaxCurrencyDetail', currencyController.ajaxCurrencyDetail); // yoho币列表
router.get('/record', homeController.record); // 浏览记录
router.get('/record', auth, homeController.record); // 浏览记录
router.get('/recordContent', homeController.recordContent); // 浏览记录
router.get('/delRecord', homeController.delRecord); // 删除浏览记录
... ...