Authored by 周少峰

decrypt uid

@@ -21,6 +21,7 @@ use WebPlugin\Mobile; @@ -21,6 +21,7 @@ use WebPlugin\Mobile;
21 use Api\Yohobuy; 21 use Api\Yohobuy;
22 use LibModels\Web\Passport\LoginData; 22 use LibModels\Web\Passport\LoginData;
23 use WebPlugin\UdpLog; 23 use WebPlugin\UdpLog;
  24 +use WebPlugin\Encryption;
24 25
25 class WebAction extends Controller_Abstract 26 class WebAction extends Controller_Abstract
26 { 27 {
@@ -382,6 +383,7 @@ class WebAction extends Controller_Abstract @@ -382,6 +383,7 @@ class WebAction extends Controller_Abstract
382 $userInfo = LoginData::profile($uid); 383 $userInfo = LoginData::profile($uid);
383 if (isset($userInfo['data']) && $userInfo['data']) { 384 if (isset($userInfo['data']) && $userInfo['data']) {
384 $token = Helpers::makeToken($uid); 385 $token = Helpers::makeToken($uid);
  386 + $userInfo['data']['uid'] = Encryption::encrypt($userInfo['data']['uid']);
385 $uidCookie = $userInfo['data']['profile_name'] . '::' . $userInfo['data']['uid'] . '::' . $userInfo['data']['vip_info']['title'] . '::' . $token; 387 $uidCookie = $userInfo['data']['profile_name'] . '::' . $userInfo['data']['uid'] . '::' . $userInfo['data']['vip_info']['title'] . '::' . $token;
386 $this->setCookie('_UID',$uidCookie,time() + 86400 * 360); 388 $this->setCookie('_UID',$uidCookie,time() + 86400 * 360);
387 UdpLog::info('syncUserCookie :',$uidCookie); 389 UdpLog::info('syncUserCookie :',$uidCookie);
@@ -411,7 +413,8 @@ class WebAction extends Controller_Abstract @@ -411,7 +413,8 @@ class WebAction extends Controller_Abstract
411 // 兼容老的 413 // 兼容老的
412 if (!empty($cookie)) { 414 if (!empty($cookie)) {
413 $cookieList = explode('::', $cookie); 415 $cookieList = explode('::', $cookie);
414 - if (isset($cookieList[1]) && is_numeric($cookieList[1])) { 416 + $cookieList[1] = Encryption::decrypt($cookieList[1]);
  417 + if (isset($cookieList[1]) && $cookieList[1]) {
415 if ($useSession) { 418 if ($useSession) {
416 $token = $this->getSession('_TOKEN'); 419 $token = $this->getSession('_TOKEN');
417 if (empty($token)) { 420 if (empty($token)) {
@@ -437,7 +440,7 @@ class WebAction extends Controller_Abstract @@ -437,7 +440,7 @@ class WebAction extends Controller_Abstract
437 } 440 }
438 } 441 }
439 } 442 }
440 - return $this->_uid; 443 + return intval($this->_uid);
441 } 444 }
442 445
443 /** 446 /**