|
@@ -17,26 +17,25 @@ class BindController extends AbstractAction |
|
@@ -17,26 +17,25 @@ class BindController extends AbstractAction |
17
|
public function indexAction()
|
17
|
public function indexAction()
|
18
|
{
|
18
|
{
|
19
|
$refer = $this->get('refer');
|
19
|
$refer = $this->get('refer');
|
20
|
- if (!empty($refer))
|
|
|
21
|
- {
|
20
|
+ if (!empty($refer)) {
|
22
|
$this->setCookie('refer', $refer);
|
21
|
$this->setCookie('refer', $refer);
|
23
|
}
|
22
|
}
|
24
|
|
23
|
|
25
|
$this->setTitle('绑定手机号');
|
24
|
$this->setTitle('绑定手机号');
|
26
|
-
|
25
|
+
|
27
|
$openId = $this->get('openId');
|
26
|
$openId = $this->get('openId');
|
28
|
$sourceType = $this->get('sourceType');
|
27
|
$sourceType = $this->get('sourceType');
|
29
|
$nickname = $this->get('nickname');
|
28
|
$nickname = $this->get('nickname');
|
30
|
$data = array(
|
29
|
$data = array(
|
31
|
- 'bindIndex'=>true,//js标识
|
|
|
32
|
- 'backUrl' => '/', // 返回的URL链接
|
30
|
+ 'bindIndex' => true, //js标识
|
|
|
31
|
+ 'backUrl' => Helpers::url('/signin.html'), // 返回的URL链接
|
33
|
'showHeaderImg' => true, // 控制显示头部图片
|
32
|
'showHeaderImg' => true, // 控制显示头部图片
|
34
|
'isPassportPage' => true, // 模板中模块标识
|
33
|
'isPassportPage' => true, // 模板中模块标识
|
35
|
'sourceType' => $sourceType, // 第三方登录来源
|
34
|
'sourceType' => $sourceType, // 第三方登录来源
|
36
|
- 'platform'=>$sourceType,
|
35
|
+ 'platform' => $sourceType,
|
37
|
'openId' => $openId, // openId
|
36
|
'openId' => $openId, // openId
|
38
|
- 'areaCode'=>'+86',//默认区号
|
|
|
39
|
- 'countrys'=>RegData::getAreasData(),//国别码
|
37
|
+ 'areaCode' => '+86', //默认区号
|
|
|
38
|
+ 'countrys' => RegData::getAreasData(), //国别码
|
40
|
'nickname' => $nickname, //昵称
|
39
|
'nickname' => $nickname, //昵称
|
41
|
);
|
40
|
);
|
42
|
|
41
|
|
|
@@ -49,26 +48,25 @@ class BindController extends AbstractAction |
|
@@ -49,26 +48,25 @@ class BindController extends AbstractAction |
49
|
*/
|
48
|
*/
|
50
|
public function codeAction()
|
49
|
public function codeAction()
|
51
|
{
|
50
|
{
|
52
|
-
|
|
|
53
|
$this->setTitle('验证手机');
|
51
|
$this->setTitle('验证手机');
|
54
|
$openId = $this->get('openId');
|
52
|
$openId = $this->get('openId');
|
55
|
$sourceType = $this->get('sourceType');
|
53
|
$sourceType = $this->get('sourceType');
|
56
|
$nickname = $this->get('nickname');
|
54
|
$nickname = $this->get('nickname');
|
57
|
$areaCode = $this->get('areaCode', '86');
|
55
|
$areaCode = $this->get('areaCode', '86');
|
58
|
$isReg = $this->get('isReg');
|
56
|
$isReg = $this->get('isReg');
|
59
|
- $phoneNum=$this->get('phoneNum');
|
|
|
60
|
-
|
57
|
+ $phoneNum = $this->get('phoneNum');
|
|
|
58
|
+
|
61
|
$data = array(
|
59
|
$data = array(
|
62
|
- 'bindCode'=>true,//js标识
|
|
|
63
|
- 'backUrl' => '/', // 返回的URL链接
|
60
|
+ 'bindCode' => true, //js标识
|
|
|
61
|
+ 'backUrl' => Helpers::url('/signin.html'), // 返回的URL链接
|
64
|
'showHeaderImg' => true, // 控制显示头部图片
|
62
|
'showHeaderImg' => true, // 控制显示头部图片
|
65
|
'isPassportPage' => true, // 模板中模块标识
|
63
|
'isPassportPage' => true, // 模板中模块标识
|
66
|
'sourceType' => $sourceType, // 第三方登录来源
|
64
|
'sourceType' => $sourceType, // 第三方登录来源
|
67
|
'openId' => $openId, // openId
|
65
|
'openId' => $openId, // openId
|
68
|
'nickname' => $nickname, //昵称
|
66
|
'nickname' => $nickname, //昵称
|
69
|
'isReg' => $isReg, //是否是已注册过的手机号
|
67
|
'isReg' => $isReg, //是否是已注册过的手机号
|
70
|
- 'areaCode' => $areaCode, //国别码
|
|
|
71
|
- 'phoneNum'=>$phoneNum,//手机号码
|
68
|
+ 'areaCode' => $areaCode, //国别码
|
|
|
69
|
+ 'phoneNum' => $phoneNum, //手机号码
|
72
|
);
|
70
|
);
|
73
|
|
71
|
|
74
|
// 渲染模板
|
72
|
// 渲染模板
|
|
@@ -80,22 +78,21 @@ class BindController extends AbstractAction |
|
@@ -80,22 +78,21 @@ class BindController extends AbstractAction |
80
|
*/
|
78
|
*/
|
81
|
public function passwordAction()
|
79
|
public function passwordAction()
|
82
|
{
|
80
|
{
|
83
|
-
|
|
|
84
|
$this->setTitle('重新设置登录密码');
|
81
|
$this->setTitle('重新设置登录密码');
|
85
|
$openId = $this->get('openId');
|
82
|
$openId = $this->get('openId');
|
86
|
$sourceType = $this->get('sourceType');
|
83
|
$sourceType = $this->get('sourceType');
|
87
|
$nickname = $this->get('nickname');
|
84
|
$nickname = $this->get('nickname');
|
88
|
$areaCode = $this->get('areaCode', '86');
|
85
|
$areaCode = $this->get('areaCode', '86');
|
89
|
- $phoneNum=$this->get('phoneNum');
|
86
|
+ $phoneNum = $this->get('phoneNum');
|
90
|
$data = array(
|
87
|
$data = array(
|
91
|
- 'bindPwd'=>true,//js标识
|
|
|
92
|
- 'backUrl' => '/', // 返回的URL链接
|
88
|
+ 'bindPwd' => true, //js标识
|
|
|
89
|
+ 'backUrl' => Helpers::url('/signin.html'), // 返回的URL链接
|
93
|
'showHeaderImg' => true, // 控制显示头部图片
|
90
|
'showHeaderImg' => true, // 控制显示头部图片
|
94
|
'isPassportPage' => true, // 模板中模块标识
|
91
|
'isPassportPage' => true, // 模板中模块标识
|
95
|
'sourceType' => $sourceType, // 第三方登录来源
|
92
|
'sourceType' => $sourceType, // 第三方登录来源
|
96
|
'openId' => $openId, // openId
|
93
|
'openId' => $openId, // openId
|
97
|
'nickname' => $nickname, //昵称
|
94
|
'nickname' => $nickname, //昵称
|
98
|
- 'areaCode' => $areaCode, //国别码
|
95
|
+ 'areaCode' => $areaCode, //国别码
|
99
|
'phoneNum' => $phoneNum //国别码
|
96
|
'phoneNum' => $phoneNum //国别码
|
100
|
);
|
97
|
);
|
101
|
|
98
|
|
|
@@ -108,11 +105,9 @@ class BindController extends AbstractAction |
|
@@ -108,11 +105,9 @@ class BindController extends AbstractAction |
108
|
{
|
105
|
{
|
109
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
106
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
110
|
|
107
|
|
111
|
- do
|
|
|
112
|
- {
|
108
|
+ do {
|
113
|
/* 判断是不是AJAX请求 */
|
109
|
/* 判断是不是AJAX请求 */
|
114
|
- if (!$this->isAjax())
|
|
|
115
|
- {
|
110
|
+ if (!$this->isAjax()) {
|
116
|
break;
|
111
|
break;
|
117
|
}
|
112
|
}
|
118
|
|
113
|
|
|
@@ -123,27 +118,21 @@ class BindController extends AbstractAction |
|
@@ -123,27 +118,21 @@ class BindController extends AbstractAction |
123
|
$nickname = $this->post('nickname');
|
118
|
$nickname = $this->post('nickname');
|
124
|
|
119
|
|
125
|
|
120
|
|
126
|
- if (!is_numeric($phoneNum) || !$openId || !$areaCode || !$sourceType)
|
|
|
127
|
- {
|
121
|
+ if (!is_numeric($phoneNum) || !$openId || !$areaCode || !$sourceType) {
|
128
|
break;
|
122
|
break;
|
129
|
}
|
123
|
}
|
130
|
|
124
|
|
131
|
$res = BindData::bindCheck($phoneNum, $openId, $sourceType);
|
125
|
$res = BindData::bindCheck($phoneNum, $openId, $sourceType);
|
132
|
- if (!isset($res['code']))
|
|
|
133
|
- {
|
126
|
+ if (!isset($res['code'])) {
|
134
|
break;
|
127
|
break;
|
135
|
}
|
128
|
}
|
136
|
- if ($res['code'] == 200)
|
|
|
137
|
- {
|
129
|
+ if ($res['code'] == 200) {
|
138
|
$next = Helpers::url('/passport/bind/code', array('isReg' => $res['data']['is_register'], 'openId' => $openId, 'sourceType' => $sourceType, 'nickname' => $nickname, 'areaCode' => $areaCode, 'phoneNum' => $phoneNum));
|
130
|
$next = Helpers::url('/passport/bind/code', array('isReg' => $res['data']['is_register'], 'openId' => $openId, 'sourceType' => $sourceType, 'nickname' => $nickname, 'areaCode' => $areaCode, 'phoneNum' => $phoneNum));
|
139
|
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('isReg' => $res['data']['is_register'], 'next' => $next));
|
131
|
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('isReg' => $res['data']['is_register'], 'next' => $next));
|
|
|
132
|
+ } else {
|
|
|
133
|
+ $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => isset($res['data']) ? $res['data'] : '');
|
140
|
}
|
134
|
}
|
141
|
- else
|
|
|
142
|
- {
|
|
|
143
|
- $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => isset($res['data'])?$res['data']:'');
|
|
|
144
|
- }
|
|
|
145
|
- }
|
|
|
146
|
- while (false);
|
135
|
+ } while (false);
|
147
|
|
136
|
|
148
|
$this->echoJson($data);
|
137
|
$this->echoJson($data);
|
149
|
}
|
138
|
}
|
|
@@ -153,29 +142,24 @@ class BindController extends AbstractAction |
|
@@ -153,29 +142,24 @@ class BindController extends AbstractAction |
153
|
{
|
142
|
{
|
154
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
143
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
155
|
|
144
|
|
156
|
- do
|
|
|
157
|
- {
|
145
|
+ do {
|
158
|
/* 判断是不是AJAX请求 */
|
146
|
/* 判断是不是AJAX请求 */
|
159
|
- if (!$this->isAjax())
|
|
|
160
|
- {
|
147
|
+ if (!$this->isAjax()) {
|
161
|
break;
|
148
|
break;
|
162
|
}
|
149
|
}
|
163
|
|
150
|
|
164
|
$phoneNum = $this->post('phoneNum');
|
151
|
$phoneNum = $this->post('phoneNum');
|
165
|
$areaCode = $this->post('areaCode');
|
152
|
$areaCode = $this->post('areaCode');
|
166
|
|
153
|
|
167
|
- if (!is_numeric($phoneNum))
|
|
|
168
|
- {
|
154
|
+ if (!is_numeric($phoneNum)) {
|
169
|
break;
|
155
|
break;
|
170
|
}
|
156
|
}
|
171
|
|
157
|
|
172
|
- $data = BindData::sendBindMsg($areaCode,$phoneNum);
|
|
|
173
|
- if (!isset($data['code']))
|
|
|
174
|
- {
|
158
|
+ $data = BindData::sendBindMsg($areaCode, $phoneNum);
|
|
|
159
|
+ if (!isset($data['code'])) {
|
175
|
break;
|
160
|
break;
|
176
|
}
|
161
|
}
|
177
|
- }
|
|
|
178
|
- while (false);
|
162
|
+ } while (false);
|
179
|
|
163
|
|
180
|
$this->echoJson($data);
|
164
|
$this->echoJson($data);
|
181
|
}
|
165
|
}
|
|
@@ -185,11 +169,9 @@ class BindController extends AbstractAction |
|
@@ -185,11 +169,9 @@ class BindController extends AbstractAction |
185
|
{
|
169
|
{
|
186
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
170
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
187
|
|
171
|
|
188
|
- do
|
|
|
189
|
- {
|
172
|
+ do {
|
190
|
/* 判断是不是AJAX请求 */
|
173
|
/* 判断是不是AJAX请求 */
|
191
|
- if (!$this->isAjax())
|
|
|
192
|
- {
|
174
|
+ if (!$this->isAjax()) {
|
193
|
break;
|
175
|
break;
|
194
|
}
|
176
|
}
|
195
|
|
177
|
|
|
@@ -197,18 +179,15 @@ class BindController extends AbstractAction |
|
@@ -197,18 +179,15 @@ class BindController extends AbstractAction |
197
|
$code = $this->post('code');
|
179
|
$code = $this->post('code');
|
198
|
$areaCode = $this->post('areaCode');
|
180
|
$areaCode = $this->post('areaCode');
|
199
|
|
181
|
|
200
|
- if (!is_numeric($phoneNum) || !$code)
|
|
|
201
|
- {
|
182
|
+ if (!is_numeric($phoneNum) || !$code) {
|
202
|
break;
|
183
|
break;
|
203
|
}
|
184
|
}
|
204
|
|
185
|
|
205
|
- $data = BindData::checkBindCode($areaCode,$phoneNum, $code);
|
|
|
206
|
- if (!isset($data['code']))
|
|
|
207
|
- {
|
186
|
+ $data = BindData::checkBindCode($areaCode, $phoneNum, $code);
|
|
|
187
|
+ if (!isset($data['code'])) {
|
208
|
break;
|
188
|
break;
|
209
|
}
|
189
|
}
|
210
|
- }
|
|
|
211
|
- while (false);
|
190
|
+ } while (false);
|
212
|
|
191
|
|
213
|
$this->echoJson($data);
|
192
|
$this->echoJson($data);
|
214
|
}
|
193
|
}
|
|
@@ -218,11 +197,9 @@ class BindController extends AbstractAction |
|
@@ -218,11 +197,9 @@ class BindController extends AbstractAction |
218
|
{
|
197
|
{
|
219
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
198
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
220
|
|
199
|
|
221
|
- do
|
|
|
222
|
- {
|
200
|
+ do {
|
223
|
/* 判断是不是AJAX请求 */
|
201
|
/* 判断是不是AJAX请求 */
|
224
|
- if (!$this->isAjax())
|
|
|
225
|
- {
|
202
|
+ if (!$this->isAjax()) {
|
226
|
break;
|
203
|
break;
|
227
|
}
|
204
|
}
|
228
|
|
205
|
|
|
@@ -233,42 +210,33 @@ class BindController extends AbstractAction |
|
@@ -233,42 +210,33 @@ class BindController extends AbstractAction |
233
|
$nickname = $this->post('nickname');
|
210
|
$nickname = $this->post('nickname');
|
234
|
$password = $this->post('password');
|
211
|
$password = $this->post('password');
|
235
|
|
212
|
|
236
|
- if (!is_numeric($phoneNum) || !$openId || !$sourceType || !$areaCode)
|
|
|
237
|
- {
|
213
|
+ if (!is_numeric($phoneNum) || !$openId || !$sourceType || !$areaCode) {
|
238
|
break;
|
214
|
break;
|
239
|
}
|
215
|
}
|
240
|
|
216
|
|
241
|
$res = BindData::bindMobile($openId, $nickname, $sourceType, $phoneNum, $areaCode, $password);
|
217
|
$res = BindData::bindMobile($openId, $nickname, $sourceType, $phoneNum, $areaCode, $password);
|
242
|
- if (!isset($res['code']))
|
|
|
243
|
- {
|
218
|
+ if (!isset($res['code'])) {
|
244
|
break;
|
219
|
break;
|
245
|
}
|
220
|
}
|
246
|
|
221
|
|
247
|
//绑定成功,跳转页面
|
222
|
//绑定成功,跳转页面
|
248
|
$refer = $this->getCookie('refer');
|
223
|
$refer = $this->getCookie('refer');
|
249
|
- if (empty($refer))
|
|
|
250
|
- {
|
224
|
+ if (empty($refer)) {
|
251
|
$refer = SITE_MAIN . '/?go=1';
|
225
|
$refer = SITE_MAIN . '/?go=1';
|
252
|
- }
|
|
|
253
|
- else
|
|
|
254
|
- {
|
226
|
+ } else {
|
255
|
$refer = rawurldecode($refer);
|
227
|
$refer = rawurldecode($refer);
|
256
|
}
|
228
|
}
|
257
|
-
|
|
|
258
|
- if (isset($res['code']) && $res['code'] == 200 && !empty($res['data']['uid']))
|
|
|
259
|
- {
|
229
|
+
|
|
|
230
|
+ if (isset($res['code']) && $res['code'] == 200 && !empty($res['data']['uid'])) {
|
260
|
$token = Helpers::makeToken($res['data']['uid']);
|
231
|
$token = Helpers::makeToken($res['data']['uid']);
|
261
|
$this->setCookie('_TOKEN', $token);
|
232
|
$this->setCookie('_TOKEN', $token);
|
262
|
$this->setSession('_TOKEN', $token);
|
233
|
$this->setSession('_TOKEN', $token);
|
263
|
$refer = Helpers::syncUserSession($res['data']['uid'], $refer);
|
234
|
$refer = Helpers::syncUserSession($res['data']['uid'], $refer);
|
264
|
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('refer' => $refer));
|
235
|
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('refer' => $refer));
|
265
|
- }
|
|
|
266
|
- else
|
|
|
267
|
- {
|
236
|
+ } else {
|
268
|
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('refer' => $refer));
|
237
|
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('refer' => $refer));
|
269
|
}
|
238
|
}
|
270
|
- }
|
|
|
271
|
- while (false);
|
239
|
+ } while (false);
|
272
|
|
240
|
|
273
|
$this->echoJson($data);
|
241
|
$this->echoJson($data);
|
274
|
}
|
242
|
}
|