Authored by hf

fixes bug to call product detail api and order status

@@ -28,7 +28,6 @@ class Yohobuy @@ -28,7 +28,6 @@ class Yohobuy
28 const API_URL = 'http://testapi.yoho.cn:28078/'; 28 const API_URL = 'http://testapi.yoho.cn:28078/';
29 const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; 29 const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
30 const YOHOBUY_URL = 'http://www.yohobuy.com/'; 30 const YOHOBUY_URL = 'http://www.yohobuy.com/';
31 - const API_URL_LOGINSESSION = 'http://m1.yohobuy.com/';  
32 31
33 /** 32 /**
34 * 私钥列表 33 * 私钥列表
@@ -4,6 +4,7 @@ namespace LibModels\Wap\Passport; @@ -4,6 +4,7 @@ namespace LibModels\Wap\Passport;
4 4
5 use Api\Sign; 5 use Api\Sign;
6 use Api\Yohobuy; 6 use Api\Yohobuy;
  7 +use Plugin\Helpers;
7 8
8 /** 9 /**
9 * 登录的数据模型 10 * 登录的数据模型
@@ -78,15 +79,12 @@ class LoginData @@ -78,15 +79,12 @@ class LoginData
78 /** 79 /**
79 * 登出SESSION会话 80 * 登出SESSION会话
80 * 81 *
81 - * @param int $uid 用户ID 82 + * @param string $token 会话
82 * @return array 83 * @return array
83 */ 84 */
84 public static function signoutSession($token) 85 public static function signoutSession($token)
85 { 86 {
86 - $param = array();  
87 - $param['token'] = $token;  
88 -  
89 - return Yohobuy::get(Yohobuy::API_URL_LOGINSESSION . 'Passport/session/logout', $param); 87 + return Yohobuy::get( Helpers::logoutSession($token) );
90 } 88 }
91 89
92 } 90 }
@@ -525,7 +525,7 @@ class Helpers @@ -525,7 +525,7 @@ class Helpers
525 public static function getVipLevel($vipInfo) 525 public static function getVipLevel($vipInfo)
526 { 526 {
527 $vipLevel = 0; 527 $vipLevel = 0;
528 - 528 +
529 switch ($vipInfo) { 529 switch ($vipInfo) {
530 case '普通会员': 530 case '普通会员':
531 $vipLevel = 0; 531 $vipLevel = 0;
@@ -540,10 +540,10 @@ class Helpers @@ -540,10 +540,10 @@ class Helpers
540 $vipLevel = 3; 540 $vipLevel = 3;
541 break; 541 break;
542 } 542 }
543 - 543 +
544 return $vipLevel; 544 return $vipLevel;
545 } 545 }
546 - 546 +
547 /** 547 /**
548 * 同步用户的会话 548 * 同步用户的会话
549 * 549 *
@@ -554,10 +554,26 @@ class Helpers @@ -554,10 +554,26 @@ class Helpers
554 * @param string $callback 回调方法名 554 * @param string $callback 回调方法名
555 * @return string 555 * @return string
556 */ 556 */
557 - public static function syncUserSession($uid, $refer = '', $callback='call') 557 + public static function syncUserSession($uid, $refer = '', $callback = 'call')
558 { 558 {
559 - return 'http://m1.yohobuy.com/Passport/session/index?callback=' . $callback 559 + return 'http://m1.yohobuy.com/Passport/session/index?callback=' . $callback
560 . '&sign=' . md5($uid . 'Js8Yn0!EwPM45-ws') . '&uid=' . $uid . '&go=' . $refer; 560 . '&sign=' . md5($uid . 'Js8Yn0!EwPM45-ws') . '&uid=' . $uid . '&go=' . $refer;
561 } 561 }
562 562
  563 + /**
  564 + * 退出清除用户的会话
  565 + *
  566 + * 转向老的PHP服务器上处理, 因购物车相关的操作会依赖SESSION
  567 + *
  568 + * @param int $uid 用户ID
  569 + * @param string $refer 访问来源
  570 + * @param string $callback 回调方法名
  571 + * @return string
  572 + */
  573 + public static function logoutSession($token, $callback = 'call')
  574 + {
  575 + return 'http://m1.yohobuy.com/Passport/session/logout?callback=' . $callback
  576 + . '&sign=' . md5('Js8Yn0!EwPM45-ws') . '&token=' . $token;
  577 + }
  578 +
563 } 579 }
@@ -86,9 +86,11 @@ class LoginController extends AbstractAction @@ -86,9 +86,11 @@ class LoginController extends AbstractAction
86 $this->setCookie('_UID', ''); 86 $this->setCookie('_UID', '');
87 87
88 $refer = $this->server('HTTP_REFERER', SITE_MAIN); 88 $refer = $this->server('HTTP_REFERER', SITE_MAIN);
  89 +
89 $token = $this->get('token'); 90 $token = $this->get('token');
90 -  
91 - LoginData::signoutSession($token); 91 + if (!empty($token)) {
  92 + LoginData::signoutSession($token);
  93 + }
92 94
93 $this->go($refer); 95 $this->go($refer);
94 } 96 }