Authored by 周少峰

Merge branch 'release/6.1' into gray

@@ -83,7 +83,7 @@ exports.getCouponData = (channel, params) => { @@ -83,7 +83,7 @@ exports.getCouponData = (channel, params) => {
83 exports.getCouponStatus = (params) => { 83 exports.getCouponStatus = (params) => {
84 return Promise.coroutine(function*() { 84 return Promise.coroutine(function*() {
85 const coupon = yield api.get('', Object.assign(params, { 85 const coupon = yield api.get('', Object.assign(params, {
86 - method: 'app.promotion.queryCouponCenter' 86 + method: 'app.promotion.couponStatus'
87 })); 87 }));
88 const result = { 88 const result = {
89 code: coupon.code, 89 code: coupon.code,
@@ -95,26 +95,21 @@ exports.getCouponStatus = (params) => { @@ -95,26 +95,21 @@ exports.getCouponStatus = (params) => {
95 break; 95 break;
96 } 96 }
97 97
98 - coupon.data.forEach(function(val) {  
99 - if (val.template_name === 'getCoupon' && val.data.length) {  
100 - // 优惠券楼层  
101 - val.data.forEach(function(item) {  
102 - const status = Number(item.status); 98 + coupon.data.forEach(function(item) {
  99 + const status = Number(item.status);
103 100
104 - if ([2, 3].indexOf(status) > -1) {  
105 - const cou = {  
106 - id: crypto.encryption('yoho9646abcdefgh', item.couponID) // 加密优惠券号  
107 - }; 101 + if ([2, 3].indexOf(status) > -1) {
  102 + const cou = {
  103 + id: crypto.encryption('yoho9646abcdefgh', String(item.couponId)) // 加密优惠券号
  104 + };
108 105
109 - if (status === 2) {  
110 - cou.empty = true; // 优惠券已抢光  
111 - } else if (status === 3) {  
112 - cou.got = true; // 优惠券已领取  
113 - } 106 + if (status === 2) {
  107 + cou.empty = true; // 优惠券已抢光
  108 + } else if (status === 3) {
  109 + cou.got = true; // 优惠券已领取
  110 + }
114 111
115 - result.categories.push(cou);  
116 - }  
117 - }); 112 + result.categories.push(cou);
118 } 113 }
119 }); 114 });
120 } 115 }