Showing
8 changed files
with
51 additions
and
60 deletions
@@ -30,7 +30,6 @@ class LoginData extends \LibModels\Wap\Passport\LoginData | @@ -30,7 +30,6 @@ class LoginData extends \LibModels\Wap\Passport\LoginData | ||
30 | // 构建必传参数 | 30 | // 构建必传参数 |
31 | $param = Yohobuy::param(); | 31 | $param = Yohobuy::param(); |
32 | 32 | ||
33 | - $param['v'] = '4'; | ||
34 | $param['method'] = 'app.passport.signinByOpenID'; | 33 | $param['method'] = 'app.passport.signinByOpenID'; |
35 | $param['openId'] = $openId; | 34 | $param['openId'] = $openId; |
36 | $param['source_type'] = $sourceType; | 35 | $param['source_type'] = $sourceType; |
@@ -26,8 +26,8 @@ class PassportModel | @@ -26,8 +26,8 @@ class PassportModel | ||
26 | const AUTOUSERINFO_LEFT_BANNER_CODE = 'c62d5da06d843b6ed78d8d27e87fa143'; //完善信息页左边的banner | 26 | const AUTOUSERINFO_LEFT_BANNER_CODE = 'c62d5da06d843b6ed78d8d27e87fa143'; //完善信息页左边的banner |
27 | const BACK_FIND_SECRET_KEY = '_+@#$%^'; | 27 | const BACK_FIND_SECRET_KEY = '_+@#$%^'; |
28 | 28 | ||
29 | - //简单头部 | ||
30 | - public static function getSimpleHeader($isLogin, $username = '') | 29 | + //默认简单头部(不带登录信息 请登录/注册) |
30 | + public static function getSimpleHeader() | ||
31 | { | 31 | { |
32 | //拼接简单头部 | 32 | //拼接简单头部 |
33 | $tool = array( | 33 | $tool = array( |
@@ -36,20 +36,10 @@ class PassportModel | @@ -36,20 +36,10 @@ class PassportModel | ||
36 | 'orderHref' => Helpers::url('/home/orders?t=' . time()), //订单中心连接 | 36 | 'orderHref' => Helpers::url('/home/orders?t=' . time()), //订单中心连接 |
37 | 'helpHref' => Helpers::url('/help'), | 37 | 'helpHref' => Helpers::url('/help'), |
38 | ); | 38 | ); |
39 | - if ($isLogin) { | ||
40 | - $tool+=array( | ||
41 | - 'user' => $username, | ||
42 | - 'userCenter' => Helpers::url('/home?t=' . time()), //用户中心链接 | ||
43 | - 'logoutHref' => Helpers::url('/logout.html?t=' . time()), //退出 | ||
44 | - ); | ||
45 | - } | ||
46 | - else { | ||
47 | $tool+=array( | 39 | $tool+=array( |
48 | 'loginHref' => Helpers::url('/signin.html'), //登录链接,已登录不传 | 40 | 'loginHref' => Helpers::url('/signin.html'), //登录链接,已登录不传 |
49 | 'registerHref' => Helpers::url('/reg.html'), //注册链接,已登录不传 | 41 | 'registerHref' => Helpers::url('/reg.html'), //注册链接,已登录不传 |
50 | ); | 42 | ); |
51 | - } | ||
52 | - | ||
53 | $simpleHeader = array( | 43 | $simpleHeader = array( |
54 | 'logo' => array( | 44 | 'logo' => array( |
55 | 'img' => 'http://static.yohobuy.com/newheader/img/logo_e.png', | 45 | 'img' => 'http://static.yohobuy.com/newheader/img/logo_e.png', |
@@ -57,7 +47,6 @@ class PassportModel | @@ -57,7 +47,6 @@ class PassportModel | ||
57 | ), | 47 | ), |
58 | 'tool' => $tool | 48 | 'tool' => $tool |
59 | ); | 49 | ); |
60 | - | ||
61 | return $simpleHeader; | 50 | return $simpleHeader; |
62 | } | 51 | } |
63 | 52 |
@@ -133,20 +133,16 @@ class AutosignController extends WebAction | @@ -133,20 +133,16 @@ class AutosignController extends WebAction | ||
133 | 133 | ||
134 | $refer = $this->getCookie('refer'); | 134 | $refer = $this->getCookie('refer'); |
135 | if (empty($refer)) { | 135 | if (empty($refer)) { |
136 | - $refer = SITE_MAIN . '/?go=1'; | 136 | + $refer = SITE_MAIN; |
137 | } | 137 | } |
138 | else { | 138 | else { |
139 | $refer = rawurldecode($refer); | 139 | $refer = rawurldecode($refer); |
140 | } | 140 | } |
141 | 141 | ||
142 | //判定是否需要绑定手机号 | 142 | //判定是否需要绑定手机号 |
143 | - if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') { | ||
144 | - $token = Helpers::makeToken($result['data']['uid']); | ||
145 | - $this->setSession('_TOKEN', $token); | ||
146 | - $this->setSession('_LOGIN_UID', $result['data']['uid']); | ||
147 | - $this->setCookie('_TOKEN', $token); | ||
148 | - $fillHerf = rawurlencode(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $access['openid'], 'sourceType' => 'qq', 'nickname' => $partnerInfo['nickname']))); | ||
149 | - $this->go(Helpers::syncUserSession($result['data']['uid'], $fillHerf)); | 143 | + if (isset($result['data']['is_bind']) && $result['data']['is_bind'] == 'N') { |
144 | + $fillHerf = Helpers::url('/passport/thirdlogin/index', array('openId' => $access['openid'], 'sourceType' => 'qq', 'nickname' => $partnerInfo['nickname'])); | ||
145 | + $this->go($fillHerf); | ||
150 | } | 146 | } |
151 | 147 | ||
152 | if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { | 148 | if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { |
@@ -273,7 +269,7 @@ class AutosignController extends WebAction | @@ -273,7 +269,7 @@ class AutosignController extends WebAction | ||
273 | $this->setSession('_TOKEN', $token); | 269 | $this->setSession('_TOKEN', $token); |
274 | $this->setSession('_LOGIN_UID', $result['data']['uid']); | 270 | $this->setSession('_LOGIN_UID', $result['data']['uid']); |
275 | $this->setCookie('_TOKEN', $token); | 271 | $this->setCookie('_TOKEN', $token); |
276 | - $fillHerf =rawurlencode(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $access['douban_user_id'], 'sourceType' => 'douban', 'nickname' => $partnerInfo['name']))); | 272 | + $fillHerf = rawurlencode(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $access['douban_user_id'], 'sourceType' => 'douban', 'nickname' => $partnerInfo['name']))); |
277 | $this->go(Helpers::syncUserSession($result['data']['uid'], $fillHerf)); | 273 | $this->go(Helpers::syncUserSession($result['data']['uid'], $fillHerf)); |
278 | } | 274 | } |
279 | 275 | ||
@@ -311,7 +307,7 @@ class AutosignController extends WebAction | @@ -311,7 +307,7 @@ class AutosignController extends WebAction | ||
311 | $result = array(); | 307 | $result = array(); |
312 | if ($partnerInfo && is_array($partnerInfo)) { | 308 | if ($partnerInfo && is_array($partnerInfo)) { |
313 | $shoppingKey = Helpers::getShoppingKeyByCookie(); | 309 | $shoppingKey = Helpers::getShoppingKeyByCookie(); |
314 | - $result = LoginData::signinByOpenID($partnerInfo['nickname'],$partnerInfo['openid'], 'wechat', $shoppingKey,$partnerInfo['openid']); | 310 | + $result = LoginData::signinByOpenID($partnerInfo['nickname'], $partnerInfo['openid'], 'wechat', $shoppingKey, $partnerInfo['openid']); |
315 | } | 311 | } |
316 | 312 | ||
317 | //判定是否需要绑定手机号 | 313 | //判定是否需要绑定手机号 |
@@ -320,7 +316,7 @@ class AutosignController extends WebAction | @@ -320,7 +316,7 @@ class AutosignController extends WebAction | ||
320 | $this->setSession('_TOKEN', $token); | 316 | $this->setSession('_TOKEN', $token); |
321 | $this->setSession('_LOGIN_UID', $result['data']['uid']); | 317 | $this->setSession('_LOGIN_UID', $result['data']['uid']); |
322 | $this->setCookie('_TOKEN', $token); | 318 | $this->setCookie('_TOKEN', $token); |
323 | - $fillHerf =rawurlencode(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $partnerInfo['openid'], 'sourceType' => 'wechat', 'nickname' => $partnerInfo['nickname']))); | 319 | + $fillHerf = rawurlencode(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $partnerInfo['openid'], 'sourceType' => 'wechat', 'nickname' => $partnerInfo['nickname']))); |
324 | $this->go(Helpers::syncUserSession($result['data']['uid'], $fillHerf)); | 320 | $this->go(Helpers::syncUserSession($result['data']['uid'], $fillHerf)); |
325 | } | 321 | } |
326 | 322 | ||
@@ -343,4 +339,5 @@ class AutosignController extends WebAction | @@ -343,4 +339,5 @@ class AutosignController extends WebAction | ||
343 | $this->go($refer); | 339 | $this->go($refer); |
344 | } | 340 | } |
345 | } | 341 | } |
342 | + | ||
346 | } | 343 | } |
@@ -39,7 +39,7 @@ class AutouserinfoController extends WebAction | @@ -39,7 +39,7 @@ class AutouserinfoController extends WebAction | ||
39 | $isLogin = true; | 39 | $isLogin = true; |
40 | $username = $this->_uname; | 40 | $username = $this->_uname; |
41 | } | 41 | } |
42 | - $simpleHeader = PassportModel::getSimpleHeader($isLogin, $username); | 42 | + $simpleHeader = PassportModel::getSimpleHeader(); |
43 | $cover = PassportModel::getLeftBanner(PassportModel::AUTOUSERINFO_LEFT_BANNER_CODE); | 43 | $cover = PassportModel::getLeftBanner(PassportModel::AUTOUSERINFO_LEFT_BANNER_CODE); |
44 | 44 | ||
45 | //整合 | 45 | //整合 |
@@ -76,15 +76,7 @@ class AutouserinfoController extends WebAction | @@ -76,15 +76,7 @@ class AutouserinfoController extends WebAction | ||
76 | $openId = $this->get('openId'); | 76 | $openId = $this->get('openId'); |
77 | $sourceType = $this->get('sourceType'); | 77 | $sourceType = $this->get('sourceType'); |
78 | 78 | ||
79 | - if (!$uid) { | ||
80 | - $isLogin = false; | ||
81 | - $username = ''; | ||
82 | - } | ||
83 | - else { | ||
84 | - $isLogin = true; | ||
85 | - $username = $this->_uname; | ||
86 | - } | ||
87 | - $simpleHeader = PassportModel::getSimpleHeader($isLogin, $username); | 79 | + $simpleHeader = PassportModel::getSimpleHeader(); |
88 | $cover = PassportModel::getLeftBanner(PassportModel::AUTOUSERINFO_LEFT_BANNER_CODE); | 80 | $cover = PassportModel::getLeftBanner(PassportModel::AUTOUSERINFO_LEFT_BANNER_CODE); |
89 | //整合 | 81 | //整合 |
90 | $data = array( | 82 | $data = array( |
@@ -224,7 +216,7 @@ class AutouserinfoController extends WebAction | @@ -224,7 +216,7 @@ class AutouserinfoController extends WebAction | ||
224 | $code = trim($this->post('code')); //短信验证码 | 216 | $code = trim($this->post('code')); //短信验证码 |
225 | //校验手机号格式 | 217 | //校验手机号格式 |
226 | if (!is_numeric($phoneNum) || !is_numeric($areaCode)) { | 218 | if (!is_numeric($phoneNum) || !is_numeric($areaCode)) { |
227 | - $data['code'] = 401; | 219 | + $data['code'] = 400; |
228 | $data['message'] = '手机号码格式不正确'; | 220 | $data['message'] = '手机号码格式不正确'; |
229 | break; | 221 | break; |
230 | } | 222 | } |
@@ -264,23 +256,25 @@ class AutouserinfoController extends WebAction | @@ -264,23 +256,25 @@ class AutouserinfoController extends WebAction | ||
264 | 256 | ||
265 | //校验手机号格式 | 257 | //校验手机号格式 |
266 | if (!is_numeric($phoneNum) || !is_numeric($areaCode)) { | 258 | if (!is_numeric($phoneNum) || !is_numeric($areaCode)) { |
267 | - $data['code'] = 401; | 259 | + $data['code'] = 400; |
268 | $data['message'] = '手机号码格式不正确'; | 260 | $data['message'] = '手机号码格式不正确'; |
269 | break; | 261 | break; |
270 | } | 262 | } |
263 | + //校验图形验证码 | ||
271 | $picFlag = PassportModel::verifyCode($verifyCode); | 264 | $picFlag = PassportModel::verifyCode($verifyCode); |
272 | if (!$picFlag) { | 265 | if (!$picFlag) { |
273 | - $data['code'] = 402; | 266 | + $data['code'] = 400; |
274 | $data['message'] = '图形验证码不正确'; | 267 | $data['message'] = '图形验证码不正确'; |
275 | break; | 268 | break; |
276 | } | 269 | } |
270 | + //校验手机验证码 | ||
277 | $bindMsgFlag = BindData::checkBindCode($areaCode, $phoneNum, $code); | 271 | $bindMsgFlag = BindData::checkBindCode($areaCode, $phoneNum, $code); |
278 | if (isset($bindMsgFlag['code']) && $bindMsgFlag['code'] != 200) { | 272 | if (isset($bindMsgFlag['code']) && $bindMsgFlag['code'] != 200) { |
279 | - $data['code'] = 403; | 273 | + $data['code'] = 400; |
280 | $data['message'] = '短信验证码不正确'; | 274 | $data['message'] = '短信验证码不正确'; |
281 | break; | 275 | break; |
282 | } | 276 | } |
283 | - | 277 | + //绑定手机号 |
284 | $res = BindData::bindMobile($openId, $sourceType, $phoneNum, $areaCode, $password); | 278 | $res = BindData::bindMobile($openId, $sourceType, $phoneNum, $areaCode, $password); |
285 | if (!isset($res['code'])) { | 279 | if (!isset($res['code'])) { |
286 | break; | 280 | break; |
@@ -13,7 +13,7 @@ class BackController extends WebAction { | @@ -13,7 +13,7 @@ class BackController extends WebAction { | ||
13 | public function indexAction() { | 13 | public function indexAction() { |
14 | $banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE); | 14 | $banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE); |
15 | $data = array ( | 15 | $data = array ( |
16 | - 'simpleHeader' => PassportModel::getSimpleHeader(false), | 16 | + 'simpleHeader' => PassportModel::getSimpleHeader(), |
17 | 'backPage' => true, | 17 | 'backPage' => true, |
18 | 'back' => array ( | 18 | 'back' => array ( |
19 | 'coverHref' => $banner ['url'], | 19 | 'coverHref' => $banner ['url'], |
@@ -128,7 +128,7 @@ class BackController extends WebAction { | @@ -128,7 +128,7 @@ class BackController extends WebAction { | ||
128 | $emailUrl = 'http://mail.'.$emailArr[1]; | 128 | $emailUrl = 'http://mail.'.$emailArr[1]; |
129 | } | 129 | } |
130 | $data = array ( | 130 | $data = array ( |
131 | - 'simpleHeader' => PassportModel::getSimpleHeader(false), | 131 | + 'simpleHeader' => PassportModel::getSimpleHeader(), |
132 | 'sendEmail' => array ( | 132 | 'sendEmail' => array ( |
133 | 'coverHref' => $banner ['url'], | 133 | 'coverHref' => $banner ['url'], |
134 | 'coverImg' => $banner ['img'], | 134 | 'coverImg' => $banner ['img'], |
@@ -166,7 +166,7 @@ class BackController extends WebAction { | @@ -166,7 +166,7 @@ class BackController extends WebAction { | ||
166 | } | 166 | } |
167 | $banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE); | 167 | $banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE); |
168 | $data = array ( | 168 | $data = array ( |
169 | - 'simpleHeader' => PassportModel::getSimpleHeader(false), | 169 | + 'simpleHeader' => PassportModel::getSimpleHeader(), |
170 | 'resetPage' => true, | 170 | 'resetPage' => true, |
171 | 'resetPwd' => array ( | 171 | 'resetPwd' => array ( |
172 | 'coverHref' => $banner ['url'], | 172 | 'coverHref' => $banner ['url'], |
@@ -224,7 +224,7 @@ class BackController extends WebAction { | @@ -224,7 +224,7 @@ class BackController extends WebAction { | ||
224 | { | 224 | { |
225 | $banner = PassportModel::getLeftBanner ( PassportModel::BACK_LFFT_BANNER_CODE ); | 225 | $banner = PassportModel::getLeftBanner ( PassportModel::BACK_LFFT_BANNER_CODE ); |
226 | $data = array ( | 226 | $data = array ( |
227 | - 'simpleHeader' => PassportModel::getSimpleHeader ( false ), | 227 | + 'simpleHeader' => PassportModel::getSimpleHeader (), |
228 | 'resetSuccess' => array ( | 228 | 'resetSuccess' => array ( |
229 | 'coverHref' => $banner ['url'], | 229 | 'coverHref' => $banner ['url'], |
230 | 'coverImg' => $banner ['img'], | 230 | 'coverImg' => $banner ['img'], |
@@ -247,7 +247,7 @@ class BackController extends WebAction { | @@ -247,7 +247,7 @@ class BackController extends WebAction { | ||
247 | } | 247 | } |
248 | $banner = PassportModel::getLeftBanner (PassportModel::BACK_LFFT_BANNER_CODE); | 248 | $banner = PassportModel::getLeftBanner (PassportModel::BACK_LFFT_BANNER_CODE); |
249 | $data = array ( | 249 | $data = array ( |
250 | - 'simpleHeader' => PassportModel::getSimpleHeader ( false ), | 250 | + 'simpleHeader' => PassportModel::getSimpleHeader (), |
251 | 'vertificationPage' => true, | 251 | 'vertificationPage' => true, |
252 | 'verification' => array ( | 252 | 'verification' => array ( |
253 | 'coverHref' => $banner ['url'], | 253 | 'coverHref' => $banner ['url'], |
@@ -23,17 +23,7 @@ class LoginController extends WebAction | @@ -23,17 +23,7 @@ class LoginController extends WebAction | ||
23 | if (!empty($refer)) { | 23 | if (!empty($refer)) { |
24 | $this->setCookie('refer', $refer); | 24 | $this->setCookie('refer', $refer); |
25 | } | 25 | } |
26 | - //获取用户 | ||
27 | - $uid = $this->getUid(true); | ||
28 | - if (!$uid) { | ||
29 | - $isLogin = false; | ||
30 | - $username = ''; | ||
31 | - } | ||
32 | - else { | ||
33 | - $isLogin = true; | ||
34 | - $username = $this->_uname; | ||
35 | - } | ||
36 | - $simpleHeader = PassportModel::getSimpleHeader($isLogin, $username); | 26 | + $simpleHeader = PassportModel::getSimpleHeader(); |
37 | //获取登陆页左侧资源 | 27 | //获取登陆页左侧资源 |
38 | $cover = PassportModel::getLeftBanner(PassportModel::SIGNIN_LEFT_BANNER_CODE); | 28 | $cover = PassportModel::getLeftBanner(PassportModel::SIGNIN_LEFT_BANNER_CODE); |
39 | //是否记住密码 | 29 | //是否记住密码 |
@@ -17,7 +17,7 @@ class RegisterController extends WebAction | @@ -17,7 +17,7 @@ class RegisterController extends WebAction | ||
17 | $this->setSession('effective_time', time() + 1800); | 17 | $this->setSession('effective_time', time() + 1800); |
18 | $data = array( | 18 | $data = array( |
19 | 'registerPage' => true, | 19 | 'registerPage' => true, |
20 | - 'simpleHeader' => PassportModel::getSimpleHeader(false), | 20 | + 'simpleHeader' => PassportModel::getSimpleHeader(), |
21 | 'passport' => array( | 21 | 'passport' => array( |
22 | 'actionUrl' => SITE_MAIN.'/passport/register/mobileregister', | 22 | 'actionUrl' => SITE_MAIN.'/passport/register/mobileregister', |
23 | 'region' => RegData::getAreasData(), | 23 | 'region' => RegData::getAreasData(), |
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | use Action\WebAction; | 3 | use Action\WebAction; |
4 | +use Passport\PassportModel; | ||
5 | +use LibModels\Wap\Passport\RegData; | ||
4 | 6 | ||
5 | class ThirdloginController extends WebAction | 7 | class ThirdloginController extends WebAction |
6 | { | 8 | { |
7 | 9 | ||
8 | /** | 10 | /** |
9 | - * 登录页 | 11 | + * 第三方联合登录手机绑定流程页 |
10 | */ | 12 | */ |
11 | public function indexAction() | 13 | public function indexAction() |
12 | { | 14 | { |
15 | + $this->setTitle('联合登录补全信息'); | ||
16 | +// $nickname = $this->get('nickname'); | ||
17 | + $openId = trim($this->get('openId')); | ||
18 | + $sourceType = trim($this->get('sourceType')); | ||
19 | + | ||
20 | + //登录后跳转页面 | ||
21 | + $refer = $this->getCookie('refer'); | ||
22 | + if (empty($refer)) { | ||
23 | + $refer = SITE_MAIN; | ||
24 | + } | ||
25 | + else { | ||
26 | + $refer = rawurldecode($refer); | ||
27 | + } | ||
28 | + | ||
29 | + $simpleHeader = PassportModel::getSimpleHeader(); | ||
30 | + | ||
31 | + //整合 | ||
13 | $data = array( | 32 | $data = array( |
33 | + 'thirdLogin' => true, | ||
34 | + 'simpleHeader' => $simpleHeader, | ||
35 | + 'openId' => $openId, | ||
36 | + 'sourceType' => $sourceType, | ||
37 | + 'region' => RegData::getAreasData(), | ||
14 | ); | 38 | ); |
15 | 39 | ||
16 | $this->_view->display('index', $data); | 40 | $this->_view->display('index', $data); |
17 | } | 41 | } |
18 | 42 | ||
19 | - | ||
20 | - | ||
21 | } | 43 | } |
-
Please register or login to post a comment