Authored by xiaowei

手机号码绑定

@@ -42,12 +42,13 @@ class BindData @@ -42,12 +42,13 @@ class BindData
42 * @param string $mobile 手机号 42 * @param string $mobile 手机号
43 * 43 *
44 */ 44 */
45 - public static function sendBindMsg($mobile) 45 + public static function sendBindMsg($area,$mobile)
46 { 46 {
47 $param = Yohobuy::param(); 47 $param = Yohobuy::param();
48 48
49 $param['method'] = 'app.passport.smsbind'; 49 $param['method'] = 'app.passport.smsbind';
50 $param['mobile'] = $mobile; 50 $param['mobile'] = $mobile;
  51 + $param['area'] = $area;
51 $param['client_secret'] = Sign::getSign($param); 52 $param['client_secret'] = Sign::getSign($param);
52 53
53 return Yohobuy::get(Yohobuy::API_URL, $param); 54 return Yohobuy::get(Yohobuy::API_URL, $param);
@@ -57,13 +58,14 @@ class BindData @@ -57,13 +58,14 @@ class BindData
57 * 验证验证码是否正确 58 * 验证验证码是否正确
58 * 59 *
59 */ 60 */
60 - public static function checkBindCode($mobile, $code) 61 + public static function checkBindCode($area,$mobile, $code)
61 { 62 {
62 $param = Yohobuy::param(); 63 $param = Yohobuy::param();
63 64
64 $param['method'] = 'app.register.validRegCode'; 65 $param['method'] = 'app.register.validRegCode';
65 $param['mobile'] = $mobile; 66 $param['mobile'] = $mobile;
66 $param['code'] = $code; 67 $param['code'] = $code;
  68 + $param['area'] = $area;
67 $param['client_secret'] = Sign::getSign($param); 69 $param['client_secret'] = Sign::getSign($param);
68 70
69 return Yohobuy::get(Yohobuy::API_URL, $param); 71 return Yohobuy::get(Yohobuy::API_URL, $param);
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 use Action\AbstractAction; 3 use Action\AbstractAction;
4 use LibModels\Wap\Passport\BindData; 4 use LibModels\Wap\Passport\BindData;
  5 +use LibModels\Wap\Passport\RegData;
5 use Plugin\Helpers; 6 use Plugin\Helpers;
6 7
7 /** 8 /**
@@ -15,14 +16,28 @@ class BindController extends AbstractAction @@ -15,14 +16,28 @@ class BindController extends AbstractAction
15 */ 16 */
16 public function indexAction() 17 public function indexAction()
17 { 18 {
  19 + $refer = $this->get('refer');
  20 + if (!empty($refer))
  21 + {
  22 + $this->setCookie('refer', $refer);
  23 + }
  24 +
18 $this->setTitle('绑定手机号'); 25 $this->setTitle('绑定手机号');
  26 +
19 $openId = $this->get('openId'); 27 $openId = $this->get('openId');
20 $sourceType = $this->get('sourceType'); 28 $sourceType = $this->get('sourceType');
21 - $nickName = $this->get('nickName'); 29 + $nickname = $this->get('nickname');
22 $data = array( 30 $data = array(
  31 + 'bindIndex'=>true,//js标识
  32 + 'backUrl' => '/', // 返回的URL链接
  33 + 'showHeaderImg' => true, // 控制显示头部图片
  34 + 'isPassportPage' => true, // 模板中模块标识
23 'sourceType' => $sourceType, // 第三方登录来源 35 'sourceType' => $sourceType, // 第三方登录来源
  36 + 'platform'=>$sourceType,
24 'openId' => $openId, // openId 37 'openId' => $openId, // openId
25 - 'nickname' => $nickName, //昵称 38 + 'areaCode'=>'+86',//默认区号
  39 + 'countrys'=>RegData::getAreasData(),//国别码
  40 + 'nickname' => $nickname, //昵称
26 ); 41 );
27 42
28 // 渲染模板 43 // 渲染模板
@@ -38,16 +53,22 @@ class BindController extends AbstractAction @@ -38,16 +53,22 @@ class BindController extends AbstractAction
38 $this->setTitle('验证手机'); 53 $this->setTitle('验证手机');
39 $openId = $this->get('openId'); 54 $openId = $this->get('openId');
40 $sourceType = $this->get('sourceType'); 55 $sourceType = $this->get('sourceType');
41 - $nickName = $this->get('nickName');  
42 - $area = $this->get('areaCode', '86'); 56 + $nickname = $this->get('nickname');
  57 + $areaCode = $this->get('areaCode', '86');
43 $isReg = $this->get('isReg'); 58 $isReg = $this->get('isReg');
  59 + $mobile=$this->get('mobile');
44 60
45 $data = array( 61 $data = array(
  62 + 'bindIndex'=>true,//js标识
  63 + 'backUrl' => '/', // 返回的URL链接
  64 + 'showHeaderImg' => true, // 控制显示头部图片
  65 + 'isPassportPage' => true, // 模板中模块标识
46 'sourceType' => $sourceType, // 第三方登录来源 66 'sourceType' => $sourceType, // 第三方登录来源
47 'openId' => $openId, // openId 67 'openId' => $openId, // openId
48 - 'nickname' => $nickName, //昵称 68 + 'nickname' => $nickname, //昵称
49 'isReg' => $isReg, //是否是已注册过的手机号 69 'isReg' => $isReg, //是否是已注册过的手机号
50 - 'area' => $area //国别码 70 + 'areaCode' => $areaCode, //国别码
  71 + 'phoneNum'=>$mobile,//手机号码
51 ); 72 );
52 73
53 // 渲染模板 74 // 渲染模板
@@ -63,13 +84,17 @@ class BindController extends AbstractAction @@ -63,13 +84,17 @@ class BindController extends AbstractAction
63 $this->setTitle('重新设置登录密码'); 84 $this->setTitle('重新设置登录密码');
64 $openId = $this->get('openId'); 85 $openId = $this->get('openId');
65 $sourceType = $this->get('sourceType'); 86 $sourceType = $this->get('sourceType');
66 - $nickName = $this->get('nickName');  
67 - $area = $this->get('areaCode', '86'); 87 + $nickname = $this->get('nickname');
  88 + $areaCode = $this->get('areaCode', '86');
68 $data = array( 89 $data = array(
  90 + 'bindIndex'=>true,//js标识
  91 + 'backUrl' => '/', // 返回的URL链接
  92 + 'showHeaderImg' => true, // 控制显示头部图片
  93 + 'isPassportPage' => true, // 模板中模块标识
69 'sourceType' => $sourceType, // 第三方登录来源 94 'sourceType' => $sourceType, // 第三方登录来源
70 'openId' => $openId, // openId 95 'openId' => $openId, // openId
71 - 'nickname' => $nickName, //昵称  
72 - 'area' => $area //国别码 96 + 'nickname' => $nickname, //昵称
  97 + 'areaCode' => $areaCode //国别码
73 ); 98 );
74 99
75 // 渲染模板 100 // 渲染模板
@@ -91,12 +116,12 @@ class BindController extends AbstractAction @@ -91,12 +116,12 @@ class BindController extends AbstractAction
91 116
92 $mobile = $this->post('mobile'); 117 $mobile = $this->post('mobile');
93 $openId = $this->post('openId'); 118 $openId = $this->post('openId');
94 - $area = $this->post('areaCode', '86'); 119 + $areaCode = $this->post('areaCode', '86');
95 $sourceType = $this->post('sourceType'); 120 $sourceType = $this->post('sourceType');
96 - $nickName = $this->post('nickName'); 121 + $nickname = $this->post('nickname');
97 122
98 123
99 - if (!is_numeric($mobile) || !$openId || !$area || !$sourceType) 124 + if (!is_numeric($mobile) || !$openId || !$areaCode || !$sourceType)
100 { 125 {
101 break; 126 break;
102 } 127 }
@@ -108,7 +133,7 @@ class BindController extends AbstractAction @@ -108,7 +133,7 @@ class BindController extends AbstractAction
108 } 133 }
109 if ($res['code'] == 200) 134 if ($res['code'] == 200)
110 { 135 {
111 - $next = Helpers::url('/passport/bind/code', array('isReg' => $res['data']['is_register'], 'openId' => $openId, 'sourceType' => $sourceType, 'nickName' => $nickName, 'areaCode' => $area, 'mobile' => $mobile)); 136 + $next = Helpers::url('/passport/bind/code', array('isReg' => $res['data']['is_register'], 'openId' => $openId, 'sourceType' => $sourceType, 'nickname' => $nickname, 'areaCode' => $areaCode, 'mobile' => $mobile));
112 $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('is_register' => $res['data']['is_register'], 'next' => $next)); 137 $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('is_register' => $res['data']['is_register'], 'next' => $next));
113 } 138 }
114 else 139 else
@@ -135,13 +160,14 @@ class BindController extends AbstractAction @@ -135,13 +160,14 @@ class BindController extends AbstractAction
135 } 160 }
136 161
137 $mobile = $this->post('mobile'); 162 $mobile = $this->post('mobile');
  163 + $areaCode = $this->post('areaCode');
