Authored by whb

注册相关

@@ -43,7 +43,7 @@ class Yohobuy @@ -43,7 +43,7 @@ class Yohobuy
43 // const API_OLD = 'http://api2.open.yohobuy.com/'; 43 // const API_OLD = 'http://api2.open.yohobuy.com/';
44 44
45 /* PC重构地址 */ 45 /* PC重构地址 */
46 - const API_URL = 'http://test2.open.yohobuy.com/'; 46 + const API_URL = 'http://test.open.yohobuy.com/';
47 const SERVICE_URL = 'http://test.service.api.yohobuy.com/'; 47 const SERVICE_URL = 'http://test.service.api.yohobuy.com/';
48 const YOHOBUY_URL = 'http://www.yohobuy.com/'; 48 const YOHOBUY_URL = 'http://www.yohobuy.com/';
49 const API_OLD = 'http://api2.open.yohobuy.com/'; 49 const API_OLD = 'http://api2.open.yohobuy.com/';
@@ -77,7 +77,7 @@ class Process @@ -77,7 +77,7 @@ class Process
77 $val['url'] = Helpers::transUrl($val['url'], $type); 77 $val['url'] = Helpers::transUrl($val['url'], $type);
78 $temp['tplrecommend']['category'][] = array( 78 $temp['tplrecommend']['category'][] = array(
79 'name' => $val['name'], 79 'name' => $val['name'],
80 - 'url' => $val['url'] 80 + 'href' => $val['url']
81 ); 81 );
82 } 82 }
83 83
@@ -149,7 +149,8 @@ class Process @@ -149,7 +149,8 @@ class Process
149 $val['url'] = Helpers::transUrl($val['url'], $type); 149 $val['url'] = Helpers::transUrl($val['url'], $type);
150 $temp['list'][] = array( 150 $temp['list'][] = array(
151 'href' => $val['url'], 151 'href' => $val['url'],
152 - 'img' => $val['src'] 152 + 'img' => $val['src'],
  153 + // 'bgColor'=> $val[]
153 ); 154 );
154 } 155 }
155 156
1 <?php 1 <?php
2 use Action\WebAction; 2 use Action\WebAction;
3 use LibModels\Web\Passport\RegData; 3 use LibModels\Web\Passport\RegData;
4 -use Passport\RegModel;  
5 use Plugin\Helpers; 4 use Plugin\Helpers;
6 use Plugin\Cache; 5 use Plugin\Cache;
7 use Passport\PassportModel; 6 use Passport\PassportModel;
@@ -14,6 +13,7 @@ class RegisterController extends WebAction @@ -14,6 +13,7 @@ class RegisterController extends WebAction
14 { 13 {
15 $refer = $this->get('refer', SITE_MAIN); 14 $refer = $this->get('refer', SITE_MAIN);
16 $cover = PassportModel::getLeftBanner(PassportModel::REGISTER_LEFT_BANNER_CODE); 15 $cover = PassportModel::getLeftBanner(PassportModel::REGISTER_LEFT_BANNER_CODE);
  16 + $this->setSession('effective_time', time() + 1800);
17 $data = array( 17 $data = array(
18 'registerPage' => true, 18 'registerPage' => true,
19 'passport' => array( 19 'passport' => array(
@@ -31,8 +31,11 @@ class RegisterController extends WebAction @@ -31,8 +31,11 @@ class RegisterController extends WebAction
31 $this->setCookie('refer', $refer); 31 $this->setCookie('refer', $refer);
32 $this->_view->display('index', $data); 32 $this->_view->display('index', $data);
33 } 33 }
  34 +
34 /** 35 /**
  36 + * 检测手机号
35 * 37 *
  38 + * @return json
36 */ 39 */
37 public function checkmobileAction() 40 public function checkmobileAction()
38 { 41 {
@@ -41,7 +44,7 @@ class RegisterController extends WebAction @@ -41,7 +44,7 @@ class RegisterController extends WebAction
41 $ip = Helpers::getClientIp(); 44 $ip = Helpers::getClientIp();
42 $data = array('code' => 400, 'message' => '', 'data' => ''); 45 $data = array('code' => 400, 'message' => '', 'data' => '');
43 $ip_key = md5('ip_checkmobile_' . $ip); 46 $ip_key = md5('ip_checkmobile_' . $ip);
44 - $ip_times = Cache::increment($ip_key); 47 + $ip_times = Cache::increment($ip_key, 1, 0, 3600);
45 do{ 48 do{
46 /* 判断是不是AJAX请求 */ 49 /* 判断是不是AJAX请求 */
47 if (!$this->isAjax()) { 50 if (!$this->isAjax()) {
@@ -57,8 +60,8 @@ class RegisterController extends WebAction @@ -57,8 +60,8 @@ class RegisterController extends WebAction
57 break; 60 break;
58 } 61 }
59 if(!empty(PassportModel::getUserInfoByMobile($area, $mobile))) { 62 if(!empty(PassportModel::getUserInfoByMobile($area, $mobile))) {
60 - $data['message'] = '手机号码已经存在';  
61 - break; 63 + $data['message'] = '手机号码已经存在';
  64 + break;
62 } 65 }
63 $data['code'] = 200; 66 $data['code'] = 200;
64 } while(false); 67 } while(false);
@@ -93,7 +96,13 @@ class RegisterController extends WebAction @@ -93,7 +96,13 @@ class RegisterController extends WebAction
93 $data['message'] = '验证码不正确'; 96 $data['message'] = '验证码不正确';
94 break; 97 break;
95 } 98 }
96 - 99 + //发送代码
  100 + $send_code_key = md5('send_code_' .$area.'_'.$mobile);
  101 + $send_code_times = Cache::increment($send_code_key, 1, 0, 3600);
  102 + if($send_code_times > 50) {
  103 + $data['message'] = '发送验证码太多';
  104 + break;
  105 + }
97 /* 向手机发送注册验证码 */ 106 /* 向手机发送注册验证码 */
98 $data = RegData::sendCodeToMobile($area, $mobile); 107 $data = RegData::sendCodeToMobile($area, $mobile);
99 if (!isset($data['code'])) { 108 if (!isset($data['code'])) {
@@ -149,6 +158,12 @@ class RegisterController extends WebAction @@ -149,6 +158,12 @@ class RegisterController extends WebAction
149 $data['message'] = '验证码错误'; 158 $data['message'] = '验证码错误';
150 break; 159 break;
151 } 160 }
  161 + $effective_time = $this->getSession('effective_time');
  162 + if($effective_time < time() || empty($effective_time))
  163 + {
  164 + $data['message'] = '注册超时';
  165 + break;
  166 + }
152 /*手机注册*/ 167 /*手机注册*/
153 $data = RegData::regMobile($area, $mobile, $password); 168 $data = RegData::regMobile($area, $mobile, $password);
154 if (!isset($data['code']) || $data['code'] != 200) { 169 if (!isset($data['code']) || $data['code'] != 200) {
@@ -161,17 +176,15 @@ class RegisterController extends WebAction @@ -161,17 +176,15 @@ class RegisterController extends WebAction
161 } else { 176 } else {
162 $refer = rawurldecode($refer); 177 $refer = rawurldecode($refer);
163 } 178 }
164 -  
165 -// $data['data']['href'] = $refer;  
166 -// $data['data']['session'] = Helpers::syncUserSession($data['data']['uid']); 179 + $data['code'] = 200;
  180 + $data['data']['href'] = $refer;
  181 + $data['data']['session'] = Helpers::syncUserSession($data['data']['uid']);
167 $token = Helpers::makeToken($data['data']['uid']); 182 $token = Helpers::makeToken($data['data']['uid']);
168 $this->setCookie('_TOKEN', $token); 183 $this->setCookie('_TOKEN', $token);
169 $this->setSession('_TOKEN', $token); 184 $this->setSession('_TOKEN', $token);
170 $this->setSession('_LOGIN_UID', $data['data']['uid']); 185 $this->setSession('_LOGIN_UID', $data['data']['uid']);
171 - //$this->setSession('session_key', $data['data']['session_key']);  
172 -  
173 }while(false); 186 }while(false);
174 - $this->go($refer); 187 + echo $this->echoJson($data);
175 } 188 }
176 189
177 } 190 }