Authored by whb

注册相关

... ... @@ -43,7 +43,7 @@ class Yohobuy
// const API_OLD = 'http://api2.open.yohobuy.com/';
/* PC重构地址 */
const API_URL = 'http://test2.open.yohobuy.com/';
const API_URL = 'http://test.open.yohobuy.com/';
const SERVICE_URL = 'http://test.service.api.yohobuy.com/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_OLD = 'http://api2.open.yohobuy.com/';
... ...
... ... @@ -77,7 +77,7 @@ class Process
$val['url'] = Helpers::transUrl($val['url'], $type);
$temp['tplrecommend']['category'][] = array(
'name' => $val['name'],
'url' => $val['url']
'href' => $val['url']
);
}
... ... @@ -149,7 +149,8 @@ class Process
$val['url'] = Helpers::transUrl($val['url'], $type);
$temp['list'][] = array(
'href' => $val['url'],
'img' => $val['src']
'img' => $val['src'],
// 'bgColor'=> $val[]
);
}
... ...
<?php
use Action\WebAction;
use LibModels\Web\Passport\RegData;
use Passport\RegModel;
use Plugin\Helpers;
use Plugin\Cache;
use Passport\PassportModel;
... ... @@ -14,6 +13,7 @@ class RegisterController extends WebAction
{
$refer = $this->get('refer', SITE_MAIN);
$cover = PassportModel::getLeftBanner(PassportModel::REGISTER_LEFT_BANNER_CODE);
$this->setSession('effective_time', time() + 1800);
$data = array(
'registerPage' => true,
'passport' => array(
... ... @@ -31,8 +31,11 @@ class RegisterController extends WebAction
$this->setCookie('refer', $refer);
$this->_view->display('index', $data);
}
/**
* 检测手机号
*
* @return json
*/
public function checkmobileAction()
{
... ... @@ -41,7 +44,7 @@ class RegisterController extends WebAction
$ip = Helpers::getClientIp();
$data = array('code' => 400, 'message' => '', 'data' => '');
$ip_key = md5('ip_checkmobile_' . $ip);
$ip_times = Cache::increment($ip_key);
$ip_times = Cache::increment($ip_key, 1, 0, 3600);
do{
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
... ... @@ -93,7 +96,13 @@ class RegisterController extends WebAction
$data['message'] = '验证码不正确';
break;
}
//发送代码
$send_code_key = md5('send_code_' .$area.'_'.$mobile);
$send_code_times = Cache::increment($send_code_key, 1, 0, 3600);
if($send_code_times > 50) {
$data['message'] = '发送验证码太多';
break;
}
/* 向手机发送注册验证码 */
$data = RegData::sendCodeToMobile($area, $mobile);
if (!isset($data['code'])) {
... ... @@ -149,6 +158,12 @@ class RegisterController extends WebAction
$data['message'] = '验证码错误';
break;
}
$effective_time = $this->getSession('effective_time');
if($effective_time < time() || empty($effective_time))
{
$data['message'] = '注册超时';
break;
}
/*手机注册*/
$data = RegData::regMobile($area, $mobile, $password);
if (!isset($data['code']) || $data['code'] != 200) {
... ... @@ -161,17 +176,15 @@ class RegisterController extends WebAction
} else {
$refer = rawurldecode($refer);
}
// $data['data']['href'] = $refer;
// $data['data']['session'] = Helpers::syncUserSession($data['data']['uid']);
$data['code'] = 200;
$data['data']['href'] = $refer;
$data['data']['session'] = Helpers::syncUserSession($data['data']['uid']);
$token = Helpers::makeToken($data['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $data['data']['uid']);
//$this->setSession('session_key', $data['data']['session_key']);
}while(false);
$this->go($refer);
echo $this->echoJson($data);
}
}
\ No newline at end of file
... ...