...
|
...
|
@@ -20,20 +20,20 @@ class HomeController extends AbstractAction |
|
|
|
|
|
protected $_uid;
|
|
|
|
|
|
// /**
|
|
|
// * 初始化
|
|
|
// */
|
|
|
// public function init()
|
|
|
// {
|
|
|
// // 检查用户是否登录, 未登录则跳转到登录页
|
|
|
// $uid = $this->getUid(true);
|
|
|
// $action = $this->getRequest()->getActionName();
|
|
|
// if (!$uid && $action !== 'index') {
|
|
|
// $this->go(Helpers::url('/signin.html'));
|
|
|
// }
|
|
|
//
|
|
|
// parent::init();
|
|
|
// }
|
|
|
/**
|
|
|
* 初始化
|
|
|
*/
|
|
|
public function init()
|
|
|
{
|
|
|
// 检查用户是否登录, 未登录则跳转到登录页
|
|
|
$uid = 8826435; //$this->getUid(true);
|
|
|
$action = $this->getRequest()->getActionName();
|
|
|
if (!$uid && $action !== 'index') {
|
|
|
$this->go(Helpers::url('/signin.html'));
|
|
|
}
|
|
|
|
|
|
parent::init();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 个人中心入口
|
...
|
...
|
@@ -44,21 +44,20 @@ class HomeController extends AbstractAction |
|
|
$this->setTitle('个人中心');
|
|
|
$this->setNavHeader('个人中心');
|
|
|
|
|
|
$data = array(
|
|
|
'myIndexPage' => true,
|
|
|
'pageFooter' => true
|
|
|
);
|
|
|
$data = array(
|
|
|
'myIndexPage' => true,
|
|
|
'pageFooter' => true
|
|
|
);
|
|
|
$uid = $this->getUid();
|
|
|
if ($uid) {
|
|
|
$data['isLogin'] = true;
|
|
|
$uid = 8826435;
|
|
|
$data += \Index\UserModel::getUserProfileData($uid);
|
|
|
$data += \Index\UserModel::getInfoNumData($uid);
|
|
|
|
|
|
// 优选新品数据
|
|
|
$channel = Helpers::getChannelByCookie();
|
|
|
$data['recommendForYou'] = \Index\UserModel::getPreferenceData($channel);
|
|
|
}
|
|
|
if ($uid) {
|
|
|
$data['isLogin'] = true;
|
|
|
$data += \Index\UserModel::getUserProfileData($uid);
|
|
|
$data += \Index\UserModel::getInfoNumData($uid);
|
|
|
|
|
|
// 优选新品数据
|
|
|
$channel = Helpers::getChannelByCookie();
|
|
|
$data['recommendForYou'] = \Index\UserModel::getPreferenceData($channel);
|
|
|
}
|
|
|
|
|
|
$this->_view->display('index', $data);
|
|
|
}
|
...
|
...
|
@@ -74,23 +73,22 @@ class HomeController extends AbstractAction |
|
|
|
|
|
$tab = $this->get('tab', '');
|
|
|
$uid = $this->getUid();
|
|
|
$uid = 8826435;
|
|
|
$gender = Helpers::getGenderByCookie();
|
|
|
|
|
|
$favProducts = \Index\UserModel::getFavProductData($uid);
|
|
|
$favBrands = \Index\UserModel::getFavBrandData($uid, $gender);
|
|
|
|
|
|
$data = array(
|
|
|
'favPage' => true, //加载js
|
|
|
'pageFooter' => true,
|
|
|
'favorite' => true,
|
|
|
'hasFavProduct' => $favProducts,
|
|
|
'hasFavBrand' => $favBrands
|
|
|
);
|
|
|
// 判断是否为品牌收藏页
|
|
|
if ($tab === 'brand') {
|
|
|
$data['brandTab'] = true;
|
|
|
}
|
|
|
$data = array(
|
|
|
'favPage' => true, //加载js
|
|
|
'pageFooter' => true,
|
|
|
'favorite' => true,
|
|
|
'hasFavProduct' => $favProducts,
|
|
|
'hasFavBrand' => $favBrands
|
|
|
);
|
|
|
// 判断是否为品牌收藏页
|
|
|
if ($tab === 'brand') {
|
|
|
$data['brandTab'] = true;
|
|
|
}
|
|
|
|
|
|
$this->_view->display('favorite', $data);
|
|
|
}
|
...
|
...
|
@@ -102,20 +100,16 @@ class HomeController extends AbstractAction |
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax())
|
|
|
{
|
|
|
if ($this->isAjax()) {
|
|
|
$uid = $this->getUid();
|
|
|
$fav_id = $this->post('fav_id', 0);
|
|
|
|
|
|
$result = \Index\UserModel::favoriteDelete($uid, $fav_id);
|
|
|
}
|
|
|
|
|
|
if (empty($result))
|
|
|
{
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
} else {
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -128,8 +122,7 @@ class HomeController extends AbstractAction |
|
|
$this->setTitle('个人信息');
|
|
|
$this->setNavHeader('个人信息', true, SITE_MAIN);
|
|
|
|
|
|
// $uid = $this->getUid();
|
|
|
$uid = 967016;
|
|
|
$uid = $this->getUid();
|
|
|
$data = \Index\UserModel::getUserProfileData($uid);
|
|
|
$data['personalDetailsPage'] = true;
|
|
|
$data['pageFooter'] = true;
|
...
|
...
|
@@ -144,8 +137,7 @@ class HomeController extends AbstractAction |
|
|
$this->setTitle('YOHO币');
|
|
|
$this->setNavHeader('YOHO币', true, false);
|
|
|
|
|
|
// $uid = $this->getUid();
|
|
|
$uid = 8826435;
|
|
|
$uid = $this->getUid();
|
|
|
$currency = \Index\UserModel::getYohoCoinData($uid);
|
|
|
|
|
|
$currency['pageFooter'] = true;
|
...
|
...
|
@@ -157,14 +149,12 @@ class HomeController extends AbstractAction |
|
|
*/
|
|
|
public function couponsAction()
|
|
|
{
|
|
|
|
|
|
$this->setTitle('优惠券');
|
|
|
$this->setNavHeader('优惠券', true, SITE_MAIN);
|
|
|
// $uid = $this->getUid();
|
|
|
$uid = 8826435;
|
|
|
$status = $this->get('status', 0);
|
|
|
$this->setNavHeader('优惠券');
|
|
|
|
|
|
$uid = $this->getUid();
|
|
|
$coupons = array(
|
|
|
'couponsUrl' => \Index\UserModel::getCouponData($uid, $status),
|
|
|
'couponsUrl' => \Index\UserModel::getCouponData($uid),
|
|
|
'couponsPage' => true
|
|
|
);
|
|
|
$this->_view->display('coupons', $coupons);
|
...
|
...
|
@@ -175,11 +165,10 @@ class HomeController extends AbstractAction |
|
|
*/
|
|
|
public function messageAction()
|
|
|
{
|
|
|
// $uid = $this->getUid();
|
|
|
$uid = $this->getUid();
|
|
|
$page = $this->get('page', 0);
|
|
|
$size = $this->get('size', 10);
|
|
|
|
|
|
$uid = 8826435;
|
|
|
$messages = \Index\UserModel::getMessageData($uid, $page, $size);
|
|
|
|
|
|
print_r($messages);
|
...
|
...
|
@@ -192,16 +181,12 @@ class HomeController extends AbstractAction |
|
|
{
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('地址管理');
|
|
|
$this->setNavHeader('地址管理', true, SITE_MAIN);
|
|
|
|
|
|
// $uid = $this->getUid();
|
|
|
$uid = 8826435;
|
|
|
$this->setNavHeader('地址管理');
|
|
|
|
|
|
$uid = $this->getUid();
|
|
|
$address = \Index\UserModel::getAddressData($uid);
|
|
|
$addressList = \Index\UserModel::getAddressListData($uid);
|
|
|
|
|
|
// print_r($addressList);
|
|
|
|
|
|
$this->_view->display('address', array(
|
|
|
'addressPage' => true,
|
|
|
'pageFooter' => true,
|
...
|
...
|
@@ -217,10 +202,8 @@ class HomeController extends AbstractAction |
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax())
|
|
|
{
|
|
|
// $uid = $this->getUid();
|
|
|
$uid = 8826435;
|
|
|
if ($this->isAjax()) {
|
|
|
$uid = $this->getUid();
|
|
|
$address = $this->post('address', '');
|
|
|
$area_code = $this->post('area_code', '');
|
|
|
$consignee = $this->post('consignee', '');
|
...
|
...
|
@@ -232,12 +215,9 @@ class HomeController extends AbstractAction |
|
|
$result = \Index\UserModel::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code);
|
|
|
}
|
|
|
|
|
|
if (empty($result))
|
|
|
{
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
} else {
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -249,21 +229,15 @@ class HomeController extends AbstractAction |
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax())
|
|
|
{
|
|
|
// $uid = $this->getUid();
|
|
|
$uid = 8826435;
|
|
|
if ($this->isAjax()) {
|
|
|
$uid = $this->getUid();
|
|
|
$id = $this->post('id', '');
|
|
|
|
|
|
$result = \Index\UserModel::setDefaultAddress($uid, $id);
|
|
|
}
|
|
|
|
|
|
if (empty($result))
|
|
|
{
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
} else {
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -275,21 +249,16 @@ class HomeController extends AbstractAction |
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax())
|
|
|
{
|
|
|
// $uid = $this->getUid();
|
|
|
$uid = 8826435;
|
|
|
if ($this->isAjax()) {
|
|
|
$uid = $this->getUid();
|
|
|
$id = $this->post('id', '');
|
|
|
|
|
|
$result = \Index\UserModel::deleteAddress($uid, $id);
|
|
|
}
|
|
|
|
|
|
if (empty($result))
|
|
|
{
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
} else {
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -316,8 +285,7 @@ class HomeController extends AbstractAction |
|
|
$service = array();
|
|
|
$cateId = $this->get('cateId', 0);
|
|
|
$cateName = $this->get('cateName', '');
|
|
|
if ($cateId > 0)
|
|
|
{
|
|
|
if ($cateId > 0) {
|
|
|
$service = home\OnlineModel::getOnlineServiceDetail($cateId);
|
|
|
}
|
|
|
$this->setTitle('在线客服');
|
...
|
...
|
@@ -333,25 +301,19 @@ class HomeController extends AbstractAction |
|
|
$page = $this->get('page', 1);
|
|
|
$limit = $this->get('limit', 10);
|
|
|
$uid = $this->getUid();
|
|
|
$uid=5687179;
|
|
|
$gender = Helpers::getGenderByCookie();
|
|
|
$yh_channel = Helpers::getChannelByCookie();
|
|
|
$guangInfo = \home\GuangModel::getMyGuang($uid, $page, $yh_channel, $gender, $limit);
|
|
|
$totalPage = $guangInfo['totalPage'];
|
|
|
unset($guangInfo['totalPage']);
|
|
|
if ($page == 1)
|
|
|
{
|
|
|
if ($page == 1) {
|
|
|
$this->setTitle('我收藏的');
|
|
|
$this->setNavHeader('我收藏的', true, '');
|
|
|
$this->_view->display('my-guang', array('myGuangPage' => true, 'myGuang' => array('infos' => $guangInfo), 'pageFooter' => true));
|
|
|
}
|
|
|
else if ($page > 1 && $page<=$totalPage)
|
|
|
{
|
|
|
} else if ($page > 1 && $page <= $totalPage) {
|
|
|
$this->_view->display('my-guang-partial', array('infos' => $guangInfo));
|
|
|
}
|
|
|
else if ($page > 1 && $page>$totalPage)
|
|
|
{
|
|
|
echo ' ';//退出循环
|
|
|
} else if ($page > 1 && $page > $totalPage) {
|
|
|
echo ' '; //退出循环
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -383,7 +345,6 @@ class HomeController extends AbstractAction |
|
|
*/
|
|
|
public function suggestSubAction()
|
|
|
{
|
|
|
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('反馈问题');
|
|
|
|
...
|
...
|
@@ -417,8 +378,7 @@ class HomeController extends AbstractAction |
|
|
*/
|
|
|
public function savesuggestAction()
|
|
|
{
|
|
|
if ($this->isAjax())
|
|
|
{
|
|
|
if ($this->isAjax()) {
|
|
|
$uid = $this->getUid();
|
|
|
$content = $this->post('content', '');
|
|
|
$suggest_type = $this->post('suggest_type', 2);
|
...
|
...
|
@@ -433,12 +393,11 @@ class HomeController extends AbstractAction |
|
|
*/
|
|
|
public function upAndDownAction()
|
|
|
{
|
|
|
if ($this->isAjax())
|
|
|
{
|
|
|
$uid = $this->getUid();
|
|
|
$udid = $this->getUdid();
|
|
|
$suggest_id = $this->post('suggest_id', 0);
|
|
|
$result = \Index\UserModel::upAndDown($uid, $udid, $suggest_id);
|
|
|
if ($this->isAjax()) {
|
|
|
$uid = $this->getUid();
|
|
|
$udid = $this->getUdid();
|
|
|
$suggest_id = $this->post('suggest_id', 0);
|
|
|
$result = \Index\UserModel::upAndDown($uid, $udid, $suggest_id);
|
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
...
|
...
|
@@ -457,7 +416,6 @@ class HomeController extends AbstractAction |
|
|
$gender = Helpers::getGenderByCookie();
|
|
|
$channel = Helpers::getChannelByCookie();
|
|
|
$uid = $this->getUid();
|
|
|
$uid = '10267443'; //临时测试用
|
|
|
$data = GradeModel::getGrade($gender, $channel, $uid);
|
|
|
$data['pageFooter'] = true;
|
|
|
$this->_view->display('vip-grade', $data);
|
...
|
...
|
@@ -492,12 +450,9 @@ class HomeController extends AbstractAction |
|
|
$this->setTitle('我的订单');
|
|
|
$this->setNavHeader('我的订单');
|
|
|
$data = OrderModel::getNavs($type);
|
|
|
if (!empty($data))
|
|
|
{
|
|
|
if (!empty($data)) {
|
|
|
$order['navs'] = $data;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
} else {
|
|
|
$this->error();
|
|
|
}
|
|
|
//渲染模板
|
...
|
...
|
@@ -512,8 +467,7 @@ class HomeController extends AbstractAction |
|
|
public function getOrdersAction()
|
|
|
{
|
|
|
//判断是不是ajax请求
|
|
|
if (!$this->isAjax())
|
|
|
{
|
|
|
if (!$this->isAjax()) {
|
|
|
$this->error();
|
|
|
}
|
|
|
//获取基本参数:type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论
|
...
|
...
|
@@ -523,7 +477,6 @@ class HomeController extends AbstractAction |
|
|
$gender = Helpers::getGenderByCookie();
|
|
|
$yh_channel = $this->get('yh_channel', 1);
|
|
|
$uid = $this->getUid();
|
|
|
$uid = '10267443'; //测试用
|
|
|
//调用模型层getOrder方法获得并处理数据
|
|
|
$data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid);
|
|
|
/* 如果取不到订单数据时,分两种情况:
|
...
|
...
|
@@ -531,18 +484,12 @@ class HomeController extends AbstractAction |
|
|
2、page=1时,就给一个随便逛逛的链接。
|
|
|
* */
|
|
|
$order = array();
|
|
|
if (!empty($data))
|
|
|
{
|
|
|
if (!empty($data)) {
|
|
|
$order['orders'] = $data;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if ($page > 1)
|
|
|
{
|
|
|
} else {
|
|
|
if ($page > 1) {
|
|
|
echo " ";
|
|
|
}
|
|
|
elseif ($page == 1)
|
|
|
{
|
|
|
} elseif ($page == 1) {
|
|
|
$order['walkwayUrl'] = self::strollAction();
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -558,14 +505,12 @@ class HomeController extends AbstractAction |
|
|
{
|
|
|
|
|
|
//判断是不是ajax请求
|
|
|
if (!$this->isAjax())
|
|
|
{
|
|
|
if (!$this->isAjax()) {
|
|
|
$this->error();
|
|
|
}
|
|
|
//传入order_code和uid以取消订单
|
|
|
$order_code = $this->get('id');
|
|
|
$uid = $this->getUid();
|
|
|
$uid = '10267443'; //测试用
|
|
|
$gender = Helpers::getGenderByCookie();
|
|
|
$yh_channel = $this->get('yh_channel', 1);
|
|
|
$method = 'app.SpaceOrders.close';
|
...
|
...
|
@@ -582,14 +527,12 @@ class HomeController extends AbstractAction |
|
|
public function delOrderAction()
|
|
|
{
|
|
|
//判断是不是ajax请求
|
|
|
if (!$this->isAjax())
|
|
|
{
|
|
|
if (!$this->isAjax()) {
|
|
|
$this->error();
|
|
|
}
|
|
|
//传入order_code和uid以删除订单
|
|
|
$order_code = $this->get('id');
|
|
|
$uid = $this->getUid();
|
|
|
$uid = '10267443'; //测试用
|
|
|
$gender = Helpers::getGenderByCookie();
|
|
|
$yh_channel = $this->get('yh_channel', 1);
|
|
|
$method = 'app.SpaceOrders.delOrderByCode';
|
...
|
...
|
|