Authored by Rock Zhang

修复优惠券接口

... ... @@ -26,7 +26,7 @@ class UserData
public static function userData($uid)
{
$param = array();
$param['uid'] = $uid;
$param['uid'] = 10064;
return Yohobuy::jsonPost(Yohobuy::API_URL_MYCENTER . 'ProfilesRest/getUserprofile', $param);
}
... ... @@ -222,11 +222,10 @@ class UserData
* 优惠券数据
*
* @param int $uid 用户ID
* @param int $page 第几页,默认1
* @param int $limit 限制读取的数目,默认10
* @param int $status 优惠券状态,0表示未使用,1表示已使用
* @return array 优惠券接口返回的数据
*/
public static function couponData($uid, $page = 1, $limit = 10)
public static function couponData($uid, $status)
{
$param = Yohobuy::param();
$param['uid'] = $uid;
... ...
... ... @@ -27,9 +27,9 @@ class HomeController extends AbstractAction
public function init()
{
// 检查用户是否登录, 未登录则跳转到登录页
$uid = 8826435; //$this->getUid(true);
$this->_uid = $this->getUid(false);
$action = $this->getRequest()->getActionName();
if (!$uid && $action !== 'index') {
if (!$this->_uid && $action !== 'index') {
$this->go(Helpers::url('/signin.html'));
}
... ... @@ -49,11 +49,10 @@ class HomeController extends AbstractAction
'myIndexPage' => true,
'pageFooter' => true
);
$uid = $this->getUid();
if ($uid) {
if ($this->_uid) {
$data['isLogin'] = true;
$data += UserModel::getUserProfileData($uid);
$data += UserModel::getInfoNumData($uid);
$data += UserModel::getUserProfileData($this->_uid);
$data += UserModel::getInfoNumData($this->_uid);
// 优选新品数据
$channel = Helpers::getChannelByCookie();
... ... @@ -73,10 +72,9 @@ class HomeController extends AbstractAction
$this->setNavHeader('我的收藏', true, SITE_MAIN);
$tab = $this->get('tab', '');
$uid = $this->getUid();
$favProducts = UserModel::getFavProductData($uid);
$favBrands = UserModel::getFavBrandData($uid, 10, 1, 10);
$favProducts = UserModel::getFavProductData($this->_uid);
$favBrands = UserModel::getFavBrandData($this->_uid, 10, 1, 10);
$data = array(
'favPage' => true, //加载js
... ... @@ -158,8 +156,8 @@ class HomeController extends AbstractAction
$uid = 8826435;
$coupons = array(
'couponsUrl' => array(
'used' => \Index\UserModel::getCouponData($uid, 0),
'unused' => \Index\UserModel::getCouponData($uid, 1)
'used' => UserModel::getCouponData($uid, 0),
'unused' => UserModel::getCouponData($uid, 1)
),
'couponsPage' => true
);
... ...
... ... @@ -299,14 +299,15 @@ class UserModel
* 处理优惠券数据
*
* @param int $uid 用户ID
* @param int $status 优惠券状态,0表示未使用,1表示已使用
* @return array|mixed 处理之后的优惠券数据
*/
public static function getCouponData($uid)
public static function getCouponData($uid, $status)
{
$result = array();
// 调用接口获取优惠券数据
$coupons = UserData::couponData($uid);
$coupons = UserData::couponData($uid, $status);
// 处理优惠券数据
if (isset($coupons['info']) && $coupons['info']) {
... ...