Gift.php 1.49 KB
<?php

use Action\WebAction;
use WebPlugin\Helpers;
use Home\UserModel;
use Home\AddressModel;
use Home\ReturnsModel;
use LibModels\Web\Home\UserData;
use LibModels\Web\Home\AddressData;

/**
 * 个人中心 礼品卡兑换
 */

class GiftController extends WebAction
{
    /**
     * 个人中心-兑换礼品卡提交返回信息
     */
    public function exchangeAction()
    {
        //判断是否登录
        $this->auditJumpLogin();

        //头部导航
        $channel = Helpers::getChannelNameByCookie();
        $this->setWebNavHeader($channel);
        //面包屑-左侧导航
        $path = UserModel::getCenterCrumb('兑换礼品卡');
        $leftNav = UserModel::getCenterLeftNav('兑换礼品卡');
        //用户信息

        $data = array(
            'path' => $path,
            'homeNav' => $leftNav,
            'giftOk' => true,
            'isFail' => false
        );

        $this->_view->display('../../index/home/gift', array(
            'gift' => $data
        ));
    }

    /**
     * 通过当前用户审判是否跳到登录
     *
     * @param int $useSession (true:从服务端session中检查, false:从客户端cookie中检查)
     * @return void
     */
    protected function auditJumpLogin($useSession = true)
    {
        $uid = $this->getUid($useSession);
        if (!$uid) {
            $this->go(Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', SITE_MAIN))));
        }
        else {
            return $uid;
        }
    }
}