Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
6 changed files
with
110 additions
and
52 deletions
@@ -68,7 +68,7 @@ class AbstractAction extends Controller_Abstract | @@ -68,7 +68,7 @@ class AbstractAction extends Controller_Abstract | ||
68 | case 'develop': // 开发 | 68 | case 'develop': // 开发 |
69 | default: | 69 | default: |
70 | $this->_view->assign('devEnv', true); | 70 | $this->_view->assign('devEnv', true); |
71 | - $this->_useSession = true; | 71 | + $this->_useSession = false; |
72 | break; | 72 | break; |
73 | } | 73 | } |
74 | } | 74 | } |
@@ -55,7 +55,7 @@ class Call extends Factory | @@ -55,7 +55,7 @@ class Call extends Factory | ||
55 | 55 | ||
56 | try | 56 | try |
57 | { | 57 | { |
58 | - $token = $this->renn->getTokenFromTokenEndpoint('code', $keys, TokenType::Bearer); | 58 | + $token = $this->renn->getTokenFromTokenEndpoint('code', $keys, \TokenType::Bearer); |
59 | 59 | ||
60 | // 返回数组格式的信息 | 60 | // 返回数组格式的信息 |
61 | $token = $this->renn->getTokens(); | 61 | $token = $this->renn->getTokens(); |
@@ -84,7 +84,7 @@ class Call extends Factory | @@ -84,7 +84,7 @@ class Call extends Factory | ||
84 | { | 84 | { |
85 | if (is_array($token)) | 85 | if (is_array($token)) |
86 | { | 86 | { |
87 | - $token = new AccessToken(isset($token['type']) ? $token['type'] : TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null); | 87 | + $token = new \AccessToken(isset($token['token_type']) ? $token['token_type'] : \TokenType::Bearer, $token['access_token'], isset($token['refresh_token']) ? $token['refresh_token'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null); |
88 | } | 88 | } |
89 | // 获得保存的token | 89 | // 获得保存的token |
90 | $this->renn->authWithToken($token); | 90 | $this->renn->authWithToken($token); |
@@ -130,7 +130,7 @@ class Call extends Factory | @@ -130,7 +130,7 @@ class Call extends Factory | ||
130 | { | 130 | { |
131 | if (is_array($token)) | 131 | if (is_array($token)) |
132 | { | 132 | { |
133 | - $token = new AccessToken(isset($token['type']) ? $token['type'] : TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null); | 133 | + $token = new \AccessToken(isset($token['type']) ? $token['type'] : \TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null); |
134 | } | 134 | } |
135 | // 获得保存的token | 135 | // 获得保存的token |
136 | $this->renn->authWithToken($token); | 136 | $this->renn->authWithToken($token); |
@@ -178,7 +178,7 @@ class Call extends Factory | @@ -178,7 +178,7 @@ class Call extends Factory | ||
178 | { | 178 | { |
179 | if (is_array($token)) | 179 | if (is_array($token)) |
180 | { | 180 | { |
181 | - $token = new AccessToken(isset($token['type']) ? $token['type'] : TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null); | 181 | + $token = new \AccessToken(isset($token['type']) ? $token['type'] : \TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null); |
182 | } | 182 | } |
183 | // 获得保存的token | 183 | // 获得保存的token |
184 | $this->renn->authWithToken($token); | 184 | $this->renn->authWithToken($token); |
@@ -538,29 +538,35 @@ exports.init = function(page) { | @@ -538,29 +538,35 @@ exports.init = function(page) { | ||
538 | 538 | ||
539 | var time = 0, | 539 | var time = 0, |
540 | t, | 540 | t, |
541 | - refer = data.href; | 541 | + refer; |
542 | 542 | ||
543 | - t = setTimeout(function() { | ||
544 | - time++; | ||
545 | - }, 1000); | 543 | + if (data.code === 200) { |
546 | 544 | ||
547 | - $.ajax({ | ||
548 | - type: 'POST', | ||
549 | - url: '/passport/register/mobileregister', | ||
550 | - data: { | ||
551 | - session: data.session | ||
552 | - } | ||
553 | - }).then(function(data) { | 545 | + refer = data.data.href; |
546 | + | ||
547 | + t = setTimeout(function() { | ||
548 | + time++; | ||
549 | + }, 1000); | ||
550 | + | ||
551 | + $.ajax({ | ||
552 | + type: 'GET', | ||
553 | + url: data.data.session | ||
554 | + }).then(function(data) { | ||
555 | + | ||
556 | + if (data.code === 200 && t < 3) { | ||
557 | + clearInterval(t); | ||
558 | + location.href = refer; | ||
559 | + } | ||
560 | + }); | ||
554 | 561 | ||
555 | - if (data.code === 200 && t < 3) { | 562 | + if (t >= 3) { |
556 | clearInterval(t); | 563 | clearInterval(t); |
557 | location.href = refer; | 564 | location.href = refer; |
558 | } | 565 | } |
559 | - }); | 566 | + } else { |
560 | 567 | ||
561 | - if (t >= 3) { | ||
562 | - clearInterval(t); | ||
563 | - location.href = refer; | 568 | + //todo |
569 | + console.log('网络超时~'); | ||
564 | } | 570 | } |
565 | 571 | ||
566 | }); | 572 | }); |
@@ -50,7 +50,7 @@ class AutouserinfoController extends AbstractAction | @@ -50,7 +50,7 @@ class AutouserinfoController extends AbstractAction | ||
50 | 'actionUrl' => Helpers::url('/autouserinfo/bind'), | 50 | 'actionUrl' => Helpers::url('/autouserinfo/bind'), |
51 | 'region' => RegData::getAreasData(), | 51 | 'region' => RegData::getAreasData(), |
52 | 'location' => '+86', | 52 | 'location' => '+86', |
53 | - 'captchaUrl' => '/passport/images?t=1449799445', | 53 | + 'captchaUrl' => Helpers::url('/passport/images?t=' . time()), |
54 | 'itemUrl' => Helpers::url('/help/?category_id=9'), | 54 | 'itemUrl' => Helpers::url('/help/?category_id=9'), |
55 | 'referUrl' => $refer, | 55 | 'referUrl' => $refer, |
56 | 'skipUrl' => SITE_MAIN, | 56 | 'skipUrl' => SITE_MAIN, |
@@ -71,7 +71,7 @@ class AutouserinfoController extends AbstractAction | @@ -71,7 +71,7 @@ class AutouserinfoController extends AbstractAction | ||
71 | public function userInfoAction() | 71 | public function userInfoAction() |
72 | { | 72 | { |
73 | //获取用户 | 73 | //获取用户 |
74 | - $uid = $this->getUid(true); | 74 | + $uid = $this->getUid(false); |
75 | $nickname = $this->get('nickname'); | 75 | $nickname = $this->get('nickname'); |
76 | $openId = $this->get('openId'); | 76 | $openId = $this->get('openId'); |
77 | $sourceType = $this->get('sourceType'); | 77 | $sourceType = $this->get('sourceType'); |
@@ -113,9 +113,9 @@ class AutouserinfoController extends AbstractAction | @@ -113,9 +113,9 @@ class AutouserinfoController extends AbstractAction | ||
113 | break; | 113 | break; |
114 | } | 114 | } |
115 | 115 | ||
116 | - $phoneNum = trim($this->post('phoneNum')); | 116 | + $phoneNum = trim($this->post('mobile')); |
117 | $openId = trim($this->post('openId')); | 117 | $openId = trim($this->post('openId')); |
118 | - $areaCode = trim($this->post('areaCode', '86')); | 118 | + $areaCode = trim($this->post('area', '86')); |
119 | $sourceType = trim($this->post('sourceType')); | 119 | $sourceType = trim($this->post('sourceType')); |
120 | 120 | ||
121 | 121 | ||
@@ -152,20 +152,20 @@ class AutouserinfoController extends AbstractAction | @@ -152,20 +152,20 @@ class AutouserinfoController extends AbstractAction | ||
152 | break; | 152 | break; |
153 | } | 153 | } |
154 | 154 | ||
155 | - $phoneNum = trim($this->post('phoneNum')); | ||
156 | - $areaCode = trim($this->post('areaCode')); | 155 | + $phoneNum = trim($this->post('mobile')); |
156 | + $areaCode = trim($this->post('area')); | ||
157 | $verifyCode = trim($this->post('verifyCode')); | 157 | $verifyCode = trim($this->post('verifyCode')); |
158 | 158 | ||
159 | //校验手机号格式 | 159 | //校验手机号格式 |
160 | if (!is_numeric($phoneNum) || !is_numeric($areaCode)) { | 160 | if (!is_numeric($phoneNum) || !is_numeric($areaCode)) { |
161 | - $data['code'] = 401; | 161 | + $data['code'] = 400; |
162 | $data['message'] = '手机号码格式不正确'; | 162 | $data['message'] = '手机号码格式不正确'; |
163 | break; | 163 | break; |
164 | } | 164 | } |
165 | 165 | ||
166 | //检测验证码不正确 | 166 | //检测验证码不正确 |
167 | if (!PassportModel::verifyCode($verifyCode)) { | 167 | if (!PassportModel::verifyCode($verifyCode)) { |
168 | - $data['code'] = 402; | 168 | + $data['code'] = 400; |
169 | $data['message'] = '图形验证码不正确'; | 169 | $data['message'] = '图形验证码不正确'; |
170 | break; | 170 | break; |
171 | } | 171 | } |
@@ -183,7 +183,6 @@ class AutouserinfoController extends AbstractAction | @@ -183,7 +183,6 @@ class AutouserinfoController extends AbstractAction | ||
183 | /* | 183 | /* |
184 | * 校验图形验证码 | 184 | * 校验图形验证码 |
185 | */ | 185 | */ |
186 | - | ||
187 | public function checkPicCodeAction() | 186 | public function checkPicCodeAction() |
188 | { | 187 | { |
189 | $data = array('code' => 400, 'message' => '', 'data' => ''); | 188 | $data = array('code' => 400, 'message' => '', 'data' => ''); |
@@ -193,7 +192,7 @@ class AutouserinfoController extends AbstractAction | @@ -193,7 +192,7 @@ class AutouserinfoController extends AbstractAction | ||
193 | if (!$this->isAjax()) { | 192 | if (!$this->isAjax()) { |
194 | break; | 193 | break; |
195 | } | 194 | } |
196 | - $verifyCode = $phoneNum = trim($this->post('verifyCode')); | 195 | + $verifyCode = trim($this->post('verifyCode')); |
197 | $picFlag = PassportModel::verifyCode($verifyCode); | 196 | $picFlag = PassportModel::verifyCode($verifyCode); |
198 | if ($picFlag) { | 197 | if ($picFlag) { |
199 | $data = array('code' => 200, 'message' => '验证码正确', 'data' => ''); | 198 | $data = array('code' => 200, 'message' => '验证码正确', 'data' => ''); |
@@ -220,8 +219,8 @@ class AutouserinfoController extends AbstractAction | @@ -220,8 +219,8 @@ class AutouserinfoController extends AbstractAction | ||
220 | break; | 219 | break; |
221 | } | 220 | } |
222 | 221 | ||
223 | - $phoneNum = trim($this->post('phoneNum')); | ||
224 | - $areaCode = trim($this->post('areaCode')); | 222 | + $phoneNum = trim($this->post('mobile')); |
223 | + $areaCode = trim($this->post('area')); | ||
225 | $code = trim($this->post('code')); //短信验证码 | 224 | $code = trim($this->post('code')); //短信验证码 |
226 | //校验手机号格式 | 225 | //校验手机号格式 |
227 | if (!is_numeric($phoneNum) || !is_numeric($areaCode)) { | 226 | if (!is_numeric($phoneNum) || !is_numeric($areaCode)) { |
@@ -253,8 +252,8 @@ class AutouserinfoController extends AbstractAction | @@ -253,8 +252,8 @@ class AutouserinfoController extends AbstractAction | ||
253 | break; | 252 | break; |
254 | } | 253 | } |
255 | 254 | ||
256 | - $phoneNum = trim($this->post('phoneNum')); | ||
257 | - $areaCode = trim($this->post('areaCode', '86')); | 255 | + $phoneNum = trim($this->post('mobile')); |
256 | + $areaCode = trim($this->post('area', '86')); | ||
258 | $openId = trim($this->post('openId')); | 257 | $openId = trim($this->post('openId')); |
259 | $sourceType = trim($this->post('sourceType')); | 258 | $sourceType = trim($this->post('sourceType')); |
260 | $code = trim($this->post('code')); //短信验证码 | 259 | $code = trim($this->post('code')); //短信验证码 |
@@ -73,15 +73,40 @@ class RegisterController extends WebAction | @@ -73,15 +73,40 @@ class RegisterController extends WebAction | ||
73 | } | 73 | } |
74 | 74 | ||
75 | /** | 75 | /** |
76 | - * 校验并发送验证码 | 76 | + * 校验图形验证码 |
77 | * | 77 | * |
78 | * @return json | 78 | * @return json |
79 | */ | 79 | */ |
80 | public function piccaptchaAction() | 80 | public function piccaptchaAction() |
81 | { | 81 | { |
82 | + $data = array('code' => 400, 'message' => '', 'data' => ''); | ||
83 | + | ||
84 | + do { | ||
85 | + /* 判断是不是AJAX请求 */ | ||
86 | + if (!$this->isAjax()) { | ||
87 | + break; | ||
88 | + } | ||
89 | + $verifyCode = trim($this->post('verifyCode')); | ||
90 | + $picFlag = PassportModel::verifyCode($verifyCode); | ||
91 | + if ($picFlag) { | ||
92 | + $data = array('code' => 200, 'message' => '验证码正确', 'data' => ''); | ||
93 | + } | ||
94 | + else { | ||
95 | + $data = array('code' => 400, 'message' => '验证码错误', 'data' => ''); | ||
96 | + } | ||
97 | + } | ||
98 | + while (false); | ||
99 | + | ||
100 | + $this->echoJson($data); | ||
101 | + } | ||
102 | + | ||
103 | + /** | ||
104 | + * 发送短信验证码 | ||
105 | + */ | ||
106 | + public function sendBindMsgAction(){ | ||
82 | $mobile = trim($this->post('mobile'), ' '); | 107 | $mobile = trim($this->post('mobile'), ' '); |
83 | $area = intval(trim($this->post('area'), ' ')); | 108 | $area = intval(trim($this->post('area'), ' ')); |
84 | - $verifyCode = strtolower(trim($this->post('code'),' ')); | 109 | + $verifyCode = strtolower(trim($this->post('verifyCode'),' ')); |
85 | $data = array('code' => 400, 'message' => '', 'data' => ''); | 110 | $data = array('code' => 400, 'message' => '', 'data' => ''); |
86 | do | 111 | do |
87 | { | 112 | { |
@@ -91,13 +116,14 @@ class RegisterController extends WebAction | @@ -91,13 +116,14 @@ class RegisterController extends WebAction | ||
91 | } | 116 | } |
92 | /* 判断参数是否合法 */ | 117 | /* 判断参数是否合法 */ |
93 | if (!is_numeric($mobile) || !is_numeric($area)) { | 118 | if (!is_numeric($mobile) || !is_numeric($area)) { |
94 | - $code = 400; | 119 | + $data['code'] = 400; |
95 | $data['message'] = '手机号码格式不正确'; | 120 | $data['message'] = '手机号码格式不正确'; |
96 | break; | 121 | break; |
97 | } | 122 | } |
98 | //检测验证码不正确 | 123 | //检测验证码不正确 |
99 | if(!PassportModel::verifyCode($verifyCode)) { | 124 | if(!PassportModel::verifyCode($verifyCode)) { |
100 | - $data['message'] = '验证码不正确'; | 125 | + $data['code'] = 400; |
126 | + $data['message'] = '图形验证码不正确'; | ||
101 | break; | 127 | break; |
102 | } | 128 | } |
103 | //发送代码 | 129 | //发送代码 |
@@ -119,7 +145,32 @@ class RegisterController extends WebAction | @@ -119,7 +145,32 @@ class RegisterController extends WebAction | ||
119 | 145 | ||
120 | public function msgcaptchaAction() | 146 | public function msgcaptchaAction() |
121 | { | 147 | { |
122 | - $this->echoJson(array('code'=>200)); | 148 | + $data = array('code' => 400, 'message' => '', 'data' => ''); |
149 | + | ||
150 | + do { | ||
151 | + /* 判断是不是AJAX请求 */ | ||
152 | + if (!$this->isAjax()) { | ||
153 | + break; | ||
154 | + } | ||
155 | + | ||
156 | + $phoneNum = trim($this->post('mobile')); | ||
157 | + $areaCode = trim($this->post('area')); | ||
158 | + $code = trim($this->post('code')); //短信验证码 | ||
159 | + //校验手机号格式 | ||
160 | + if (!is_numeric($phoneNum) || !is_numeric($areaCode)) { | ||
161 | + $data['code'] = 401; | ||
162 | + $data['message'] = '手机号码格式不正确'; | ||
163 | + break; | ||
164 | + } | ||
165 | + | ||
166 | + $data = BindData::checkBindCode($areaCode, $phoneNum, $code); | ||
167 | + if (!isset($data['code'])) { | ||
168 | + break; | ||
169 | + } | ||
170 | + } | ||
171 | + while (false); | ||
172 | + | ||
173 | + $this->echoJson($data); | ||
123 | } | 174 | } |
124 | 175 | ||
125 | /** | 176 | /** |
@@ -130,7 +181,7 @@ class RegisterController extends WebAction | @@ -130,7 +181,7 @@ class RegisterController extends WebAction | ||
130 | { | 181 | { |
131 | $mobile = trim($this->post('mobile'), ' ');//mobile | 182 | $mobile = trim($this->post('mobile'), ' ');//mobile |
132 | $area = intval(trim($this->post('area'), ' '));//area | 183 | $area = intval(trim($this->post('area'), ' '));//area |
133 | - $verifyCode = strtolower(trim($this->post('captcha'),' '));//captcha | 184 | + $verifyCode = strtolower(trim($this->post('verifyCode'),' '));//图形验证码 |
134 | $code = trim($this->post('code'),'');//code | 185 | $code = trim($this->post('code'),'');//code |
135 | $password = $this->post('password'); | 186 | $password = $this->post('password'); |
136 | $url = '/passport/register/index'; | 187 | $url = '/passport/register/index'; |
@@ -156,18 +207,18 @@ class RegisterController extends WebAction | @@ -156,18 +207,18 @@ class RegisterController extends WebAction | ||
156 | $data['message'] = '密码不正确'; | 207 | $data['message'] = '密码不正确'; |
157 | break; | 208 | break; |
158 | } | 209 | } |
210 | + $effective_time = $this->getSession('effective_time'); | ||
211 | + if($effective_time < time() || empty($effective_time)) | ||
212 | + { | ||
213 | + $data['message'] = '注册超时'; | ||
214 | + break; | ||
215 | + } | ||
159 | /* 验证注册的标识码是否有效 */ | 216 | /* 验证注册的标识码是否有效 */ |
160 | $data = RegData::validMobileCode($area, $mobile, $code); | 217 | $data = RegData::validMobileCode($area, $mobile, $code); |
161 | if (!isset($data['code']) || $data['code'] != 200) { | 218 | if (!isset($data['code']) || $data['code'] != 200) { |
162 | $data['message'] = '验证码错误'; | 219 | $data['message'] = '验证码错误'; |
163 | break; | 220 | break; |
164 | } | 221 | } |
165 | - $effective_time = $this->getSession('effective_time'); | ||
166 | - if($effective_time < time() || empty($effective_time)) | ||
167 | - { | ||
168 | - $data['message'] = '注册超时'; | ||
169 | - break; | ||
170 | - } | ||
171 | /*手机注册*/ | 222 | /*手机注册*/ |
172 | $data = RegData::regMobile($area, $mobile, $password); | 223 | $data = RegData::regMobile($area, $mobile, $password); |
173 | if (!isset($data['code']) || $data['code'] != 200) { | 224 | if (!isset($data['code']) || $data['code'] != 200) { |
@@ -13,13 +13,15 @@ class SaleController extends WebAction | @@ -13,13 +13,15 @@ class SaleController extends WebAction | ||
13 | public function indexAction() | 13 | public function indexAction() |
14 | { | 14 | { |
15 | //获取专区ID | 15 | //获取专区ID |
16 | - $specialsaleId = $this->param('specialsaleId'); | 16 | + $specialsaleId = $this->get('specialsale_id'); |
17 | $specialInfo = SaleData::getSpecial($specialsaleId); | 17 | $specialInfo = SaleData::getSpecial($specialsaleId); |
18 | - $special = $specialInfo['data']; | ||
19 | - | 18 | + if(isset($specialInfo['data'])) { |
19 | + $special = $specialInfo['data']; | ||
20 | + } else { | ||
21 | + $special = array(); | ||
22 | + } | ||
20 | //获取促销ID | 23 | //获取促销ID |
21 | - $promotion = $this->param('promotion'); | ||
22 | - | 24 | + $promotion = $this->get('promotion'); |
23 | //专区ID和促销ID都为空时,跳转到主页 | 25 | //专区ID和促销ID都为空时,跳转到主页 |
24 | if (empty($specialsaleId) && empty($promotion)) { | 26 | if (empty($specialsaleId) && empty($promotion)) { |
25 | $this->go(SITE_MAIN); | 27 | $this->go(SITE_MAIN); |
-
Please register or login to post a comment