|
@@ -2,7 +2,6 @@ |
|
@@ -2,7 +2,6 @@ |
2
|
'use strict';
|
2
|
'use strict';
|
3
|
|
3
|
|
4
|
const Promise = require('bluebird');
|
4
|
const Promise = require('bluebird');
|
5
|
-const api = global.yoho.API;
|
|
|
6
|
const _ = require('lodash');
|
5
|
const _ = require('lodash');
|
7
|
const helpers = global.yoho.helpers;
|
6
|
const helpers = global.yoho.helpers;
|
8
|
const crypto = global.yoho.crypto;
|
7
|
const crypto = global.yoho.crypto;
|
|
@@ -279,11 +278,15 @@ class couponFloor extends global.yoho.BaseModel { |
|
@@ -279,11 +278,15 @@ class couponFloor extends global.yoho.BaseModel { |
279
|
}
|
278
|
}
|
280
|
|
279
|
|
281
|
floor(params, isApp, appVersion) {
|
280
|
floor(params, isApp, appVersion) {
|
|
|
281
|
+ let that = this;
|
|
|
282
|
+
|
282
|
return Promise.coroutine(function*() {
|
283
|
return Promise.coroutine(function*() {
|
283
|
let result = {},
|
284
|
let result = {},
|
284
|
- resource = yield api.get('', Object.assign(params, {
|
285
|
+ resource = yield that.get({
|
|
|
286
|
+ data: Object.assign(params, {
|
285
|
method: 'app.promotion.queryCouponCenter',
|
287
|
method: 'app.promotion.queryCouponCenter',
|
286
|
- }));
|
288
|
+ })
|
|
|
289
|
+ });
|
287
|
|
290
|
|
288
|
if (resource && resource.code === 200) {
|
291
|
if (resource && resource.code === 200) {
|
289
|
result = _getContent(resource.data, isApp);
|
292
|
result = _getContent(resource.data, isApp);
|
|
@@ -298,10 +301,14 @@ class couponFloor extends global.yoho.BaseModel { |
|
@@ -298,10 +301,14 @@ class couponFloor extends global.yoho.BaseModel { |
298
|
}
|
301
|
}
|
299
|
|
302
|
|
300
|
status(params) {
|
303
|
status(params) {
|
|
|
304
|
+ let that = this;
|
|
|
305
|
+
|
301
|
return Promise.coroutine(function*() {
|
306
|
return Promise.coroutine(function*() {
|
302
|
- const resource = yield api.get('', Object.assign(params, {
|
307
|
+ const resource = yield that.get({
|
|
|
308
|
+ data: Object.assign(params, {
|
303
|
method: 'app.promotion.couponStatus'
|
309
|
method: 'app.promotion.couponStatus'
|
304
|
- }));
|
310
|
+ })
|
|
|
311
|
+ });
|
305
|
const result = {
|
312
|
const result = {
|
306
|
code: resource.code,
|
313
|
code: resource.code,
|
307
|
data: []
|
314
|
data: []
|
|
@@ -332,10 +339,12 @@ class couponFloor extends global.yoho.BaseModel { |
|
@@ -332,10 +339,12 @@ class couponFloor extends global.yoho.BaseModel { |
332
|
}
|
339
|
}
|
333
|
|
340
|
|
334
|
// 登录后调用领券接口
|
341
|
// 登录后调用领券接口
|
335
|
- return api.get('', {
|
342
|
+ return this.get({
|
|
|
343
|
+ data: {
|
336
|
method: 'app.promotion.getCoupon',
|
344
|
method: 'app.promotion.getCoupon',
|
337
|
couponId: receiveData.couponID,
|
345
|
couponId: receiveData.couponID,
|
338
|
uid: uid
|
346
|
uid: uid
|
|
|
347
|
+ }
|
339
|
}).then(result => {
|
348
|
}).then(result => {
|
340
|
switch (result.code) {
|
349
|
switch (result.code) {
|
341
|
case 200:
|
350
|
case 200:
|
|
@@ -394,8 +403,9 @@ class couponFloor extends global.yoho.BaseModel { |
|
@@ -394,8 +403,9 @@ class couponFloor extends global.yoho.BaseModel { |
394
|
};
|
403
|
};
|
395
|
}
|
404
|
}
|
396
|
|
405
|
|
397
|
- return api.get('', data).then(result => {
|
|
|
398
|
-
|
406
|
+ return this.get({
|
|
|
407
|
+ data: data
|
|
|
408
|
+ }).then(result => {
|
399
|
if (!result) {
|
409
|
if (!result) {
|
400
|
result.code = 404;
|
410
|
result.code = 404;
|
401
|
result.message = '出错啦~';
|
411
|
result.message = '出错啦~';
|