...
|
...
|
@@ -25,12 +25,13 @@ class HomeController extends AbstractAction |
|
|
*/
|
|
|
public function init() {
|
|
|
// 检查用户是否登录, 未登录则跳转到登录页
|
|
|
// @todo 为了方便测试,支持传uid参数
|
|
|
$uid = $this->getUid();
|
|
|
if (!$uid) {
|
|
|
// $this->_uid = $this->get('uid', 8826435); //$this->getUid(true);
|
|
|
}
|
|
|
|
|
|
// @todo 为了方便测试,支持传uid参数
|
|
|
$this->_uid = $this->getUid();
|
|
|
/*if (!$uid) {
|
|
|
$uid = $this->_uid = $this->get('uid', 8826435); //$this->getUid(true);
|
|
|
}*/
|
|
|
|
|
|
$action = $this->getRequest()->getActionName();
|
|
|
if (!$this->_uid && $action !== 'index' && !$this->isAjax()) {
|
|
|
$this->go(Helpers::url('/signin.html'));
|
...
|
...
|
@@ -61,7 +62,7 @@ class HomeController extends AbstractAction |
|
|
$channel = Helpers::getChannelByCookie();
|
|
|
$data['recommendForYou'] = UserModel::getPreferenceData($channel);
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->_view->display('index', $data);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -95,7 +96,7 @@ class HomeController extends AbstractAction |
|
|
|
|
|
$tab = $this->get('tab', '');
|
|
|
|
|
|
$favProducts = UserModel::getFavProductData($this->_uid);
|
|
|
$favProducts = UserModel::getFavProductData($this->_uid, 1, 10);
|
|
|
$favBrands = UserModel::getFavBrandData($this->_uid, 10, 1, 10);
|
|
|
|
|
|
$data = array(
|
...
|
...
|
@@ -116,6 +117,44 @@ class HomeController extends AbstractAction |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 用户收藏的商品数据获取接口
|
|
|
*/
|
|
|
public function favProductAction() {
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$page = $this->post('page', 1);
|
|
|
|
|
|
$result = UserModel::getFavProductData($this->_uid, $page, 10);
|
|
|
}
|
|
|
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else {
|
|
|
$this->_view->display('favorite_product', $result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 用户收藏的品牌数据获取接口
|
|
|
*/
|
|
|
public function favBrandAction() {
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$page = $this->post('page', 1);
|
|
|
|
|
|
$result = UserModel::getFavBrandData($this->_uid, 10, $page, 10);
|
|
|
}
|
|
|
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else {
|
|
|
$this->_view->display('favorite_brand', $result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 用户收藏的商品-删除
|
|
|
*/
|
|
|
public function favoriteDelAction() {
|
...
|
...
|
@@ -189,7 +228,6 @@ class HomeController extends AbstractAction |
|
|
$this->setTitle('优惠券');
|
|
|
$this->setNavHeader('优惠券', true, SITE_MAIN);
|
|
|
|
|
|
// $uid = $this->getUid();
|
|
|
$coupons = array(
|
|
|
'couponsUrl' => array(
|
|
|
'used' => UserModel::getCouponData($this->_uid, 0),
|
...
|
...
|
@@ -207,7 +245,7 @@ class HomeController extends AbstractAction |
|
|
* 暂时使用老的,因后面APP、PC、WAP会进行一次改版
|
|
|
*/
|
|
|
public function messageAction() {
|
|
|
$page = $this->get('page', 0);
|
|
|
$page = $this->get('page', 1);
|
|
|
$size = $this->get('size', 10);
|
|
|
|
|
|
$messages = UserModel::getMessageData($this->_uid, $page, $size);
|
...
|
...
|
@@ -296,7 +334,9 @@ class HomeController extends AbstractAction |
|
|
}
|
|
|
}
|
|
|
|
|
|
//在线客服
|
|
|
/**
|
|
|
* 在线客服
|
|
|
*/
|
|
|
public function onlineServiceAction() {
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('在线客服');
|
...
|
...
|
@@ -311,7 +351,9 @@ class HomeController extends AbstractAction |
|
|
));
|
|
|
}
|
|
|
|
|
|
//在线客服-具体详情
|
|
|
/**
|
|
|
* 在线客服-具体详情
|
|
|
*/
|
|
|
public function onlineServiceDetailAction() {
|
|
|
$service = array();
|
|
|
$cateId = $this->get('cateId', 0);
|
...
|
...
|
@@ -392,7 +434,6 @@ class HomeController extends AbstractAction |
|
|
* 异步上传图片
|
|
|
*/
|
|
|
public function suggestimgUploadAction() {
|
|
|
//$filename = $this->post('filename', '');
|
|
|
$result = UserModel::saveSuggestImg('fileData');
|
|
|
|
|
|
$this->echoJson($result);
|
...
|
...
|
@@ -477,8 +518,12 @@ class HomeController extends AbstractAction |
|
|
));
|
|
|
}
|
|
|
|
|
|
//ajax请求订单页面
|
|
|
public function getOrdersAction() {
|
|
|
|
|
|
/**
|
|
|
* ajax请求订单页面
|
|
|
*/
|
|
|
public function getOrdersAction()
|
|
|
{
|
|
|
//判断是不是ajax请求
|
|
|
if (!$this->isAjax()) {
|
|
|
$this->error();
|
...
|
...
|
@@ -487,6 +532,7 @@ class HomeController extends AbstractAction |
|
|
$type = $this->get('type', 1);
|
|
|
$page = $this->get('page', 1);
|
|
|
$limit = $this->get('limit', 10);
|
|
|
|
|
|
//调用模型层getOrder方法获得并处理数据
|
|
|
$data = OrderModel::getOrder($type, $page, $limit, $this->_uid);
|
|
|
/* 如果取不到订单数据时,分两种情况:
|
...
|
...
|
@@ -510,9 +556,7 @@ class HomeController extends AbstractAction |
|
|
/*
|
|
|
* 我的订单-取消订单
|
|
|
*/
|
|
|
|
|
|
public function cancelOrderAction() {
|
|
|
|
|
|
//判断是不是ajax请求
|
|
|
if (!$this->isAjax()) {
|
|
|
$this->error();
|
...
|
...
|
@@ -530,7 +574,6 @@ class HomeController extends AbstractAction |
|
|
/*
|
|
|
* 我的订单-删除订单
|
|
|
*/
|
|
|
|
|
|
public function delOrderAction() {
|
|
|
//判断是不是ajax请求
|
|
|
if (!$this->isAjax()) {
|
...
|
...
|
@@ -558,7 +601,6 @@ class HomeController extends AbstractAction |
|
|
/*
|
|
|
* 我的订单-随便逛逛链接获取
|
|
|
*/
|
|
|
|
|
|
private function strollAction() {
|
|
|
//获取性别、频道数据
|
|
|
$gender = Helpers::getGenderByCookie();
|
...
|
...
|
|