Authored by hf

do merge develop to test cart feature

... ... @@ -303,6 +303,7 @@ class AbstractAction extends Controller_Abstract
if (!$this->_uid) {
$cookie = $this->getCookie('_UID');
// 兼容老的
if (!empty($cookie)) {
$cookieList = explode('::', $cookie);
if (isset($cookieList[1]) && is_numeric($cookieList[1])) {
... ... @@ -322,6 +323,13 @@ class AbstractAction extends Controller_Abstract
$this->_vip = $cookieList[2];
}
}
// 新的, 如果老站没有同步成功,再尝试从SESSION获取
elseif ($useSession) {
$uid = $this->getSession('_LOGIN_UID');
if (!empty($uid)) {
$this->_uid = $uid;
}
}
}
return $this->_uid;
}
... ...
... ... @@ -746,7 +746,7 @@ class Helpers
public static function syncUserSession($uid, $refer = '', $callback = 'call')
{
return 'http://mapi.yohobuy.com/Passport/session/index?callback=' . $callback
. '&sign=' .md5(md5($uid . 'Js8Yn0!EwPM45-ws')) . '&uid=' . $uid . '&go=' . $refer;
. '&sign=' . md5(md5($uid . 'Js8Yn0!EwPM45-ws')) . '&uid=' . $uid . '&go=' . $refer;
}
/**
... ...
{
"name": "yohobuy",
"version": "1.2.6",
"version": "1.2.7",
"description": "yohobuy statics",
"keywords": [],
"homepage": "",
... ...
... ... @@ -44,6 +44,9 @@ class LoginController extends AbstractAction
// 渲染模板
$this->_view->display('index', $data);
// 设置登录有效时间30分钟, 防机器刷
$this->setSession('_LOGIN_EXPIRE', time() + 1800);
}
/**
... ... @@ -67,6 +70,9 @@ class LoginController extends AbstractAction
$data['countrys'] = RegData::getAreasData(); // 地区信息列表
// 渲染模板
$this->_view->display('international', $data);
// 设置登录有效时间30分钟, 防机器刷
$this->setSession('_LOGIN_EXPIRE', time() + 1800);
}
/**
... ... @@ -80,6 +86,7 @@ class LoginController extends AbstractAction
$this->setCookie('_SPK', '');
// 清除服务端会话
$this->setSession('_TOKEN', '');
$this->setSession('_LOGIN_UID', '');
$refer = $this->server('HTTP_REFERER', SITE_MAIN);
$token = $this->get('token');
... ... @@ -123,6 +130,12 @@ class LoginController extends AbstractAction
break;
}
/* 设置登录有效时间30分钟, 防机器刷 */
$expire = $this->getSession('_LOGIN_EXPIRE');
if (empty($expire) || $expire < time()) {
break;
}
/* 调用登录接口进行登录 */
// 获取未登录时的唯一识别码
$shoppingKey = Helpers::getShoppingKeyByCookie();
... ... @@ -143,6 +156,8 @@ class LoginController extends AbstractAction
$token = Helpers::makeToken($data['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $data['data']['uid']);
} while (false);
$this->echoJson($data);
... ... @@ -213,6 +228,7 @@ class LoginController extends AbstractAction
$token = Helpers::makeToken($result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
} else {
$this->go($refer);
... ... @@ -250,6 +266,7 @@ class LoginController extends AbstractAction
$token = Helpers::makeToken($result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
} else {
$this->go($refer);
... ... @@ -287,6 +304,7 @@ class LoginController extends AbstractAction
$token = Helpers::makeToken($result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
} else {
$this->go($refer);
... ...