Authored by shijian

根据skn返回超链接

... ... @@ -198,6 +198,11 @@ const component = {
});
} else {
homeModel.recentPreviewNew(req.user.uid, 20).then(result => {
let sknarr = result.data.product_list.map(item=>item.product_skn);
return homeModel.getSknUrl(sknarr, result);
}).then(result=>{
console.log(result);
res.json(result);
}).catch(next);
}
... ...
... ... @@ -233,6 +233,23 @@ exports.recentPreviewNew = (uid, limit) => {
});
};
exports.getSknUrl = (skn, originArr) => {
return api.get('', {
method: 'h5.product.batch',
productSkn: skn,
page: 1
}, {
code: 200
}).then(data => {
let urls = data.data.product_list.map((item)=>helpers.urlFormat(`/product/pro_${item.product_id}_${item.goods_list[0].goods_id}/${item.cn_alphabet}.html`));
for (let i in originArr.data.product_list) {
originArr.data.product_list[i].goodsUrl = urls[i];
}
return originArr;
});
};
exports.deleteRecordData = (uid, skn) => {
return api.get('', {
method: 'app.browse.delete',
... ...