138 164
139 if (!is_numeric($mobile)) 165 if (!is_numeric($mobile))
140 { 166 {
141 break; 167 break;
142 } 168 }
143 169
144 - $data = BindData::sendBindMsg($mobile); 170 + $data = BindData::sendBindMsg($areaCode,$mobile);
145 if (!isset($data['code'])) 171 if (!isset($data['code']))
146 { 172 {
147 break; 173 break;
@@ -167,13 +193,14 @@ class BindController extends AbstractAction @@ -167,13 +193,14 @@ class BindController extends AbstractAction
167 193
168 $mobile = $this->post('mobile'); 194 $mobile = $this->post('mobile');
169 $msgCode = $this->post('msgCode'); 195 $msgCode = $this->post('msgCode');
  196 + $areaCode = $this->post('areaCode');
170 197
171 if (!is_numeric($mobile) || !$msgCode) 198 if (!is_numeric($mobile) || !$msgCode)
172 { 199 {
173 break; 200 break;
174 } 201 }
175 202
176 - $data = BindData::checkBindCode($mobile, $msgCode); 203 + $data = BindData::checkBindCode($areaCode,$mobile, $msgCode);
177 if (!isset($data['code'])) 204 if (!isset($data['code']))
178 { 205 {
179 break; 206 break;
@@ -199,17 +226,17 @@ class BindController extends AbstractAction @@ -199,17 +226,17 @@ class BindController extends AbstractAction
199 226
200 $mobile = $this->post('mobile'); 227 $mobile = $this->post('mobile');
201 $openId = $this->post('openId'); 228 $openId = $this->post('openId');
202 - $area = $this->post('areaCode', '86'); 229 + $areaCode = $this->post('areaCode', '86');
203 $sourceType = $this->post('sourceType'); 230 $sourceType = $this->post('sourceType');
204 - $nickName = $this->post('nickName'); 231 + $nickname = $this->post('nickname');
205 $password = $this->post('password'); 232 $password = $this->post('password');
206 233
207 - if (!is_numeric($mobile) || !$openId || !$sourceType || !$area) 234 + if (!is_numeric($mobile) || !$openId || !$sourceType || !$areaCode)
208 { 235 {
209 break; 236 break;
210 } 237 }
211 238
212 - $res = BindData::bindMobile($openId, $nickName, $sourceType, $mobile, $area, $password); 239 + $res = BindData::bindMobile($openId, $nickname, $sourceType, $mobile, $areaCode, $password);
213 if (!isset($res['code'])) 240 if (!isset($res['code']))
214 { 241 {
215 break; 242 break;