Authored by hf

do modify domain m1.yohobuy.com mapi.yohobuy.com

... ... @@ -283,23 +283,21 @@ class AbstractAction extends Controller_Abstract
*/
protected function getUid($useSession = false)
{
// @todo debug 因登录没有写老的SESSION会话,此处使用COOKIE
$useSession = false;
if (!$this->_uid) {
// 从SESSION获取
if ($useSession) {
$this->_uid = $this->getSession('_UID');
}
// 从COOKIE获取
else {
$cookie = $this->getCookie('_UID');
if (!empty($cookie)) {
$cookieList = explode('::', $cookie);
if (isset($cookieList[1]) && is_numeric($cookieList[1])) {
$this->_uid = $cookieList[1];
$this->_uname = $cookieList[0];
$this->_vip = $cookieList[2];
$cookie = $this->getCookie('_UID');
if (!empty($cookie)) {
$uid = 0;
$cookieList = explode('::', $cookie);
if (isset($cookieList[1]) && is_numeric($cookieList[1])) {
$uid = $cookieList[1];
$this->_uname = $cookieList[0];
$this->_vip = $cookieList[2];
}
// 服务端比较
if ($useSession && $uid) {
$token = $this->getSession('_TOKEN');
if ($token === Helpers::makeToken($uid)) {
$this->_uid = $uid;
}
}
}
... ... @@ -335,6 +333,7 @@ class AbstractAction extends Controller_Abstract
* @param bool $showMore 是否显示更多内容
* @return void
*/
protected function setTitle($title, $showMore = true, $sign = ' | ')
{
$this->_view->assign('title_more', $showMore);
... ... @@ -399,29 +398,30 @@ class AbstractAction extends Controller_Abstract
$header['navBtn'] = true;
}
$controller = $this->getRequest()->getControllerName();
if ($controller !== 'Home') {
// 根据COOKIE记录的频道进行导航定位
$channel = Helpers::getChannelByCookie();
switch ($channel) {
default:
case 1:
$header['boys'] = true;
break;
case 2:
$header['girls'] = true;
break;
case 3:
$header['kids'] = true;
break;
case 4:
$header['lifeStyle'] = true;
break;
}
}
$controller = $this->getRequest()->getControllerName();
if ($controller !== 'Home') {
// 根据COOKIE记录的频道进行导航定位
$channel = Helpers::getChannelByCookie();
switch ($channel) {
default:
case 1:
$header['boys'] = true;
break;
case 2:
$header['girls'] = true;
break;
case 3:
$header['kids'] = true;
break;
case 4:
$header['lifeStyle'] = true;
break;
}
}
$this->_view->assign('pageHeader', $header);
}
/**
* 设置网站导航底部信息
*
... ...
... ... @@ -84,7 +84,8 @@ class LoginData
*/
public static function signoutSession($token)
{
return Yohobuy::get( Helpers::logoutSession($token) );
echo Helpers::logoutSession($token); exit;
echo Yohobuy::get( Helpers::logoutSession($token) ); exit;
}
}
... ...
... ... @@ -41,7 +41,7 @@ class HomeController extends AbstractAction
{
// 设置网站标题
$this->setTitle('个人中心');
$this->setNavHeader('个人中心');
$this->setNavHeader('个人中心', $this->server('HTTP_REFERER', SITE_MAIN) );
$data = array(
'myIndexPage' => true,
... ...
... ... @@ -61,7 +61,7 @@ class OrderModel
{
$result = array();
//调用接口获得数据
$data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, $uid);
$data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, $uid);
// 判断是否还有数据, 没有数据则返回空
if (isset($data['data']['page_total']) && $page > $data['data']['page_total']) {
return $result;
... ... @@ -69,19 +69,20 @@ class OrderModel
//检查数据返回是否正常,正常则处理数据
if (!empty($data['data']['order_list'])) {
// 订单的状态列表
$orderStatus = Helpers::getOrderStatus();
//$orderStatus = Helpers::getOrderStatus();
foreach ($data['data']['order_list'] as $key => $vo) {
if ($vo['payment_status'] == 'Y' && $vo['status'] == 0) {
$vo['status'] = 1;
}
// if ($vo['payment_status'] == 'Y' && $vo['status'] == 0) {
// $vo['status'] = 1;
// }
//订单号,支付状态,订单商品数量,订单总价格
$result[$key]['orderNum'] = $vo['order_code'];
$result[$key]['orderStatus'] = ($vo['is_cancel'] === 'Y') ? '已取消' : $orderStatus[ $vo['payment_type'] ][ $vo['status'] ];
//$result[$key]['orderStatus'] = ($vo['is_cancel'] === 'Y') ? '已取消' : $orderStatus[ $vo['payment_type'] ][ $vo['status'] ];
$result[$key]['orderStatus'] = $vo['status_str'];
$result[$key]['count'] = count($vo['order_goods']);
$result[$key]['sumCost'] = $vo['amount'];
//类内调用格式化订单商品数据方法
$result[$key]['goods'] = Helpers::formatOrderGoods($vo['order_goods']);
$result[$key]['goods'] = Helpers::formatOrderGoods($vo['order_goods']);
$result[$key]['detailUrl'] = Helpers::url('/home/orders/detail', array('order_code' => $vo['order_code'], 't' => time()));
//根据订单status判断订单处于什么状态。
do {
... ...
... ... @@ -213,11 +213,20 @@ class DetailModel
'cartUrl' => Helpers::url('/cart/index/index', null), // 购物车链接
'numInCart' => 0,
'goodsInstore' => $baseInfo['storage'], // 库存量
'soldOut' => $baseInfo['storage'] == 0, // 已售磬
'notForSale' => $baseInfo['attribute'] == 2, // 非卖品
);
if (!$result['cartInfo']['soldOut'] && !$result['cartInfo']['notForSale']) {
$result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html'); // 加入购物车链接
$soldOut = $baseInfo['storage'] == 0;
$notForSale = $baseInfo['attribute'] == 2;
// 显示加入购物车链接
if (!$soldOut && !$notForSale) {
$result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html'); //
}
// 已售磬
elseif (!$notForSale && $soldOut) {
$result['cartInfo']['soldOut'] = true;
}
// 非卖品
elseif (!$soldOut && $notForSale) {
$result['cartInfo']['notForSale'] = true;
}
// 是否收藏
... ...
... ... @@ -18,12 +18,6 @@ class LoginController extends AbstractAction
public function indexAction()
{
$refer = $this->get('refer');
// 已登录则直接跳回
$uid = $this->getUid();
if ($uid) {
$refer = empty($refer) ? SITE_MAIN . '/?go=1' : rawurldecode($refer);
$this->go($refer);
}
if (!empty($refer)) {
$this->setCookie('refer', $refer);
}
... ... @@ -54,12 +48,6 @@ class LoginController extends AbstractAction
public function internationalAction()
{
$refer = $this->get('refer');
// 已登录则直接跳回
$uid = $this->getUid();
if ($uid) {
$refer = empty($refer) ? SITE_MAIN . '/?go=1' : rawurldecode($refer);
$this->go($refer);
}
if (!empty($refer)) {
$this->setCookie('refer', $refer);
}
... ... @@ -82,10 +70,12 @@ class LoginController extends AbstractAction
*/
public function outAction()
{
// 清除客户端
$this->setCookie('_UID', '');
// 清除服务端会话
$this->setSession('_TOKEN', '');
$refer = $this->server('HTTP_REFERER', SITE_MAIN);
$token = $this->get('token');
if (!empty($token)) {
LoginData::signoutSession($token);
... ... @@ -143,7 +133,6 @@ class LoginController extends AbstractAction
$data['data']['href'] = $refer;
$this->setSession('_TOKEN', Helpers::makeToken($data['data']['uid']));
} while (false);
$this->echoJson($data);
... ...
... ... @@ -45,7 +45,7 @@ routes.logout.type = "rewrite"
routes.logout.match = "/passport/signout/index"
routes.logout.route.module = Passport
routes.logout.route.controller = Login
routes.logout.route.action = out
routes.logout.route.action = Out
; 找回密码(手机号)
routes.phoneback.type = "rewrite"
... ...