Authored by hf

do modify login call old session

... ... @@ -36,7 +36,7 @@ class DetailData
$param['productId'] = $productId;
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
var_dump($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
... ...
... ... @@ -31,7 +31,7 @@ class DetailModel
if (is_numeric($productId) && is_numeric($goodsId)) {
// 调用服务
$baseInfo = DetailData::baseInfo($productId, $uid);
$baseInfo = DetailData::baseInfo($productId, $uid); var_dump($baseInfo);
// 判断商品是否在架
if (empty($baseInfo['status'])) {
... ... @@ -83,6 +83,7 @@ class DetailModel
foreach ($baseInfo['productPriceBo']['vipPrices'] as $value) {
$build['level'] = $value['vipLevel'];
$build['text'] = $value['vipPrice'];
$build['currentLevel'] = false;
$result['vipLevel']['list'][] = $build;
}
}
... ...
... ... @@ -110,19 +110,16 @@ class LoginController extends AbstractAction
break;
}
// /* 获取用户的信息 */
// $profile = LoginData::profile($data['data']['uid']);
// $name = 'YOHO!';
// if (!empty($profile['data']['nickname'])) {
// $name = $profile['data']['nickname'];
// } elseif (!empty($profile['data']['username'])) {
// $name = $profile['data']['username'];
// } elseif (!empty($profile['data']['email'])) {
// $name = $profile['data']['email'];
// } elseif (!empty($profile['data']['mobile'])) {
// $name = $profile['data']['mobile'];
// }
$data['data'] = '/'; // @todo
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
}
$data['data'] = array(
// 为了异步调用老系统的SESSION会话
'session' => 'http://m1.yohobuy.com/Passport/session/index?uid=' . $data['data']['uid'] . '&sign=' . md5($data['data']['uid'] . 'Js8Yn0!EwPM45-ws'),
'href' => rawurldecode($refer),
);
} while (false);
$this->echoJson($data);
... ...
... ... @@ -9,21 +9,22 @@ use Plugin\Helpers;
*/
class RegController extends AbstractAction
{
/**
* 注册页
*/
public function indexAction()
{
$this->setTitle('注册');
$data = array();
$data = array();
$data['regIndex'] = true; // 模板中使用JS的标识
$data['backUrl'] = '/'; // 返回的URL链接
$data['headerText'] = '注册'; // 头部信息
$data['isPassportPage'] = true; // 模板中模块标识
$data['areaCode'] = '+86'; // 默认的区号
$data['countrys'] = RegData::getAreasData(); // 地区信息列表
$refer = $this->get('refer', SITE_MAIN . '/?go=1');
$this->setCookie('refer', $refer);
... ... @@ -45,14 +46,14 @@ class RegController extends AbstractAction
$token = $this->get('token');
$mobile = $this->get('phoneNum');
$area = $this->get('areaCode', '86');
// 判断是否允许访问, 不允许则跳转到错误页面
if (!is_string($token) || !is_numeric($mobile) || !Helpers::verifyToken($mobile, $token)) {
$this->error();
}
$this->setTitle('注册-验证码');
$data = array(
'regCode' => true, // 模板中使用JS的标识
'backUrl' => '/', // 返回的URL链接
... ... @@ -61,8 +62,8 @@ class RegController extends AbstractAction
'areaCode' => '+' . $area, // 地区编号
'phoneNum' => $mobile, // 手机号
'token' => $token, // 访问令牌
);
);
$this->_view->display('code', $data);
}
... ... @@ -78,15 +79,14 @@ class RegController extends AbstractAction
$token = $this->get('token');
$mobile = $this->get('phoneNum');
$area = $this->get('areaCode', '86');
// 判断是否允许访问, 不允许则跳转到错误页面
if (!is_string($token) || !is_numeric($mobile) || !is_numeric($area)
|| !Helpers::verifyToken($mobile, $token)) {
if (!is_string($token) || !is_numeric($mobile) || !is_numeric($area) || !Helpers::verifyToken($mobile, $token)) {
$this->error();
}
$this->setTitle('注册-设置密码');
$data = array(
'regPwd' => true, // 模板中使用JS的标识
'backUrl' => '/', // 返回的URL链接
... ... @@ -99,7 +99,7 @@ class RegController extends AbstractAction
$this->_view->display('password', $data);
}
/**
* 验证注册的手机号
*
... ... @@ -110,37 +110,37 @@ class RegController extends AbstractAction
public function verifymobileAction()
{
$data = array('code' => 400, 'message' => '手机号已存在', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
$mobile = $this->post('phoneNum');
$area = $this->post('areaCode', '86');
/* 判断参数是否合法 */
if (!is_numeric($mobile) || !is_numeric($area)) {
break;
}
/* 向手机发送注册验证码 */
$data = RegData::sendCodeToMobile($area, $mobile); var_dump($data);
$data = RegData::sendCodeToMobile($area, $mobile);
var_dump($data);
if (!isset($data['code'])) {
break;
}
/* 返回跳转到验证页面的链接*/
/* 返回跳转到验证页面的链接 */
if ($data['code'] == 200) {
$token = Helpers::makeToken($mobile);
$data['data'] = '/passport/reg/code?token='.$token.'&phoneNum='.$mobile.'&areaCode='.$area;
$data['data'] = '/passport/reg/code?token=' . $token . '&phoneNum=' . $mobile . '&areaCode=' . $area;
}
} while (false);
$this->echoJson($data);
}
/**
* 验证注册的识别码
*
... ... @@ -153,13 +153,13 @@ class RegController extends AbstractAction
public function verifycodeAction()
{
$data = array('code' => 400, 'message' => '验证码错误', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
$mobile = $this->post('phoneNum');
$area = $this->post('areaCode');
$code = $this->post('code');
... ... @@ -167,26 +167,25 @@ class RegController extends AbstractAction
if (!is_numeric($mobile) || !is_numeric($area) || !isset($code)) {
break;
}
/* 验证注册的标识码是否有效 */
$data = RegData::validMobileCode($area, $mobile, $code);
if (!isset($data['code'])) {
break;
}
/* 返回跳转到设置密码的链接*/
/* 返回跳转到设置密码的链接 */
if ($data['code'] == 200) {
$token = Helpers::makeToken($mobile);
$data['data'] = '/passport/reg/password?token='.$token.'&phoneNum='.$mobile.'&areaCode='.$area;
$data['data'] = '/passport/reg/password?token=' . $token . '&phoneNum=' . $mobile . '&areaCode=' . $area;
} else if ($data['code'] == 404) {
$data['message'] = '验证码错误'; //统一验证提示
}
} while (false);
$this->echoJson($data);
}
/**
* 发送验证码
*
... ... @@ -197,31 +196,30 @@ class RegController extends AbstractAction
public function sendcodeAction()
{
$data = array('code' => 400, 'message' => '发送验证码失败', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
$mobile = $this->post('phoneNum');
$area = $this->post('areaCode', '86');
/* 判断参数是否合法 */
if (!is_numeric($mobile) || !is_numeric($area)) {
break;
}
/* 向手机发送注册验证码 */
$data = RegData::sendCodeToMobile($area, $mobile);
if (!isset($data['code'])) {
break;
}
} while (false);
$this->echoJson($data);
}
/**
* 设置密码
*
... ... @@ -234,13 +232,13 @@ class RegController extends AbstractAction
public function setpasswordAction()
{
$data = array('code' => 400, 'message' => '密码格式不正确', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
$token = $this->post('token');
$mobile = $this->post('phoneNum');
$area = $this->post('areaCode');
... ... @@ -249,7 +247,7 @@ class RegController extends AbstractAction
if (!is_string($token) || !is_numeric($mobile) || !is_numeric($area) || !isset($password)) {
break;
}
/* 判断是否允许访问 */
if (!Helpers::verifyToken($mobile, $token)) {
break;
... ... @@ -259,25 +257,28 @@ class RegController extends AbstractAction
if (!Helpers::verifyPassword($password)) {
break;
}
/* 验证注册的标识码是否有效 */
$data = RegData::regMobile($area, $mobile, $password);
if (!isset($data['code'])) {
break;
}
/* 返回跳转到来源页面 */
if ($data['code'] == 200) {
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
}
$data['data'] = rawurldecode($refer);
$data['data'] = array(
// 为了异步调用老系统的SESSION会话
'session' => 'http://m1.yohobuy.com/Passport/session/index?uid=' . $data['data']['uid'] . '&sign=' . md5($data['data']['uid'] . 'Js8Yn0!EwPM45-ws'),
'href' => rawurldecode($refer),
);
}
} while (false);
$this->echoJson($data);
}
}
\ No newline at end of file
}
... ...