Authored by 郝肖肖

'ctx'

... ... @@ -2,7 +2,6 @@
'use strict';
const Promise = require('bluebird');
const api = global.yoho.API;
const _ = require('lodash');
const helpers = global.yoho.helpers;
const crypto = global.yoho.crypto;
... ... @@ -279,11 +278,15 @@ class couponFloor extends global.yoho.BaseModel {
}
floor(params, isApp, appVersion) {
let that = this;
return Promise.coroutine(function*() {
let result = {},
resource = yield api.get('', Object.assign(params, {
method: 'app.promotion.queryCouponCenter',
}));
resource = yield that.get({
data: Object.assign(params, {
method: 'app.promotion.queryCouponCenter',
})
});
if (resource && resource.code === 200) {
result = _getContent(resource.data, isApp);
... ... @@ -298,10 +301,14 @@ class couponFloor extends global.yoho.BaseModel {
}
status(params) {
let that = this;
return Promise.coroutine(function*() {
const resource = yield api.get('', Object.assign(params, {
method: 'app.promotion.couponStatus'
}));
const resource = yield that.get({
data: Object.assign(params, {
method: 'app.promotion.couponStatus'
})
});
const result = {
code: resource.code,
data: []
... ... @@ -332,10 +339,12 @@ class couponFloor extends global.yoho.BaseModel {
}
// 登录后调用领券接口
return api.get('', {
method: 'app.promotion.getCoupon',
couponId: receiveData.couponID,
uid: uid
return this.get({
data: {
method: 'app.promotion.getCoupon',
couponId: receiveData.couponID,
uid: uid
}
}).then(result => {
switch (result.code) {
case 200:
... ... @@ -394,8 +403,9 @@ class couponFloor extends global.yoho.BaseModel {
};
}
return api.get('', data).then(result => {
return this.get({
data: data
}).then(result => {
if (!result) {
result.code = 404;
result.message = '出错啦~';
... ...
const api = global.yoho.API;
const _ = require('lodash');
const moment = require('moment');
... ... @@ -11,9 +10,11 @@ module.exports = class extends global.yoho.BaseModel {
* 领取验证以及领券列表
*/
freeMail(uid, verify) {
return api.get('', {
method: 'app.coupons.queryFreePostCoupons',
uid: uid
return this.get({
data: {
method: 'app.coupons.queryFreePostCoupons',
uid: uid
}
}).then((result) => {
if (verify) {
return result;
... ... @@ -34,11 +35,11 @@ module.exports = class extends global.yoho.BaseModel {
}
receiveCoupon(uid) {
return api.get('', {
method: 'app.coupons.getFreePostCoupons',
uid: uid
}).then((result) => {
return result;
return this.get({
data: {
method: 'app.coupons.getFreePostCoupons',
uid: uid
}
});
}
};
... ...