Authored by 陈峰

ufo-coupon

... ... @@ -71,6 +71,7 @@ exports.bottombar = function(req, res, next) {
*/
exports.couponSend = (req, res, next) => {
let token = req.query.token || '',
coupontype = req.query.coupontype,
uid = req.user.uid,
app = req.query.app || {};
... ... @@ -100,8 +101,11 @@ exports.couponSend = (req, res, next) => {
if (uid === '' || uid === 0 || token === '' || token === 0) {
return res.jsonp(resultData);
}
const promise = coupontype === 'ufo' ?
req.ctx(model).couponSendUFO(uid, token) :
req.ctx(model).couponSend(uid, token);
req.ctx(model).couponSend(uid, token).then(result => {
promise.then(result => {
res.set({
'Cache-Control': 'no-cache',
Pragma: 'no-cache',
... ...
... ... @@ -376,6 +376,27 @@ class featureModel extends global.yoho.BaseModel {
});
}
/**
* 领取UFO优惠券
*/
couponSendUFO(uid, token) {
let data = {
method: 'app.redpac.addRedpac',
uid: uid,
redpacToken: token,
actSource: 1004,
};
return this.get({data}).then(result => {
if (!result) {
result.code = 404;
result.message = '出错啦~';
}
return result;
});
}
}
module.exports = featureModel;
... ...