Authored by 陈轩

sec kill add reminder

... ... @@ -147,7 +147,26 @@ const getProductList = (req, res, next) => {
});
};
const remind = (req, res, next) => {};
// only app
const remind = (req, res, next) => {
if (!(req.yoho.isApp && req.xhr)) {
return res.status(404).json({
msg: '请求不合法'
});
}
return seckillModel.remind({
on_off: req.body.on_off,
activity_id: Number.parseInt(req.body.activity_id, 10),
product_skn: Number.parseInt(req.body.product_skn, 10),
uid: Number.parseInt(req.body.uid, 10),
sec_kill_id: Number.parseInt(req.body.sec_kill_id, 10),
app_type: 0
})
.then(result=> {
return res.json(result);
});
};
module.exports = {
index,
... ...
... ... @@ -21,11 +21,11 @@ const queryActivity = () => {
cache: true
})
// TODO: REMOVE follow
// .catch()
// .then(() => {
// return _.cloneDeep(mock.activities);
// });
// TODO: REMOVE follow
// .catch()
// .then(() => {
// return _.cloneDeep(mock.activities);
// });
};
/**
... ... @@ -62,7 +62,17 @@ const queryProductList = (activityId) => {
// });
};
const remind = (options) => {
let url = '';
let formData = Object.assign({
method: !options.on_off ? 'app.seckill.cancelUserReminder' : 'app.seckill.addUserReminder',
}, options);
return api.get(url, formData);
};
module.exports = {
queryActivity,
queryProductList
queryProductList,
remind
};
... ...
... ... @@ -320,13 +320,15 @@ seckillObj = {
}
})
.done(function(res) {
if (res.code === 200) {
if (res.code === 200 && res.success) {
$remindBtn.hide().siblings().show();
tip.show(okTip);
} else {
tip.show(failTip);
}
})
.fail(function() {
tip.show(failTip);
});
};
... ...