Authored by 郭成尧

领取优惠券方法+优惠券列表结构修改

@@ -42,8 +42,8 @@ class CouponData @@ -42,8 +42,8 @@ class CouponData
42 { 42 {
43 $param = Yohobuy::param(); 43 $param = Yohobuy::param();
44 $param['method'] = 'app.promotion.getCoupon'; 44 $param['method'] = 'app.promotion.getCoupon';
45 - $param['uid'] = $uid;  
46 $param['couponId'] = $couponId; 45 $param['couponId'] = $couponId;
  46 + $param['uid'] = $uid;
47 $param['client_secret'] = Sign::getSign($param); 47 $param['client_secret'] = Sign::getSign($param);
48 return Yohobuy::get(Yohobuy::API_URL, $param); 48 return Yohobuy::get(Yohobuy::API_URL, $param);
49 } 49 }
@@ -82,6 +82,7 @@ class CouponFloorProcess @@ -82,6 +82,7 @@ class CouponFloorProcess
82 */ 82 */
83 private static function getCoupon($data) 83 private static function getCoupon($data)
84 { 84 {
  85 + $result = array();
85 if (empty($data)) { 86 if (empty($data)) {
86 return array(); 87 return array();
87 } 88 }
@@ -102,8 +103,9 @@ class CouponFloorProcess @@ -102,8 +103,9 @@ class CouponFloorProcess
102 break; 103 break;
103 } 104 }
104 } 105 }
105 - $data['isCoupon'] = true;  
106 - return $data; 106 + $result = $data[0];
  107 + $result['isCoupon'] = true;
  108 + return $result;
107 } 109 }
108 110
109 /** 111 /**
1 {{>layout/header}} 1 {{>layout/header}}
2 {{# floor}} 2 {{# floor}}
3 {{#if isCoupon}} 3 {{#if isCoupon}}
4 - {{#each list}}  
5 <div class="coupon-floor"> 4 <div class="coupon-floor">
6 {{#if title}} 5 {{#if title}}
7 <div class="floor-title">{{title}} 6 <div class="floor-title">{{title}}
@@ -29,7 +28,6 @@ @@ -29,7 +28,6 @@
29 {{/if}} 28 {{/if}}
30 </div> 29 </div>
31 </div> 30 </div>
32 - {{/ list}}  
33 {{/if}} 31 {{/if}}
34 {{/ floor}} 32 {{/ floor}}
35 <div class="floor-mask"></div> 33 <div class="floor-mask"></div>
@@ -34,11 +34,6 @@ class CouponController extends AbstractAction @@ -34,11 +34,6 @@ class CouponController extends AbstractAction
34 if (isset($resource['code']) && $resource['code'] == 200) { 34 if (isset($resource['code']) && $resource['code'] == 200) {
35 $result = CouponFloorProcess::getContent($resource['data']); 35 $result = CouponFloorProcess::getContent($resource['data']);
36 } 36 }
37 - // tar modified 1604191441  
38 - header("Content-type:text/html;charset=utf-8");  
39 - echo '<pre>';  
40 - var_dump($result);  
41 - echo '</pre>';  
42 $this->_view->display('index', array( 37 $this->_view->display('index', array(
43 'floor' => $result, 38 'floor' => $result,
44 'floorPage' => true 39 'floorPage' => true
@@ -71,7 +66,7 @@ class CouponController extends AbstractAction @@ -71,7 +66,7 @@ class CouponController extends AbstractAction
71 } 66 }
72 } else { 67 } else {
73 // 登录后调用领券接口 68 // 登录后调用领券接口
74 - $result = $this->getCouponHandler($receiveData['couponID']); 69 + $result = CouponData::receiveCoupon($this->getUid(),$receiveData['couponID']);
75 switch ($result['code']) { 70 switch ($result['code']) {
76 case 200: 71 case 200:
77 $returnData = [ 72 $returnData = [