Authored by Rock Zhang

修复优惠券接口

@@ -26,7 +26,7 @@ class UserData @@ -26,7 +26,7 @@ class UserData
26 public static function userData($uid) 26 public static function userData($uid)
27 { 27 {
28 $param = array(); 28 $param = array();
29 - $param['uid'] = $uid; 29 + $param['uid'] = 10064;
30 30
31 return Yohobuy::jsonPost(Yohobuy::API_URL_MYCENTER . 'ProfilesRest/getUserprofile', $param); 31 return Yohobuy::jsonPost(Yohobuy::API_URL_MYCENTER . 'ProfilesRest/getUserprofile', $param);
32 } 32 }
@@ -222,11 +222,10 @@ class UserData @@ -222,11 +222,10 @@ class UserData
222 * 优惠券数据 222 * 优惠券数据
223 * 223 *
224 * @param int $uid 用户ID 224 * @param int $uid 用户ID
225 - * @param int $page 第几页,默认1  
226 - * @param int $limit 限制读取的数目,默认10 225 + * @param int $status 优惠券状态,0表示未使用,1表示已使用
227 * @return array 优惠券接口返回的数据 226 * @return array 优惠券接口返回的数据
228 */ 227 */
229 - public static function couponData($uid, $page = 1, $limit = 10) 228 + public static function couponData($uid, $status)
230 { 229 {
231 $param = Yohobuy::param(); 230 $param = Yohobuy::param();
232 $param['uid'] = $uid; 231 $param['uid'] = $uid;
@@ -27,9 +27,9 @@ class HomeController extends AbstractAction @@ -27,9 +27,9 @@ class HomeController extends AbstractAction
27 public function init() 27 public function init()
28 { 28 {
29 // 检查用户是否登录, 未登录则跳转到登录页 29 // 检查用户是否登录, 未登录则跳转到登录页
30 - $uid = 8826435; //$this->getUid(true); 30 + $this->_uid = $this->getUid(false);
31 $action = $this->getRequest()->getActionName(); 31 $action = $this->getRequest()->getActionName();
32 - if (!$uid && $action !== 'index') { 32 + if (!$this->_uid && $action !== 'index') {
33 $this->go(Helpers::url('/signin.html')); 33 $this->go(Helpers::url('/signin.html'));
34 } 34 }
35 35
@@ -49,11 +49,10 @@ class HomeController extends AbstractAction @@ -49,11 +49,10 @@ class HomeController extends AbstractAction
49 'myIndexPage' => true, 49 'myIndexPage' => true,
50 'pageFooter' => true 50 'pageFooter' => true
51 ); 51 );
52 - $uid = $this->getUid();  
53 - if ($uid) { 52 + if ($this->_uid) {
54 $data['isLogin'] = true; 53 $data['isLogin'] = true;
55 - $data += UserModel::getUserProfileData($uid);  
56 - $data += UserModel::getInfoNumData($uid); 54 + $data += UserModel::getUserProfileData($this->_uid);
  55 + $data += UserModel::getInfoNumData($this->_uid);
57 56
58 // 优选新品数据 57 // 优选新品数据
59 $channel = Helpers::getChannelByCookie(); 58 $channel = Helpers::getChannelByCookie();
@@ -73,10 +72,9 @@ class HomeController extends AbstractAction @@ -73,10 +72,9 @@ class HomeController extends AbstractAction
73 $this->setNavHeader('我的收藏', true, SITE_MAIN); 72 $this->setNavHeader('我的收藏', true, SITE_MAIN);
74 73
75 $tab = $this->get('tab', ''); 74 $tab = $this->get('tab', '');
76 - $uid = $this->getUid();  
77 75
78 - $favProducts = UserModel::getFavProductData($uid);  
79 - $favBrands = UserModel::getFavBrandData($uid, 10, 1, 10); 76 + $favProducts = UserModel::getFavProductData($this->_uid);
  77 + $favBrands = UserModel::getFavBrandData($this->_uid, 10, 1, 10);
80 78
81 $data = array( 79 $data = array(
82 'favPage' => true, //加载js 80 'favPage' => true, //加载js
@@ -158,8 +156,8 @@ class HomeController extends AbstractAction @@ -158,8 +156,8 @@ class HomeController extends AbstractAction
158 $uid = 8826435; 156 $uid = 8826435;
159 $coupons = array( 157 $coupons = array(
160 'couponsUrl' => array( 158 'couponsUrl' => array(
161 - 'used' => \Index\UserModel::getCouponData($uid, 0),  
162 - 'unused' => \Index\UserModel::getCouponData($uid, 1) 159 + 'used' => UserModel::getCouponData($uid, 0),
  160 + 'unused' => UserModel::getCouponData($uid, 1)
163 ), 161 ),
164 'couponsPage' => true 162 'couponsPage' => true
165 ); 163 );
@@ -299,14 +299,15 @@ class UserModel @@ -299,14 +299,15 @@ class UserModel
299 * 处理优惠券数据 299 * 处理优惠券数据
300 * 300 *
301 * @param int $uid 用户ID 301 * @param int $uid 用户ID
  302 + * @param int $status 优惠券状态,0表示未使用,1表示已使用
302 * @return array|mixed 处理之后的优惠券数据 303 * @return array|mixed 处理之后的优惠券数据
303 */ 304 */
304 - public static function getCouponData($uid) 305 + public static function getCouponData($uid, $status)
305 { 306 {
306 $result = array(); 307 $result = array();
307 308
308 // 调用接口获取优惠券数据 309 // 调用接口获取优惠券数据
309 - $coupons = UserData::couponData($uid); 310 + $coupons = UserData::couponData($uid, $status);
310 311
311 // 处理优惠券数据 312 // 处理优惠券数据
312 if (isset($coupons['info']) && $coupons['info']) { 313 if (isset($coupons['info']) && $coupons['info']) {