Home.php 2.48 KB
<?php

use Action\AbstractAction;
use Plugin\Helpers;

/**
 * 个人中心相关的控制器
 * 
 * @name HomeController
 * @package 
 * @copyright yoho.inc
 * @version 1.0 (2015-10-28 16:28:32)
 * @author fei.hong <fei.hong@yoho.cn>
 */
class HomeController extends AbstractAction
{
    /**
     * 个人中心入口
     */
    public function indexAction()
    {
	    $uid = $uid = $this->getUid();;

	    $data = \Index\UserModel::getUserProfileData($uid);

	    print_r($data);
        // 设置网站标题
        $this->setTitle('男生首页');

        $this->_view->display('index', array(
            'homeHeader' => array('searchUrl' => Helpers::url('/search', null, 'search')),
            'pageFooter' => true,
        ));
    }

	/**
	 * 用户订单
	 */
	public function ordersAction()
	{
		$uid = $this->getUid();
		$type = $this->get('type', 1);

		$orders = \Index\UserModel::getUserOrderData(967016, $type);

		print_r($orders);
	}

	/**
	 * 用户收藏的商品
	 */
	public function favoriteAction()
	{
		$uid = $this->getUid();

		$favProducts = \Index\UserModel::getFavProductData($uid);

		print_r($favProducts);
	}

	/**
	 * 用户收藏的品牌
	 */
	public function favoritebrandAction()
	{
		$uid = $this->getUid();
		$gender = Helpers::getGenderByCookie();

		$favBrands = \Index\UserModel::getFavBrandData($uid, $gender);

		print_r($favBrands);
	}

	/**
	 * YOHO币
	 */
	public function currencyAction()
	{
		$uid = $this->getUid();

		$favBrands = \Index\UserModel::getYohoCoinData($uid);

		print_r($favBrands);
	}

	/**
	 * 优惠券
	 */
	public function couponsAction()
	{
		$uid = $this->getUid();
		$status = $this->get('status', 0);

		$coupons = \Index\UserModel::getCouponData($uid, $status);

		print_r($coupons);
	}

	/**
	 * 地址管理
	 */
	public function addressAction()
	{
		$uid = $this->getUid();

		$address = \Index\UserModel::getAddressData($uid);

		print_r($address);
	}

	/**
	 * 意见反馈
	 */
	public function suggestAction()
	{
		$udid = $this->getUdid();
		$page = $this->get('page', 1);
		$limit = $this->get('limit', 30);

		$suggest = \Index\UserModel::getSuggestData($udid, $page, $limit);

		print_r($suggest);
	}

	/**
	 * 异步保存意见反馈数据
	 */
	public function savesuggestAction()
	{
		if($this->isAjax()) {
			$uid = $this->getUid();
			$content = $this->post('content', '');
			$suggest_type = $this->get('suggest_type', 2);

			$result = \Index\UserModel::saveSuggestData($uid, $content, $suggest_type);

			$this->echoJson($result);
		}

	}
    
}