Authored by hf

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

@@ -283,24 +283,22 @@ class AbstractAction extends Controller_Abstract @@ -283,24 +283,22 @@ class AbstractAction extends Controller_Abstract
283 */ 283 */
284 protected function getUid($useSession = false) 284 protected function getUid($useSession = false)
285 { 285 {
286 - // @todo debug 因登录没有写老的SESSION会话,此处使用COOKIE  
287 - $useSession = false;  
288 -  
289 if (!$this->_uid) { 286 if (!$this->_uid) {
290 - // 从SESSION获取  
291 - if ($useSession) {  
292 - $this->_uid = $this->getSession('_UID');  
293 - }  
294 - // 从COOKIE获取  
295 - else {  
296 $cookie = $this->getCookie('_UID'); 287 $cookie = $this->getCookie('_UID');
297 if (!empty($cookie)) { 288 if (!empty($cookie)) {
  289 + $uid = 0;
298 $cookieList = explode('::', $cookie); 290 $cookieList = explode('::', $cookie);
299 if (isset($cookieList[1]) && is_numeric($cookieList[1])) { 291 if (isset($cookieList[1]) && is_numeric($cookieList[1])) {
300 - $this->_uid = $cookieList[1]; 292 + $uid = $cookieList[1];
301 $this->_uname = $cookieList[0]; 293 $this->_uname = $cookieList[0];
302 $this->_vip = $cookieList[2]; 294 $this->_vip = $cookieList[2];
303 } 295 }
  296 + // 服务端比较
  297 + if ($useSession && $uid) {
  298 + $token = $this->getSession('_TOKEN');
  299 + if ($token === Helpers::makeToken($uid)) {
  300 + $this->_uid = $uid;
  301 + }
304 } 302 }
305 } 303 }
306 } 304 }
@@ -335,6 +333,7 @@ class AbstractAction extends Controller_Abstract @@ -335,6 +333,7 @@ class AbstractAction extends Controller_Abstract
335 * @param bool $showMore 是否显示更多内容 333 * @param bool $showMore 是否显示更多内容
336 * @return void 334 * @return void
337 */ 335 */
  336 +
338 protected function setTitle($title, $showMore = true, $sign = ' | ') 337 protected function setTitle($title, $showMore = true, $sign = ' | ')
339 { 338 {
340 $this->_view->assign('title_more', $showMore); 339 $this->_view->assign('title_more', $showMore);
@@ -422,6 +421,7 @@ class AbstractAction extends Controller_Abstract @@ -422,6 +421,7 @@ class AbstractAction extends Controller_Abstract
422 421
423 $this->_view->assign('pageHeader', $header); 422 $this->_view->assign('pageHeader', $header);
424 } 423 }
  424 +
425 /** 425 /**
426 * 设置网站导航底部信息 426 * 设置网站导航底部信息
427 * 427 *
@@ -84,7 +84,8 @@ class LoginData @@ -84,7 +84,8 @@ class LoginData
84 */ 84 */
85 public static function signoutSession($token) 85 public static function signoutSession($token)
86 { 86 {
87 - return Yohobuy::get( Helpers::logoutSession($token) ); 87 + echo Helpers::logoutSession($token); exit;
  88 + echo Yohobuy::get( Helpers::logoutSession($token) ); exit;
88 } 89 }
89 90
90 } 91 }
@@ -41,7 +41,7 @@ class HomeController extends AbstractAction @@ -41,7 +41,7 @@ class HomeController extends AbstractAction
41 { 41 {
42 // 设置网站标题 42 // 设置网站标题
43 $this->setTitle('个人中心'); 43 $this->setTitle('个人中心');
44 - $this->setNavHeader('个人中心'); 44 + $this->setNavHeader('个人中心', $this->server('HTTP_REFERER', SITE_MAIN) );
45 45
46 $data = array( 46 $data = array(
47 'myIndexPage' => true, 47 'myIndexPage' => true,
@@ -69,15 +69,16 @@ class OrderModel @@ -69,15 +69,16 @@ class OrderModel
69 //检查数据返回是否正常,正常则处理数据 69 //检查数据返回是否正常,正常则处理数据
70 if (!empty($data['data']['order_list'])) { 70 if (!empty($data['data']['order_list'])) {
71 // 订单的状态列表 71 // 订单的状态列表
72 - $orderStatus = Helpers::getOrderStatus(); 72 + //$orderStatus = Helpers::getOrderStatus();
73 73
74 foreach ($data['data']['order_list'] as $key => $vo) { 74 foreach ($data['data']['order_list'] as $key => $vo) {
75 - if ($vo['payment_status'] == 'Y' && $vo['status'] == 0) {  
76 - $vo['status'] = 1;  
77 - } 75 +// if ($vo['payment_status'] == 'Y' && $vo['status'] == 0) {
  76 +// $vo['status'] = 1;
  77 +// }
78 //订单号,支付状态,订单商品数量,订单总价格 78 //订单号,支付状态,订单商品数量,订单总价格
79 $result[$key]['orderNum'] = $vo['order_code']; 79 $result[$key]['orderNum'] = $vo['order_code'];
80 - $result[$key]['orderStatus'] = ($vo['is_cancel'] === 'Y') ? '已取消' : $orderStatus[ $vo['payment_type'] ][ $vo['status'] ]; 80 + //$result[$key]['orderStatus'] = ($vo['is_cancel'] === 'Y') ? '已取消' : $orderStatus[ $vo['payment_type'] ][ $vo['status'] ];
  81 + $result[$key]['orderStatus'] = $vo['status_str'];
81 $result[$key]['count'] = count($vo['order_goods']); 82 $result[$key]['count'] = count($vo['order_goods']);
82 $result[$key]['sumCost'] = $vo['amount']; 83 $result[$key]['sumCost'] = $vo['amount'];
83 //类内调用格式化订单商品数据方法 84 //类内调用格式化订单商品数据方法
@@ -213,11 +213,20 @@ class DetailModel @@ -213,11 +213,20 @@ class DetailModel
213 'cartUrl' => Helpers::url('/cart/index/index', null), // 购物车链接 213 'cartUrl' => Helpers::url('/cart/index/index', null), // 购物车链接
214 'numInCart' => 0, 214 'numInCart' => 0,
215 'goodsInstore' => $baseInfo['storage'], // 库存量 215 'goodsInstore' => $baseInfo['storage'], // 库存量
216 - 'soldOut' => $baseInfo['storage'] == 0, // 已售磬  
217 - 'notForSale' => $baseInfo['attribute'] == 2, // 非卖品  
218 ); 216 );
219 - if (!$result['cartInfo']['soldOut'] && !$result['cartInfo']['notForSale']) {  
220 - $result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html'); // 加入购物车链接 217 + $soldOut = $baseInfo['storage'] == 0;
  218 + $notForSale = $baseInfo['attribute'] == 2;
  219 + // 显示加入购物车链接
  220 + if (!$soldOut && !$notForSale) {
  221 + $result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html'); //
  222 + }
  223 + // 已售磬
  224 + elseif (!$notForSale && $soldOut) {
  225 + $result['cartInfo']['soldOut'] = true;
  226 + }
  227 + // 非卖品
  228 + elseif (!$soldOut && $notForSale) {
  229 + $result['cartInfo']['notForSale'] = true;
221 } 230 }
222 231
223 // 是否收藏 232 // 是否收藏
@@ -18,12 +18,6 @@ class LoginController extends AbstractAction @@ -18,12 +18,6 @@ class LoginController extends AbstractAction
18 public function indexAction() 18 public function indexAction()
19 { 19 {
20 $refer = $this->get('refer'); 20 $refer = $this->get('refer');
21 - // 已登录则直接跳回  
22 - $uid = $this->getUid();  
23 - if ($uid) {  
24 - $refer = empty($refer) ? SITE_MAIN . '/?go=1' : rawurldecode($refer);  
25 - $this->go($refer);  
26 - }  
27 if (!empty($refer)) { 21 if (!empty($refer)) {
28 $this->setCookie('refer', $refer); 22 $this->setCookie('refer', $refer);
29 } 23 }
@@ -54,12 +48,6 @@ class LoginController extends AbstractAction @@ -54,12 +48,6 @@ class LoginController extends AbstractAction
54 public function internationalAction() 48 public function internationalAction()
55 { 49 {
56 $refer = $this->get('refer'); 50 $refer = $this->get('refer');
57 - // 已登录则直接跳回  
58 - $uid = $this->getUid();  
59 - if ($uid) {  
60 - $refer = empty($refer) ? SITE_MAIN . '/?go=1' : rawurldecode($refer);  
61 - $this->go($refer);  
62 - }  
63 if (!empty($refer)) { 51 if (!empty($refer)) {
64 $this->setCookie('refer', $refer); 52 $this->setCookie('refer', $refer);
65 } 53 }
@@ -82,10 +70,12 @@ class LoginController extends AbstractAction @@ -82,10 +70,12 @@ class LoginController extends AbstractAction
82 */ 70 */
83 public function outAction() 71 public function outAction()
84 { 72 {
  73 + // 清除客户端
85 $this->setCookie('_UID', ''); 74 $this->setCookie('_UID', '');
  75 + // 清除服务端会话
  76 + $this->setSession('_TOKEN', '');
86 77
87 $refer = $this->server('HTTP_REFERER', SITE_MAIN); 78 $refer = $this->server('HTTP_REFERER', SITE_MAIN);
88 -  
89 $token = $this->get('token'); 79 $token = $this->get('token');
90 if (!empty($token)) { 80 if (!empty($token)) {
91 LoginData::signoutSession($token); 81 LoginData::signoutSession($token);
@@ -143,7 +133,6 @@ class LoginController extends AbstractAction @@ -143,7 +133,6 @@ class LoginController extends AbstractAction
143 $data['data']['href'] = $refer; 133 $data['data']['href'] = $refer;
144 134
145 $this->setSession('_TOKEN', Helpers::makeToken($data['data']['uid'])); 135 $this->setSession('_TOKEN', Helpers::makeToken($data['data']['uid']));
146 -  
147 } while (false); 136 } while (false);
148 137
149 $this->echoJson($data); 138 $this->echoJson($data);
@@ -45,7 +45,7 @@ routes.logout.type = "rewrite" @@ -45,7 +45,7 @@ routes.logout.type = "rewrite"
45 routes.logout.match = "/passport/signout/index" 45 routes.logout.match = "/passport/signout/index"
46 routes.logout.route.module = Passport 46 routes.logout.route.module = Passport
47 routes.logout.route.controller = Login 47 routes.logout.route.controller = Login
48 -routes.logout.route.action = out 48 +routes.logout.route.action = Out
49 49
50 ; 找回密码(手机号) 50 ; 找回密码(手机号)
51 routes.phoneback.type = "rewrite" 51 routes.phoneback.type = "rewrite"