Showing
3 changed files
with
40 additions
and
9 deletions
@@ -147,7 +147,26 @@ const getProductList = (req, res, next) => { | @@ -147,7 +147,26 @@ const getProductList = (req, res, next) => { | ||
147 | }); | 147 | }); |
148 | }; | 148 | }; |
149 | 149 | ||
150 | -const remind = (req, res, next) => {}; | 150 | +// only app |
151 | +const remind = (req, res, next) => { | ||
152 | + if (!(req.yoho.isApp && req.xhr)) { | ||
153 | + return res.status(404).json({ | ||
154 | + msg: '请求不合法' | ||
155 | + }); | ||
156 | + } | ||
157 | + | ||
158 | + return seckillModel.remind({ | ||
159 | + on_off: req.body.on_off, | ||
160 | + activity_id: Number.parseInt(req.body.activity_id, 10), | ||
161 | + product_skn: Number.parseInt(req.body.product_skn, 10), | ||
162 | + uid: Number.parseInt(req.body.uid, 10), | ||
163 | + sec_kill_id: Number.parseInt(req.body.sec_kill_id, 10), | ||
164 | + app_type: 0 | ||
165 | + }) | ||
166 | + .then(result=> { | ||
167 | + return res.json(result); | ||
168 | + }); | ||
169 | +}; | ||
151 | 170 | ||
152 | module.exports = { | 171 | module.exports = { |
153 | index, | 172 | index, |
@@ -21,11 +21,11 @@ const queryActivity = () => { | @@ -21,11 +21,11 @@ const queryActivity = () => { | ||
21 | cache: true | 21 | cache: true |
22 | }) | 22 | }) |
23 | 23 | ||
24 | - // TODO: REMOVE follow | ||
25 | - // .catch() | ||
26 | - // .then(() => { | ||
27 | - // return _.cloneDeep(mock.activities); | ||
28 | - // }); | 24 | + // TODO: REMOVE follow |
25 | + // .catch() | ||
26 | + // .then(() => { | ||
27 | + // return _.cloneDeep(mock.activities); | ||
28 | + // }); | ||
29 | }; | 29 | }; |
30 | 30 | ||
31 | /** | 31 | /** |
@@ -62,7 +62,17 @@ const queryProductList = (activityId) => { | @@ -62,7 +62,17 @@ const queryProductList = (activityId) => { | ||
62 | // }); | 62 | // }); |
63 | }; | 63 | }; |
64 | 64 | ||
65 | +const remind = (options) => { | ||
66 | + let url = ''; | ||
67 | + let formData = Object.assign({ | ||
68 | + method: !options.on_off ? 'app.seckill.cancelUserReminder' : 'app.seckill.addUserReminder', | ||
69 | + }, options); | ||
70 | + | ||
71 | + return api.get(url, formData); | ||
72 | +}; | ||
73 | + | ||
65 | module.exports = { | 74 | module.exports = { |
66 | queryActivity, | 75 | queryActivity, |
67 | - queryProductList | 76 | + queryProductList, |
77 | + remind | ||
68 | }; | 78 | }; |
@@ -320,13 +320,15 @@ seckillObj = { | @@ -320,13 +320,15 @@ seckillObj = { | ||
320 | } | 320 | } |
321 | }) | 321 | }) |
322 | .done(function(res) { | 322 | .done(function(res) { |
323 | - if (res.code === 200) { | 323 | + if (res.code === 200 && res.success) { |
324 | $remindBtn.hide().siblings().show(); | 324 | $remindBtn.hide().siblings().show(); |
325 | tip.show(okTip); | 325 | tip.show(okTip); |
326 | } else { | 326 | } else { |
327 | tip.show(failTip); | 327 | tip.show(failTip); |
328 | - | ||
329 | } | 328 | } |
329 | + }) | ||
330 | + .fail(function() { | ||
331 | + tip.show(failTip); | ||
330 | }); | 332 | }); |
331 | }; | 333 | }; |
332 | 334 |
-
Please register or login to post a comment