Authored by 李奇

app.coupons.couponsSend修改完成

... ... @@ -22,7 +22,7 @@ const _getPname = (req) => {
};
exports.index = function(req, res, next) {
model.index({
req.ctx(model).index({
code: req.params.code,
type: stringProcess.paramsFilter(req.query.type),
from_page_name: _getPname(req),
... ... @@ -53,7 +53,7 @@ exports.index = function(req, res, next) {
};
exports.sidebar = function(req, res, next) {
model.index({
req.ctx(model).index({
code: req.params.code
}).then((result) => {
if (!result) {
... ... @@ -68,7 +68,7 @@ exports.sidebar = function(req, res, next) {
exports.bottombar = function(req, res, next) {
model.index({
req.ctx(model).index({
code: req.params.code
}).then((result) => {
if (!result) {
... ... @@ -117,7 +117,7 @@ exports.couponSend = (req, res, next) => {
return res.jsonp(resultData);
}
model.couponSend(uid, token).then(result => {
req.ctx(model).couponSend(uid, token).then(result => {
res.set({
'Cache-Control': 'no-cache',
Pragma: 'no-cache',
... ...
... ... @@ -57,8 +57,8 @@ const _getShopGroup = (shopRawData) => {
});
};
module.exports = {
index: function(params) {
class featureModel extends global.yoho.BaseModel {
index(params) {
return Promise.coroutine(function*() {
if (!params.code) {
return Promise.resolve({});
... ... @@ -134,7 +134,7 @@ module.exports = {
return data;
})();
},
}
/**
* 领取优惠券
... ... @@ -157,8 +157,7 @@ module.exports = {
};
}
return api.get('', data).then(result => {
return this.get({data}).then(result => {
if (!result) {
result.code = 404;
result.message = '出错啦~';
... ... @@ -167,4 +166,7 @@ module.exports = {
return result;
});
}
};
}
module.exports = featureModel;
... ...