...
|
...
|
@@ -18,720 +18,774 @@ use Index\UserModel as UserModel; |
|
|
class HomeController extends AbstractAction
|
|
|
{
|
|
|
|
|
|
protected $_uid;
|
|
|
|
|
|
/**
|
|
|
* 初始化
|
|
|
*/
|
|
|
public function init() {
|
|
|
// 检查用户是否登录, 未登录则跳转到登录页
|
|
|
|
|
|
// @todo 为了方便测试,支持传uid参数
|
|
|
$this->_uid = $this->getUid();
|
|
|
// if (!$uid) {
|
|
|
// $uid = $this->_uid = $this->get('uid', 7394907); //$this->getUid(true);
|
|
|
// }
|
|
|
|
|
|
$action = $this->getRequest()->getActionName();
|
|
|
$excludeActions = array(
|
|
|
'index',
|
|
|
'onlineservice',
|
|
|
'suggest',
|
|
|
'suggestsub',
|
|
|
'suggestimgupload',
|
|
|
);
|
|
|
if (!$this->_uid && !in_array($action, $excludeActions) && !$this->isAjax()) {
|
|
|
$this->go(Helpers::url('/signin.html'));
|
|
|
}
|
|
|
|
|
|
parent::init();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 个人中心入口
|
|
|
*/
|
|
|
public function indexAction() {
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('个人中心');
|
|
|
$this->setNavHeader('个人中心');
|
|
|
|
|
|
$data = array(
|
|
|
'myIndexPage' => true,
|
|
|
'showDownloadApp' => true,
|
|
|
'pageFooter' => true
|
|
|
);
|
|
|
if ($this->_uid) {
|
|
|
$data['isLogin'] = true;
|
|
|
$data += UserModel::getUserProfileData($this->_uid);
|
|
|
$data += UserModel::getInfoNumData($this->_uid);
|
|
|
|
|
|
// 优选新品数据
|
|
|
$channel = Helpers::getChannelByCookie();
|
|
|
$data['recommendForYou'] = UserModel::getPreferenceData($channel);
|
|
|
}
|
|
|
|
|
|
$this->_view->display('index', $data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 为您优选
|
|
|
*/
|
|
|
public function preferenceAction()
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
// 优选新品数据
|
|
|
$channel = Helpers::getChannelByCookie();
|
|
|
$result = UserModel::getPreferenceData($channel);
|
|
|
}
|
|
|
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else {
|
|
|
$this->_view->display('recommend-content', $result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 用户收藏的商品
|
|
|
*/
|
|
|
public function favoriteAction() {
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('我的收藏');
|
|
|
$this->setNavHeader('我的收藏', true, SITE_MAIN);
|
|
|
|
|
|
$tab = $this->get('tab', '');
|
|
|
|
|
|
$data = array(
|
|
|
'favPage' => true, //加载js
|
|
|
'pageFooter' => true,
|
|
|
'favorite' => true,
|
|
|
'productUrl' => '/product/new',
|
|
|
'brandUrl' => '/product/new',
|
|
|
);
|
|
|
// 判断是否为品牌收藏页
|
|
|
if ($tab === 'brand') {
|
|
|
$data['brandTab'] = true;
|
|
|
}
|
|
|
|
|
|
$this->_view->display('favorite', $data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 用户收藏的商品数据获取接口
|
|
|
*/
|
|
|
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 if (isset($result['end'])) {
|
|
|
echo 'end';
|
|
|
} 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 if (isset($result['end'])) {
|
|
|
echo 'end';
|
|
|
} else {
|
|
|
$this->_view->display('favorite_brand', $result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 用户收藏的商品-删除
|
|
|
*/
|
|
|
public function favoriteDelAction() {
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$fav_id = $this->post('id', 0);
|
|
|
|
|
|
$result = UserModel::favoriteDelete($this->_uid, $fav_id);
|
|
|
}
|
|
|
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else {
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 浏览记录页面
|
|
|
*/
|
|
|
public function recordAction()
|
|
|
{
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('浏览记录');
|
|
|
$this->setNavHeader('浏览记录', true, SITE_MAIN);
|
|
|
|
|
|
$this->_view->display('browse-record', array(
|
|
|
'browseRecordPage' => true
|
|
|
));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 浏览记录
|
|
|
*/
|
|
|
public function recordContentAction()
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$udid = $this->getUdid();
|
|
|
$page = $this->get('page', 1);
|
|
|
$limit = $this->get('limit', 100);
|
|
|
|
|
|
$result = UserModel::browserRecord($this->_uid, $udid, $page, $limit);
|
|
|
}
|
|
|
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else {
|
|
|
$this->_view->display('browse-record-content', $result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 删除浏览记录
|
|
|
*/
|
|
|
public function delRecordAction()
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$skn = $this->get('skn', 0);
|
|
|
|
|
|
$result = UserModel::delRecord($this->_uid, $skn);
|
|
|
}
|
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 个人信息
|
|
|
*/
|
|
|
public function mydetailsAction() {
|
|
|
$this->setTitle('个人信息');
|
|
|
$this->setNavHeader('个人信息');
|
|
|
|
|
|
$data = UserModel::getUserProfileData($this->_uid);
|
|
|
$data['personalDetailsPage'] = true;
|
|
|
$data['pageFooter'] = true;
|
|
|
$this->_view->display('personal-details', $data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* YOHO币
|
|
|
*/
|
|
|
public function currencyAction() {
|
|
|
$this->setTitle('YOHO币');
|
|
|
$this->setNavHeader('YOHO币', true, false);
|
|
|
|
|
|
$currency = UserModel::getYohoCoinData($this->_uid);
|
|
|
|
|
|
$currency['pageFooter'] = true;
|
|
|
$this->_view->display('currency', $currency);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 优惠券
|
|
|
*/
|
|
|
public function couponsAction() {
|
|
|
$this->setTitle('优惠券');
|
|
|
$this->setNavHeader('优惠券', true, SITE_MAIN);
|
|
|
|
|
|
$coupons = array(
|
|
|
'couponsPage' => true,
|
|
|
'pageFooter' => true
|
|
|
);
|
|
|
|
|
|
$this->_view->display('coupons', $coupons);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 异步获取指定状态的优惠券数据
|
|
|
*/
|
|
|
public function couponDataAction() {
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$status = $this->post('status', 0);
|
|
|
$page = $this->post('page', 1);
|
|
|
|
|
|
$result = UserModel::getCouponData($this->_uid, $status, $page);
|
|
|
}
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else {
|
|
|
$this->_view->display('coupon_list', $result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 我的消息
|
|
|
*
|
|
|
* 暂时使用老的,因后面APP、PC、WAP会进行一次改版
|
|
|
*/
|
|
|
/*public function messageAction() {
|
|
|
$page = $this->get('page', 1);
|
|
|
$size = $this->get('size', 10);
|
|
|
|
|
|
$messages = UserModel::getMessageData($this->_uid, $page, $size);
|
|
|
|
|
|
print_r($messages);
|
|
|
}*/
|
|
|
|
|
|
/**
|
|
|
* 异步获取三级地址数据
|
|
|
*/
|
|
|
public function locationListAction() {
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$result['addressList'] = UserModel::getAddressListData($this->_uid);
|
|
|
}
|
|
|
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else {
|
|
|
$this->_view->display('location-list', $result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 地址管理
|
|
|
*/
|
|
|
public function addressAction() {
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('地址管理');
|
|
|
$this->setNavHeader('地址管理');
|
|
|
|
|
|
$address = UserModel::getAddressData($this->_uid);
|
|
|
|
|
|
$this->_view->display('address', array(
|
|
|
'addressPage' => true,
|
|
|
'pageFooter' => true,
|
|
|
'address' => $address,
|
|
|
'showAddBtn' => (count($address) <= 5)
|
|
|
));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* 地址编辑或添加页面
|
|
|
*/
|
|
|
public function addressActAction() {
|
|
|
$id = $this->get('id', null);
|
|
|
$data = array(
|
|
|
'addressActionPage' => true,
|
|
|
'pageFooter' => true,
|
|
|
'addressList' => UserModel::getAddressListData($this->_uid)
|
|
|
);
|
|
|
|
|
|
if ($id !== null) { // 编辑地址
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('编辑地址');
|
|
|
$this->setNavHeader('编辑地址');
|
|
|
$data['id'] = $id;
|
|
|
|
|
|
// 获取特定地址的数据
|
|
|
$data['address'] = UserModel::getAddressDataById($this->_uid, $id);
|
|
|
} else {
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('添加地址');
|
|
|
$this->setNavHeader('添加地址');
|
|
|
}
|
|
|
|
|
|
$this->_view->display('address-act', $data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 修改地址或者添加新地址
|
|
|
*/
|
|
|
public function saveAddressAction() {
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$address = $this->post('address', '');
|
|
|
$area_code = $this->post('area_code', '');
|
|
|
$consignee = $this->post('consignee', '');
|
|
|
$email = $this->post('email', '');
|
|
|
$id = $this->post('id', null);
|
|
|
$mobile = $this->post('mobile', '');
|
|
|
$zip_code = $this->post('zip_code', '');
|
|
|
|
|
|
$result = UserModel::saveAddressData($this->_uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code);
|
|
|
}
|
|
|
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else {
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 设置默认地址
|
|
|
*/
|
|
|
public function defaultAddressAction() {
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$id = $this->post('id', '');
|
|
|
$result = UserModel::setDefaultAddress($this->_uid, $id);
|
|
|
}
|
|
|
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else {
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 删除地址
|
|
|
*/
|
|
|
public function delAddressAction() {
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$id = $this->post('id', '');
|
|
|
|
|
|
$result = UserModel::deleteAddress($this->_uid, $id);
|
|
|
}
|
|
|
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else {
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 在线客服
|
|
|
*/
|
|
|
public function onlineServiceAction() {
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('在线客服');
|
|
|
$this->setNavHeader('在线客服', true, SITE_MAIN);
|
|
|
|
|
|
$service = Home\OnlineModel::getOnlineServiceInfo();
|
|
|
|
|
|
$this->_view->display('online-service', array(
|
|
|
'onlineServicePage' => true,
|
|
|
'pageFooter' => true,
|
|
|
'service' => $service
|
|
|
));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 在线客服-具体详情
|
|
|
*/
|
|
|
public function onlineServiceDetailAction() {
|
|
|
$service = array();
|
|
|
$cateId = $this->get('cateId', 0);
|
|
|
$cateName = $this->get('cateName', '');
|
|
|
if ($cateId > 0) {
|
|
|
$service = Home\OnlineModel::getOnlineServiceDetail($cateId);
|
|
|
}
|
|
|
$this->setTitle('在线客服');
|
|
|
$this->setNavHeader($cateName, true, '');
|
|
|
$this->_view->display('online-service-detail', array(
|
|
|
'onlineServiceDetailPage' => true,
|
|
|
protected $_uid;
|
|
|
|
|
|
/**
|
|
|
* 通过当前用户审判是否跳到登录
|
|
|
*
|
|
|
* @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', '/'))));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 个人中心入口
|
|
|
*/
|
|
|
public function indexAction()
|
|
|
{
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('个人中心');
|
|
|
$this->setNavHeader('个人中心');
|
|
|
|
|
|
$data = array(
|
|
|
'myIndexPage' => true,
|
|
|
'showDownloadApp' => true,
|
|
|
'pageFooter' => true
|
|
|
);
|
|
|
$uid = $this->getUid(true);
|
|
|
if ($uid) {
|
|
|
$data['isLogin'] = true;
|
|
|
$data += UserModel::getUserProfileData($uid);
|
|
|
$data += UserModel::getInfoNumData($uid);
|
|
|
}
|
|
|
|
|
|
$this->_view->display('index', $data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 为您优选
|
|
|
*/
|
|
|
public function preferenceAction()
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
// 优选新品数据
|
|
|
$channel = Helpers::getChannelByCookie();
|
|
|
$result = UserModel::getPreferenceData($channel);
|
|
|
}
|
|
|
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else {
|
|
|
$this->_view->display('recommend-content', $result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 用户收藏的商品
|
|
|
*/
|
|
|
public function favoriteAction()
|
|
|
{
|
|
|
// 审判跳转登录页
|
|
|
$this->auditJumpLogin();
|
|
|
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('我的收藏');
|
|
|
$this->setNavHeader('我的收藏');
|
|
|
|
|
|
$tab = $this->get('tab', '');
|
|
|
$data = array(
|
|
|
'favPage' => true, //加载js
|
|
|
'pageFooter' => true,
|
|
|
'favorite' => true,
|
|
|
'productUrl' => Helpers::url('/product/new'),
|
|
|
'brandUrl' => Helpers::url('/product/new'),
|
|
|
'brandTab' => $tab === 'brand' ? true : false, // 是否为品牌收藏页
|
|
|
);
|
|
|
|
|
|
$this->_view->display('favorite', $data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 用户收藏的商品数据获取接口
|
|
|
*/
|
|
|
public function favProductAction()
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$uid = $this->getUid(true);
|
|
|
$page = $this->post('page', 1);
|
|
|
$result = UserModel::getFavProductData($uid, $page, 10);
|
|
|
}
|
|
|
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else if (isset($result['end'])) {
|
|
|
echo 'end';
|
|
|
} else {
|
|
|
$this->_view->display('favorite_product', $result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 用户收藏的品牌数据获取接口
|
|
|
*/
|
|
|
public function favBrandAction()
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$uid = $this->getUid(true);
|
|
|
$page = $this->post('page', 1);
|
|
|
$result = UserModel::getFavBrandData($uid, 10, $page, 10);
|
|
|
}
|
|
|
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else if (isset($result['end'])) {
|
|
|
echo 'end';
|
|
|
} else {
|
|
|
$this->_view->display('favorite_brand', $result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 用户收藏的商品-删除
|
|
|
*/
|
|
|
public function favoriteDelAction()
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$uid = $this->getUid(true);
|
|
|
$favId = $this->post('id', 0);
|
|
|
$result = UserModel::favoriteDelete($uid, $favId);
|
|
|
}
|
|
|
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else {
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 浏览记录页面
|
|
|
*/
|
|
|
public function recordAction()
|
|
|
{
|
|
|
// 审判跳转登录页
|
|
|
$this->auditJumpLogin();
|
|
|
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('浏览记录');
|
|
|
$this->setNavHeader('浏览记录', true, SITE_MAIN);
|
|
|
|
|
|
$this->_view->display('browse-record', array(
|
|
|
'browseRecordPage' => true
|
|
|
));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 浏览记录
|
|
|
*/
|
|
|
public function recordContentAction()
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$uid = $this->getUid(true);
|
|
|
$udid = $this->getUdid();
|
|
|
$page = $this->get('page', 1);
|
|
|
$result = UserModel::browserRecord($uid, $udid, $page, 100);
|
|
|
}
|
|
|
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else {
|
|
|
$this->_view->display('browse-record-content', $result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 删除浏览记录
|
|
|
*/
|
|
|
public function delRecordAction()
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$uid = $this->getUid(true);
|
|
|
$skn = $this->get('skn', 0);
|
|
|
$result = UserModel::delRecord($uid, $skn);
|
|
|
}
|
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 个人信息
|
|
|
*/
|
|
|
public function mydetailsAction()
|
|
|
{
|
|
|
// 审判跳转登录页
|
|
|
$this->auditJumpLogin();
|
|
|
|
|
|
$this->setTitle('个人信息');
|
|
|
$this->setNavHeader('个人信息');
|
|
|
|
|
|
$data = UserModel::getUserProfileData($this->_uid);
|
|
|
$data['personalDetailsPage'] = true;
|
|
|
$data['pageFooter'] = true;
|
|
|
|
|
|
$this->_view->display('personal-details', $data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* YOHO币
|
|
|
*/
|
|
|
public function currencyAction()
|
|
|
{
|
|
|
// 审判跳转登录页
|
|
|
$this->auditJumpLogin();
|
|
|
|
|
|
$this->setTitle('YOHO币');
|
|
|
$this->setNavHeader('YOHO币', true, false);
|
|
|
|
|
|
$currency = UserModel::getYohoCoinData($this->_uid);
|
|
|
$currency['pageFooter'] = true;
|
|
|
|
|
|
$this->_view->display('currency', $currency);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 优惠券
|
|
|
*/
|
|
|
public function couponsAction()
|
|
|
{
|
|
|
// 审判跳转登录页
|
|
|
$this->auditJumpLogin();
|
|
|
|
|
|
$this->setTitle('优惠券');
|
|
|
$this->setNavHeader('优惠券', true, SITE_MAIN);
|
|
|
|
|
|
$coupons = array(
|
|
|
'couponsPage' => true,
|
|
|
'pageFooter' => true
|
|
|
);
|
|
|
$this->_view->display('coupons', $coupons);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 异步获取指定状态的优惠券数据
|
|
|
*/
|
|
|
public function couponDataAction()
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$uid = $this->getUid(true);
|
|
|
$status = $this->post('status', 0);
|
|
|
$page = $this->post('page', 1);
|
|
|
$result = UserModel::getCouponData($uid, $status, $page);
|
|
|
}
|
|
|
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else {
|
|
|
$this->_view->display('coupon_list', $result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 异步获取三级地址数据
|
|
|
*/
|
|
|
public function locationListAction()
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$uid = $this->getUid(true);
|
|
|
$result['addressList'] = UserModel::getAddressListData($uid);
|
|
|
}
|
|
|
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else {
|
|
|
$this->_view->display('location-list', $result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 地址管理
|
|
|
*/
|
|
|
public function addressAction()
|
|
|
{
|
|
|
// 审判跳转登录页
|
|
|
$this->auditJumpLogin();
|
|
|
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('地址管理');
|
|
|
$this->setNavHeader('地址管理');
|
|
|
|
|
|
$uid = $this->_uid;
|
|
|
$address = UserModel::getAddressData($uid);
|
|
|
|
|
|
$this->_view->display('address', array(
|
|
|
'addressPage' => true,
|
|
|
'pageFooter' => true,
|
|
|
'address' => $address,
|
|
|
'showAddBtn' => (count($address) <= 5),
|
|
|
));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* 地址编辑或添加页面
|
|
|
*/
|
|
|
public function addressActAction()
|
|
|
{
|
|
|
// 审判跳转登录页
|
|
|
$this->auditJumpLogin();
|
|
|
|
|
|
$uid = $this->_uid;
|
|
|
$id = $this->get('id', null);
|
|
|
$data = array(
|
|
|
'addressActionPage' => true,
|
|
|
'pageFooter' => true,
|
|
|
'addressList' => UserModel::getAddressListData($uid)
|
|
|
);
|
|
|
|
|
|
if ($id !== null) { // 编辑地址
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('编辑地址');
|
|
|
$this->setNavHeader('编辑地址');
|
|
|
|
|
|
$data['id'] = $id;
|
|
|
// 获取特定地址的数据
|
|
|
$data['address'] = UserModel::getAddressDataById($uid, $id);
|
|
|
} else {
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('添加地址');
|
|
|
$this->setNavHeader('添加地址');
|
|
|
}
|
|
|
|
|
|
$this->_view->display('address-act', $data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 修改地址或者添加新地址
|
|
|
*/
|
|
|
public function saveAddressAction()
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$uid = $this->getUid(true);
|
|
|
$address = $this->post('address', '');
|
|
|
$areaCode = $this->post('area_code', '');
|
|
|
$consignee = $this->post('consignee', '');
|
|
|
$email = $this->post('email', '');
|
|
|
$id = $this->post('id', null);
|
|
|
$mobile = $this->post('mobile', '');
|
|
|
$zipCode = $this->post('zip_code', '');
|
|
|
|
|
|
$result = UserModel::saveAddressData($uid, $address, $areaCode, $consignee, $email, $id, $mobile, $zipCode);
|
|
|
}
|
|
|
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else {
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 设置默认地址
|
|
|
*/
|
|
|
public function defaultAddressAction()
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$uid = $this->getUid(true);
|
|
|
$id = $this->post('id', '');
|
|
|
$result = UserModel::setDefaultAddress($uid, $id);
|
|
|
}
|
|
|
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else {
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 删除地址
|
|
|
*/
|
|
|
public function delAddressAction()
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if ($this->isAjax()) {
|
|
|
$uid = $this->getUid(true);
|
|
|
$id = $this->post('id', '');
|
|
|
$result = UserModel::deleteAddress($uid, $id);
|
|
|
}
|
|
|
|
|
|
if (empty($result)) {
|
|
|
echo ' ';
|
|
|
} else {
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 在线客服
|
|
|
*/
|
|
|
public function onlineServiceAction()
|
|
|
{
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('在线客服');
|
|
|
$this->setNavHeader('在线客服', true, SITE_MAIN);
|
|
|
|
|
|
$service = Home\OnlineModel::getOnlineServiceInfo();
|
|
|
|
|
|
$this->_view->display('online-service', array(
|
|
|
'onlineServicePage' => true,
|
|
|
'pageFooter' => true,
|
|
|
'service' => $service
|
|
|
));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 我的逛
|
|
|
*/
|
|
|
public function myGuangAction() {
|
|
|
$page = $this->get('page', 1);
|
|
|
$limit = $this->get('limit', 10);
|
|
|
$gender = Helpers::getGenderByCookie();
|
|
|
$yh_channel = Helpers::getChannelByCookie();
|
|
|
$guangInfo = \Home\GuangModel::getMyGuang($this->_uid, $page, $yh_channel, $gender, $limit);
|
|
|
$totalPage = $guangInfo['totalPage'];
|
|
|
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) {
|
|
|
$this->_view->display('my-guang-partial', array('infos' => $guangInfo));
|
|
|
} else if ($page > 1 && $page > $totalPage) {
|
|
|
echo ' '; //退出循环
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 意见反馈
|
|
|
*/
|
|
|
public function suggestAction() {
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('意见反馈');
|
|
|
$this->setNavHeader('意见反馈', true, SITE_MAIN);
|
|
|
|
|
|
$udid = $this->getUdid();
|
|
|
$page = $this->get('page', 1);
|
|
|
$limit = $this->get('limit', 30);
|
|
|
|
|
|
$suggest = UserModel::getSuggestData($udid, $page, $limit);
|
|
|
|
|
|
$this->_view->display('suggest', array(
|
|
|
'suggestPage' => true, //加载js
|
|
|
'pageFooter' => true,
|
|
|
'suggest' => true,
|
|
|
'suggestContent' => $suggest
|
|
|
));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 意见反馈-提交表单页面
|
|
|
*/
|
|
|
public function suggestSubAction() {
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('反馈问题');
|
|
|
|
|
|
$data = array(
|
|
|
'suggestPage' => true, //加载js
|
|
|
'pageHeader' => array(
|
|
|
'navBack' => true,
|
|
|
'navTitle' => '反馈问题',
|
|
|
'navBtn' => '提交'
|
|
|
),
|
|
|
'suggestSub' => true,
|
|
|
'pageFooter' => true
|
|
|
);
|
|
|
|
|
|
$this->_view->display('suggest-sub', $data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 异步上传图片
|
|
|
*/
|
|
|
public function suggestimgUploadAction() {
|
|
|
$result = UserModel::saveSuggestImg('fileData');
|
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 异步保存意见反馈数据
|
|
|
*/
|
|
|
public function savesuggestAction() {
|
|
|
if ($this->isAjax()) {
|
|
|
$content = $this->post('content', '');
|
|
|
$suggest_type = $this->post('suggest_type', 2);
|
|
|
$image = $this->post('image', null);
|
|
|
$result = UserModel::saveSuggestData($this->_uid, $content, $image, $suggest_type);
|
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 异步点击靠谱或者不靠谱
|
|
|
*/
|
|
|
public function upAndDownAction() {
|
|
|
if ($this->isAjax()) {
|
|
|
$udid = $this->getUdid();
|
|
|
$suggest_id = $this->post('suggest_id', 0);
|
|
|
$reliable = $this->post('reliable', 2);
|
|
|
$result = UserModel::upAndDown($this->_uid, $udid, $suggest_id, $reliable);
|
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 会员等级展示页
|
|
|
*/
|
|
|
public function gradeAction() {
|
|
|
//设置网站seo信息
|
|
|
$this->setTitle('会员等级');
|
|
|
//显示网站导航头部信息
|
|
|
$this->setNavHeader('会员等级');
|
|
|
|
|
|
$gender = Helpers::getGenderByCookie();
|
|
|
$channel = Helpers::getChannelByCookie();
|
|
|
$data = GradeModel::getGrade($gender, $channel, $this->_uid);
|
|
|
$data['pageFooter'] = true;
|
|
|
|
|
|
$this->_view->display('vip-grade', $data);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 会员特权查看页
|
|
|
*/
|
|
|
|
|
|
public function preferentialAction() {
|
|
|
//设置网站seo信息
|
|
|
$this->setTitle('会员等级');
|
|
|
//显示网站导航头部信息
|
|
|
$this->setNavHeader('会员特权详情');
|
|
|
|
|
|
$channel = Helpers::getChannelByCookie();
|
|
|
$data = GradeModel::getPreferential($channel, $this->_uid);
|
|
|
$data['pageFooter'] = true;
|
|
|
|
|
|
$this->_view->display('privilege', $data);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 我的订单页面,获得nav导航条焦点。并且异步请求订单详情列表页(getOrders)
|
|
|
*/
|
|
|
|
|
|
public function orderAction() {
|
|
|
//获得type值,type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论。
|
|
|
$type = $this->get('type', 1);
|
|
|
$this->setTitle('我的订单');
|
|
|
$this->setNavHeader('我的订单');
|
|
|
$data = OrderModel::getNavs($type);
|
|
|
if (!empty($data)) {
|
|
|
$order['navs'] = $data;
|
|
|
} else {
|
|
|
$this->error();
|
|
|
}
|
|
|
//渲染模板
|
|
|
$this->_view->display('order', array(
|
|
|
'order' => $order,
|
|
|
'pageFooter' => true,
|
|
|
'orderPage' => true
|
|
|
));
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* ajax请求订单页面
|
|
|
*/
|
|
|
public function getOrdersAction()
|
|
|
{
|
|
|
//判断是不是ajax请求
|
|
|
if (!$this->isAjax()) {
|
|
|
$this->error();
|
|
|
}
|
|
|
//获取基本参数:type 1:全部 2:待付款 3:待发货 4:待收货 5:待评论 7:失败 取消 订单
|
|
|
$type = $this->get('type', 1);
|
|
|
$page = $this->get('page', 1);
|
|
|
$limit = $this->get('limit', 10);
|
|
|
|
|
|
//调用模型层getOrder方法获得并处理数据
|
|
|
$gender = Helpers::getGenderByCookie();
|
|
|
$channel = Helpers::getChannelByCookie();
|
|
|
$data = OrderModel::getOrder($type, $page, $limit, $gender, $channel, $this->_uid);
|
|
|
/* 如果取不到订单数据时,分两种情况:
|
|
|
1、page>1时,echo一个空格字符串到浏览器。
|
|
|
2、page=1时,就给一个随便逛逛的链接。
|
|
|
* */
|
|
|
$order = array();
|
|
|
if (!empty($data)) {
|
|
|
$order['orders'] = $data;
|
|
|
} else {
|
|
|
if ($page > 1) {
|
|
|
echo " ";
|
|
|
} elseif ($page == 1) {
|
|
|
$order['walkwayUrl'] = Helpers::url('/product/new');
|
|
|
}
|
|
|
}
|
|
|
//渲染模板
|
|
|
$this->_view->display('order-content', $order);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 我的订单-取消订单
|
|
|
*/
|
|
|
public function cancelOrderAction() {
|
|
|
//判断是不是ajax请求
|
|
|
if (!$this->isAjax()) {
|
|
|
$this->error();
|
|
|
}
|
|
|
|
|
|
//传入orderCode取消订单
|
|
|
$orderCode = $this->get('id');
|
|
|
$gender = Helpers::getGenderByCookie();
|
|
|
$channel = Helpers::getChannelByCookie();
|
|
|
//调用取消订单接口,返回订单取消状态
|
|
|
$data = OrderData::cancelOrderData($orderCode, $this->_uid, $gender, $channel);
|
|
|
//将取消状态返回至浏览器
|
|
|
$info = array();
|
|
|
if(empty($data['code'])&&empty($data['message'])){
|
|
|
$this->echoJson(array('code'=>200));
|
|
|
}else{
|
|
|
$this->echoJson($data);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 我的订单-删除订单
|
|
|
*/
|
|
|
public function delOrderAction() {
|
|
|
//判断是不是ajax请求
|
|
|
if (!$this->isAjax()) {
|
|
|
$this->error();
|
|
|
}
|
|
|
|
|
|
//传入orderCode删除订单
|
|
|
$orderCode = $this->get('id');
|
|
|
$gender = Helpers::getGenderByCookie();
|
|
|
$channel = Helpers::getChannelByCookie();
|
|
|
//调用接口删除订单,并返回订单删除状态
|
|
|
$data = OrderData::deleteOrderData($orderCode, $this->_uid, $gender, $channel);
|
|
|
//将订单删除状态返回至浏览器
|
|
|
$info = array();
|
|
|
if(empty($data['code'])&&empty($data['message'])){
|
|
|
$this->echoJson(array('code'=>200));
|
|
|
}else{
|
|
|
$this->echoJson($data);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 我的订单-查看物流详情
|
|
|
*/
|
|
|
public function getLogisticsAction(){
|
|
|
$order_code = $this->get('order_code');
|
|
|
$order_code = '1509143619';
|
|
|
$data = OrderModel::Logistics($order_code);
|
|
|
}
|
|
|
/*
|
|
|
* 我的订单-支付链接获取
|
|
|
*/
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 在线客服-具体详情
|
|
|
*/
|
|
|
public function onlineServiceDetailAction()
|
|
|
{
|
|
|
$service = array();
|
|
|
$cateId = $this->get('cateId', 0);
|
|
|
$cateName = $this->get('cateName', '');
|
|
|
if ($cateId > 0) {
|
|
|
$service = Home\OnlineModel::getOnlineServiceDetail($cateId);
|
|
|
}
|
|
|
$this->setTitle('在线客服');
|
|
|
$this->setNavHeader($cateName, true, '');
|
|
|
$this->_view->display('online-service-detail', $service);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 我的逛
|
|
|
*/
|
|
|
public function myGuangAction()
|
|
|
{
|
|
|
$page = $this->get('page', 1);
|
|
|
$uid = $this->getUid(true);
|
|
|
$gender = Helpers::getGenderByCookie();
|
|
|
$channel = Helpers::getChannelByCookie();
|
|
|
$guangInfo = \Home\GuangModel::getMyGuang($uid, $page, $channel, $gender, 10);
|
|
|
$totalPage = $guangInfo['totalPage'];
|
|
|
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) {
|
|
|
$this->_view->display('my-guang-partial', array('infos' => $guangInfo));
|
|
|
} else if ($page > 1 && $page > $totalPage) {
|
|
|
echo ' '; //退出循环
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 意见反馈
|
|
|
*/
|
|
|
public function suggestAction()
|
|
|
{
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('意见反馈');
|
|
|
$this->setNavHeader('意见反馈');
|
|
|
|
|
|
$udid = $this->getUdid();
|
|
|
$page = $this->get('page', 1);
|
|
|
$limit = $this->get('limit', 30);
|
|
|
|
|
|
$suggest = UserModel::getSuggestData($udid, $page, $limit);
|
|
|
|
|
|
$this->_view->display('suggest', array(
|
|
|
'suggestPage' => true, //加载js
|
|
|
'pageFooter' => true,
|
|
|
'suggest' => true,
|
|
|
'suggestContent' => $suggest
|
|
|
));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 意见反馈-提交表单页面
|
|
|
*/
|
|
|
public function suggestSubAction()
|
|
|
{
|
|
|
// 设置网站标题
|
|
|
$this->setTitle('反馈问题');
|
|
|
$this->setNavHeader('意见反馈');
|
|
|
|
|
|
$data = array(
|
|
|
'suggestPage' => true, //加载js
|
|
|
'pageHeader' => array(
|
|
|
'navBack' => true,
|
|
|
'navTitle' => '反馈问题',
|
|
|
'navBtn' => '提交'
|
|
|
),
|
|
|
'suggestSub' => true,
|
|
|
'pageFooter' => true
|
|
|
);
|
|
|
|
|
|
$this->_view->display('suggest-sub', $data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 异步上传图片
|
|
|
*/
|
|
|
public function suggestimgUploadAction()
|
|
|
{
|
|
|
$result = UserModel::saveSuggestImg('fileData');
|
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 异步保存意见反馈数据
|
|
|
*/
|
|
|
public function savesuggestAction()
|
|
|
{
|
|
|
if ($this->isAjax()) {
|
|
|
$uid = $this->getUid(true);
|
|
|
$content = $this->post('content', '');
|
|
|
$suggest_type = $this->post('suggest_type', 2);
|
|
|
$image = $this->post('image', null);
|
|
|
$result = UserModel::saveSuggestData($uid, $content, $image, $suggest_type);
|
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 异步点击靠谱或者不靠谱
|
|
|
*/
|
|
|
public function upAndDownAction()
|
|
|
{
|
|
|
if ($this->isAjax()) {
|
|
|
$uid = $this->getUid(true);
|
|
|
$udid = $this->getUdid();
|
|
|
$suggest_id = $this->post('suggest_id', 0);
|
|
|
$reliable = $this->post('reliable', 2);
|
|
|
$result = UserModel::upAndDown($uid, $udid, $suggest_id, $reliable);
|
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 会员等级展示页
|
|
|
*/
|
|
|
public function gradeAction()
|
|
|
{
|
|
|
// 审判跳转登录页
|
|
|
$this->auditJumpLogin();
|
|
|
|
|
|
//设置网站seo信息
|
|
|
$this->setTitle('会员等级');
|
|
|
//显示网站导航头部信息
|
|
|
$this->setNavHeader('会员等级');
|
|
|
|
|
|
$gender = Helpers::getGenderByCookie();
|
|
|
$channel = Helpers::getChannelByCookie();
|
|
|
$data = GradeModel::getGrade($gender, $channel, $this->_uid);
|
|
|
$data['pageFooter'] = true;
|
|
|
|
|
|
$this->_view->display('vip-grade', $data);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 会员特权查看页
|
|
|
*/
|
|
|
|
|
|
public function preferentialAction()
|
|
|
{
|
|
|
// 审判跳转登录页
|
|
|
$this->auditJumpLogin();
|
|
|
|
|
|
//设置网站seo信息
|
|
|
$this->setTitle('会员等级');
|
|
|
//显示网站导航头部信息
|
|
|
$this->setNavHeader('会员特权详情');
|
|
|
|
|
|
$channel = Helpers::getChannelByCookie();
|
|
|
$data = GradeModel::getPreferential($channel, $this->_uid);
|
|
|
$data['pageFooter'] = true;
|
|
|
|
|
|
$this->_view->display('privilege', $data);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 我的订单页面,获得nav导航条焦点。并且异步请求订单详情列表页(getOrders)
|
|
|
*
|
|
|
*/
|
|
|
public function orderAction()
|
|
|
{
|
|
|
// 审判跳转登录页
|
|
|
$this->auditJumpLogin();
|
|
|
|
|
|
$this->setTitle('我的订单');
|
|
|
$this->setNavHeader('我的订单');
|
|
|
|
|
|
$order = array();
|
|
|
//获得type值,type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论
|
|
|
$type = $this->get('type', 1);
|
|
|
$data = OrderModel::getNavs($type);
|
|
|
if (!empty($data)) {
|
|
|
$order['navs'] = $data;
|
|
|
}
|
|
|
//渲染模板
|
|
|
$this->_view->display('order', array(
|
|
|
'order' => $order,
|
|
|
'pageFooter' => true,
|
|
|
'orderPage' => true
|
|
|
));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* ajax请求订单页面
|
|
|
*/
|
|
|
public function getOrdersAction()
|
|
|
{
|
|
|
//判断是不是ajax请求
|
|
|
if (!$this->isAjax()) {
|
|
|
echo ' ';
|
|
|
}
|
|
|
|
|
|
//获取基本参数:type 1:全部 2:待付款 3:待发货 4:待收货 5:待评论 7:失败 取消 订单
|
|
|
$type = $this->get('type', 1);
|
|
|
$page = $this->get('page', 1);
|
|
|
|
|
|
//调用模型层getOrder方法获得并处理数据
|
|
|
$uid = $this->getUid(true);
|
|
|
$gender = Helpers::getGenderByCookie();
|
|
|
$channel = Helpers::getChannelByCookie();
|
|
|
$data = OrderModel::getOrder($type, $page, 10, $gender, $channel, $uid);
|
|
|
/* 如果取不到订单数据时,分两种情况:
|
|
|
1、page>1时,echo一个空格字符串到浏览器。
|
|
|
2、page=1时,就给一个随便逛逛的链接。
|
|
|
* */
|
|
|
$order = array();
|
|
|
if (!empty($data)) {
|
|
|
$order['orders'] = $data;
|
|
|
} else if ($page == 1) {
|
|
|
$order['walkwayUrl'] = Helpers::url('/product/new');
|
|
|
} else {
|
|
|
echo ' ';
|
|
|
}
|
|
|
|
|
|
//渲染模板
|
|
|
$this->_view->display('order-content', $order);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 我的订单-取消订单
|
|
|
*/
|
|
|
|
|
|
public function cancelOrderAction()
|
|
|
{
|
|
|
//判断是不是ajax请求
|
|
|
if (!$this->isAjax()) {
|
|
|
$this->echoJson(array('code' => 200));
|
|
|
}
|
|
|
|
|
|
//传入orderCode取消订单
|
|
|
$orderCode = $this->get('id');
|
|
|
$gender = Helpers::getGenderByCookie();
|
|
|
$channel = Helpers::getChannelByCookie();
|
|
|
$uid = $this->getUid(true);
|
|
|
//调用取消订单接口,返回订单取消状态
|
|
|
$data = OrderData::cancelOrderData($orderCode, $uid, $gender, $channel);
|
|
|
//将取消状态返回至浏览器
|
|
|
if (empty($data['code']) && empty($data['message'])) {
|
|
|
$this->echoJson(array('code' => 200));
|
|
|
} else {
|
|
|
$this->echoJson($data);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 我的订单-删除订单
|
|
|
*/
|
|
|
|
|
|
public function delOrderAction()
|
|
|
{
|
|
|
//判断是不是ajax请求
|
|
|
if (!$this->isAjax()) {
|
|
|
$this->echoJson(array('code' => 200));
|
|
|
}
|
|
|
|
|
|
//传入orderCode删除订单
|
|
|
$orderCode = $this->get('id');
|
|
|
$gender = Helpers::getGenderByCookie();
|
|
|
$channel = Helpers::getChannelByCookie();
|
|
|
$uid = $this->getUid(true);
|
|
|
//调用接口删除订单,并返回订单删除状态
|
|
|
$data = OrderData::deleteOrderData($orderCode, $uid, $gender, $channel);
|
|
|
//将订单删除状态返回至浏览器
|
|
|
if (empty($data['code']) && empty($data['message'])) {
|
|
|
$this->echoJson(array('code' => 200));
|
|
|
} else {
|
|
|
$this->echoJson($data);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 我的订单-查看物流详情
|
|
|
*/
|
|
|
|
|
|
public function getLogisticsAction()
|
|
|
{
|
|
|
$order_code = $this->get('order_code');
|
|
|
$order_code = '1509143619';
|
|
|
$data = OrderModel::Logistics($order_code);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 物流信息页面
|
|
|
*/
|
|
|
public function logisticAction()
|
|
|
{
|
|
|
$data = array(
|
|
|
'logisticInfoPage' => true,
|
|
|
'pageFooter' => true,
|
|
|
'logisticImg' => 'http://localhost:8000/img/me/logistic/sf-icon.jpg',
|
|
|
'logisticCompany' => '顺丰0909',
|
|
|
'logisticNumber' => '999999999',
|
|
|
'logisticDetail' => array(
|
|
|
array('city' => '南京市', 'status' => '派送中派送中派送', 'date' => '2015-12-01 22:03:30'),
|
|
|
array('city' => '南京市', 'status' => '派送中', 'date' => '2015-12-01 22:03:30'),
|
|
|
array('city' => '南京市', 'status' => '派送中', 'date' => '2015-12-01 22:03:30')
|
|
|
)
|
|
|
);
|
|
|
|
|
|
$this->setTitle('物流详情');
|
|
|
$this->setNavHeader('物流详情');
|
|
|
|
|
|
$this->_view->display('logistic', $data);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 我的订单-支付链接获取
|
|
|
*/
|
|
|
// private function paymentAction() {
|
|
|
// $gender = Helpers::getGenderByCookie();
|
|
|
// $yh_channel = $this->get('yh_channel', 1);
|
|
|
// OrderModel::payment($gender, $yh_channel);
|
|
|
// }
|
|
|
|
|
|
/*
|
|
|
* 我的订单-确认收货
|
|
|
*/
|
|
|
/*
|
|
|
* 我的订单-确认收货
|
|
|
*/
|
|
|
// private function confirmAction(){
|
|
|
// //
|
|
|
// $gender = Helpers::getGenderByCookie();
|
...
|
...
|
@@ -742,72 +796,62 @@ class HomeController extends AbstractAction |
|
|
// $this->echoJson($data);
|
|
|
// }
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 订单详情页
|
|
|
*/
|
|
|
public function orderDetailAction() {
|
|
|
$data = array(
|
|
|
'name' => '毛毛莉Lydia',
|
|
|
'phoneNum' => '18600001133',
|
|
|
'address' => '南京市建邺区嘉陵江东街18号国家广告产业园5栋17楼',
|
|
|
'orderStatus' => '订单取消',
|
|
|
'orderNum' => '418358063',
|
|
|
'orderTime' => '2014-03-10 17:25:10',
|
|
|
'orderCancel' => true,
|
|
|
'goods' => array(
|
|
|
array(
|
|
|
'id' => 1,
|
|
|
'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
|
|
|
'name' => 'Adidas Originals ZX FLUXM22508',
|
|
|
'color' => '黄',
|
|
|
'size' => '43',
|
|
|
'price' => '699.00',
|
|
|
'count' => '2'
|
|
|
),
|
|
|
array(
|
|
|
'id' => 1,
|
|
|
'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/11/04/05/0188f1aca49ac478a565ec029b5d2d4a6c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
|
|
|
'name' => 'B.Duck浴室玩伴mini浮水鸭',
|
|
|
'gift' => true,
|
|
|
'color' => '黄',
|
|
|
'size' => '43',
|
|
|
'price' => '0.00',
|
|
|
'count' => '1'
|
|
|
)
|
|
|
),
|
|
|
'sumPrice' => 799,
|
|
|
'salePrice' => 80,
|
|
|
'freight' => 5,
|
|
|
'coupon' => 0,
|
|
|
'yohoCoin' => 5,
|
|
|
'price' => 719
|
|
|
);
|
|
|
$this->_view->display('order-detail', array('orderDetail' => $data, 'orderDetailPage' => true));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 帮助列表页
|
|
|
*/
|
|
|
private function IHelpAction()
|
|
|
{
|
|
|
$this->setTitle('帮助中心');
|
|
|
$this->setNavHeader('帮助中心');
|
|
|
$data = array(
|
|
|
'iHelp' => array(
|
|
|
array('name' => '新用户注册','url' => 'http://m.dev.yohobuy.com/' ),
|
|
|
array('name' => '交款须知' ,'url' => 'http://m.dev.yohobuy.com/'),
|
|
|
array('name' => '服务条款' ,'url' => 'http://m.dev.yohobuy.com/'),
|
|
|
array('name' => '网站订购流程' ,'url' => 'http://m.dev.yohobuy.com/'),
|
|
|
array('name' => '会员登录' ,'url' => 'http://m.dev.yohobuy.com/'),
|
|
|
array('name' => '网站订单修改' ,'url' => 'http://m.dev.yohobuy.com/'),
|
|
|
array('name' => 'YOHO币' ,'url' => 'http://m.dev.yohobuy.com/'),
|
|
|
array('name' => '常见问题' ,'url' => 'http://m.dev.yohobuy.com/'),
|
|
|
array('name' => '支付方式' ,'url' => 'http://m.dev.yohobuy.com/'),
|
|
|
array('name' => '发票制度说明' ,'url' => 'http://m.dev.yohobuy.com/'),
|
|
|
array('name' => '配送时间' ,'url' => 'http://m.dev.yohobuy.com/')
|
|
|
)
|
|
|
);
|
|
|
$this->_view->display('i-help', $data);
|
|
|
}
|
|
|
/**
|
|
|
* 订单详情页
|
|
|
*/
|
|
|
public function orderDetailAction()
|
|
|
{
|
|
|
$data = array(
|
|
|
'name' => '毛毛莉Lydia',
|
|
|
'phoneNum' => '18600001133',
|
|
|
'address' => '南京市建邺区嘉陵江东街18号国家广告产业园5栋17楼',
|
|
|
'orderStatus' => '订单取消',
|
|
|
'orderNum' => '418358063',
|
|
|
'orderTime' => '2014-03-10 17:25:10',
|
|
|
'orderCancel' => true,
|
|
|
'goods' => array(
|
|
|
array(
|
|
|
'id' => 1,
|
|
|
'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
|
|
|
'name' => 'Adidas Originals ZX FLUXM22508',
|
|
|
'color' => '黄',
|
|
|
'size' => '43',
|
|
|
'price' => '699.00',
|
|
|
'count' => '2'
|
|
|
),
|
|
|
array(
|
|
|
'id' => 1,
|
|
|
'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/11/04/05/0188f1aca49ac478a565ec029b5d2d4a6c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
|
|
|
'name' => 'B.Duck浴室玩伴mini浮水鸭',
|
|
|
'gift' => true,
|
|
|
'color' => '黄',
|
|
|
'size' => '43',
|
|
|
'price' => '0.00',
|
|
|
'count' => '1'
|
|
|
)
|
|
|
),
|
|
|
'sumPrice' => 799,
|
|
|
'salePrice' => 80,
|
|
|
'freight' => 5,
|
|
|
'coupon' => 0,
|
|
|
'yohoCoin' => 5,
|
|
|
'price' => 719
|
|
|
);
|
|
|
$this->_view->display('order-detail', array('orderDetail' => $data, 'orderDetailPage' => true));
|
|
|
}
|
|
|
|
|
|
// /**
|
|
|
// * 帮助列表页
|
|
|
// */
|
|
|
// public function helpAction()
|
|
|
// {
|
|
|
// $this->setTitle('帮助中心');
|
|
|
// $this->setNavHeader('帮助中心');
|
|
|
// $data = array(
|
|
|
// 'iHelp' => array(
|
|
|
// array('name' => '新用户注册', 'url' => 'http://m.dev.yohobuy.com/'),
|
|
|
// )
|
|
|
// );
|
|
|
// $this->_view->display('i-help', $data);
|
|
|
// }
|
|
|
} |
...
|
...
|
|