Authored by Rock Zhang

修复app中不能领券的bug

Code Review By Rock Zhang
@@ -54,4 +54,7 @@ @@ -54,4 +54,7 @@
54 返回 54 返回
55 </a> 55 </a>
56 </div> 56 </div>
  57 + {{#if isApp}}
  58 + <input type="hidden" value="{{getCouponUrl}}" id="getCouponUrl">
  59 + {{/if}}
57 {{> cuxiao/xinshili/footer}} 60 {{> cuxiao/xinshili/footer}}
@@ -12,9 +12,6 @@ class XinshiliController extends HuodongAction @@ -12,9 +12,6 @@ class XinshiliController extends HuodongAction
12 // const STATIC_FILE = 'http://localhost:2222/1.0.3'; 12 // const STATIC_FILE = 'http://localhost:2222/1.0.3';
13 const STATIC_FILE = 'http://cdn.yoho.cn/huodong/2016xinshili/1.0.3'; 13 const STATIC_FILE = 'http://cdn.yoho.cn/huodong/2016xinshili/1.0.3';
14 14
15 - protected $_uid;  
16 -  
17 -  
18 /** 15 /**
19 * 检测登录状态 16 * 检测登录状态
20 * 17 *
@@ -22,10 +19,12 @@ class XinshiliController extends HuodongAction @@ -22,10 +19,12 @@ class XinshiliController extends HuodongAction
22 private function getLoggedUid() 19 private function getLoggedUid()
23 { 20 {
24 if ($this->_isApp) { 21 if ($this->_isApp) {
25 - $this->_uid = $this->get('uid'); 22 + $uid = $this->get('uid');
26 } else { 23 } else {
27 - $this->_uid = $this->getUid(); 24 + $uid = $this->getUid();
28 } 25 }
  26 +
  27 + return $uid;
29 } 28 }
30 29
31 /** 30 /**
@@ -35,8 +34,7 @@ class XinshiliController extends HuodongAction @@ -35,8 +34,7 @@ class XinshiliController extends HuodongAction
35 { 34 {
36 $playUrl = Helpers::url('/cuxiao/xinshili/index'); 35 $playUrl = Helpers::url('/cuxiao/xinshili/index');
37 36
38 - $this->getLoggedUid();  
39 - if (!$this->_uid) { 37 + if (!$this->getLoggedUid()) {
40 if (!$this->_isApp) { 38 if (!$this->_isApp) {
41 $this->go(Helpers::url('/signin.html', array('refer' => $playUrl), 'default')); 39 $this->go(Helpers::url('/signin.html', array('refer' => $playUrl), 'default'));
42 } else { 40 } else {
@@ -63,6 +61,8 @@ class XinshiliController extends HuodongAction @@ -63,6 +61,8 @@ class XinshiliController extends HuodongAction
63 'home.js' 61 'home.js'
64 ), 62 ),
65 'couponUrl' => $myCouponUrl, // 个人中心优惠券地址 63 'couponUrl' => $myCouponUrl, // 个人中心优惠券地址
  64 + 'isApp' => $this->_isApp,
  65 + 'getCouponUrl' => Helpers::url('/cuxiao/xinshili/sendCoupon', array('uid' => $this->getLoggedUid())),
66 'banner' => array( 66 'banner' => array(
67 'img' => '', 67 'img' => '',
68 'url' => 'http://feature.yoho.cn/0302/0302APPHOME/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"YOHO!BUY有货【春潮新势力】","url":"http://feature.yoho.cn/0302/0302APPHOME/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"386"},"param":{"share_id":"386"}}' 68 'url' => 'http://feature.yoho.cn/0302/0302APPHOME/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"YOHO!BUY有货【春潮新势力】","url":"http://feature.yoho.cn/0302/0302APPHOME/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"386"},"param":{"share_id":"386"}}'
@@ -89,7 +89,8 @@ class XinshiliController extends HuodongAction @@ -89,7 +89,8 @@ class XinshiliController extends HuodongAction
89 } 89 }
90 90
91 $activityId = $this->getActivityId(); 91 $activityId = $this->getActivityId();
92 - $result = XinshiliModel::getXinshiliCoupon($this->_uid, $activityId); 92 + $uid = $this->getLoggedUid();
  93 + $result = XinshiliModel::getXinshiliCoupon($uid, $activityId);
93 } while (false); 94 } while (false);
94 95
95 $this->echoJson($result); 96 $this->echoJson($result);