Showing
3 changed files
with
26 additions
and
0 deletions
@@ -58,3 +58,21 @@ exports.productLst = function(req, res, next) { | @@ -58,3 +58,21 @@ exports.productLst = function(req, res, next) { | ||
58 | res.jsonp(result); | 58 | res.jsonp(result); |
59 | }).catch(next); | 59 | }).catch(next); |
60 | }; | 60 | }; |
61 | + | ||
62 | +exports.coupon = function(req, res, next) { | ||
63 | + let activity_template_id = req.query.activity_id; | ||
64 | + let uid = req.user.uid || req.query.uid; | ||
65 | + | ||
66 | + if (!uid || !activity_template_id) { | ||
67 | + return res.jsonp({ | ||
68 | + code: 400 | ||
69 | + }); | ||
70 | + } | ||
71 | + | ||
72 | + model.getCoupon({ | ||
73 | + activity_template_id, | ||
74 | + uid | ||
75 | + }).then((result) => { | ||
76 | + res.jsonp(result); | ||
77 | + }).catch(next); | ||
78 | +}; |
@@ -59,5 +59,12 @@ module.exports = { | @@ -59,5 +59,12 @@ module.exports = { | ||
59 | }); | 59 | }); |
60 | return data; | 60 | return data; |
61 | }); | 61 | }); |
62 | + }, | ||
63 | + getCoupon: function(params) { | ||
64 | + return api.get('', Object.assign({ | ||
65 | + method: 'app.coupons.personalCoupons' | ||
66 | + }, params), { | ||
67 | + cache: true | ||
68 | + }); | ||
62 | } | 69 | } |
63 | }; | 70 | }; |
@@ -226,6 +226,7 @@ router.get('/redbag/2017', redbag.index); | @@ -226,6 +226,7 @@ router.get('/redbag/2017', redbag.index); | ||
226 | 226 | ||
227 | // 获取活动页面个性化推荐商品数据 | 227 | // 获取活动页面个性化推荐商品数据 |
228 | router.get('/individuation', individuation.productLst); | 228 | router.get('/individuation', individuation.productLst); |
229 | +router.get('/individuation/coupon', individuation.coupon); | ||
229 | 230 | ||
230 | // 活动页模版 | 231 | // 活动页模版 |
231 | router.get('/feature/:code.html', feature.index); | 232 | router.get('/feature/:code.html', feature.index); |
-
Please register or login to post a comment