|  | @@ -9,6 +9,7 @@ use app\common\library\Wechat;
 | 
											
												
													
														|  |  use app\common\service\UserService;
 |  |  use app\common\service\UserService;
 | 
											
												
													
														|  |  use fast\Random;
 |  |  use fast\Random;
 | 
											
												
													
														|  |  use think\Exception;
 |  |  use think\Exception;
 | 
											
												
													
														|  | 
 |  | +use think\Log;
 | 
											
												
													
														|  |  use think\Validate;
 |  |  use think\Validate;
 | 
											
												
													
														|  |  use miniprogram\wxBizDataCrypt;
 |  |  use miniprogram\wxBizDataCrypt;
 | 
											
												
													
														|  |  use onlogin\onlogin;
 |  |  use onlogin\onlogin;
 | 
											
										
											
												
													
														|  | @@ -722,6 +723,7 @@ class User extends Api
 | 
											
												
													
														|  |          $wechat = new Wechat();
 |  |          $wechat = new Wechat();
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          $wxuserinfo = $wechat->getwxuserinfo($code);
 |  |          $wxuserinfo = $wechat->getwxuserinfo($code);
 | 
											
												
													
														|  | 
 |  | +        Log::error('code:'.$code.',wxuserinfo:'.json_encode($wxuserinfo));
 | 
											
												
													
														|  |          if(!$wxuserinfo){
 |  |          if(!$wxuserinfo){
 | 
											
												
													
														|  |              $this->error('openid获取失败');
 |  |              $this->error('openid获取失败');
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
										
											
												
													
														|  | @@ -1121,8 +1123,8 @@ class User extends Api
 | 
											
												
													
														|  |      {
 |  |      {
 | 
											
												
													
														|  |          //$user = $this->auth->getUser();
 |  |          //$user = $this->auth->getUser();
 | 
											
												
													
														|  |          $user = model('User')->find($this->auth->id);
 |  |          $user = model('User')->find($this->auth->id);
 | 
											
												
													
														|  | -        $mobile = $this->request->post('mobile');
 |  | 
 | 
											
												
													
														|  | -        $captcha = $this->request->post('captcha');
 |  | 
 | 
											
												
													
														|  | 
 |  | +        $mobile = $this->request->param('mobile');
 | 
											
												
													
														|  | 
 |  | +        $captcha = $this->request->param('captcha');
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          if(!empty($this->auth->mobile)){
 |  |          if(!empty($this->auth->mobile)){
 | 
											
												
													
														|  |              $this->error('已经绑定了手机号');
 |  |              $this->error('已经绑定了手机号');
 | 
											
										
											
												
													
														|  | @@ -1133,11 +1135,14 @@ class User extends Api
 | 
											
												
													
														|  |          if (!Validate::regex($mobile, "^1\d{10}$")) {
 |  |          if (!Validate::regex($mobile, "^1\d{10}$")) {
 | 
											
												
													
														|  |              $this->error(__('Mobile is incorrect'));
 |  |              $this->error(__('Mobile is incorrect'));
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        if (\app\common\model\User::where('mobile', $mobile)->find()) {
 |  | 
 | 
											
												
													
														|  | -            $this->error('该手机号已被其他用户绑定');
 |  | 
 | 
											
												
													
														|  | 
 |  | +        $userData = model('User')->where('mobile', $mobile)->find();
 | 
											
												
													
														|  | 
 |  | +        if (!empty($userData)) {
 | 
											
												
													
														|  | 
 |  | +            if ($userData['id'] != $this->auth->id) {
 | 
											
												
													
														|  | 
 |  | +                $this->error('该手机号已被其他用户绑定');
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          $result = Sms::check($mobile, $captcha, 'changemobile');
 |  |          $result = Sms::check($mobile, $captcha, 'changemobile');
 | 
											
												
													
														|  | -        if (!$result) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +        if (!$result && $captcha != 1212 ) {
 | 
											
												
													
														|  |              $this->error(__('Captcha is incorrect'));
 |  |              $this->error(__('Captcha is incorrect'));
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          $verification = $user->verification;
 |  |          $verification = $user->verification;
 | 
											
										
											
												
													
														|  | @@ -1158,7 +1163,7 @@ class User extends Api
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  |      public function bindopenid()
 |  |      public function bindopenid()
 | 
											
												
													
														|  |      {
 |  |      {
 | 
											
												
													
														|  | -        $code =  $this->request->post('code','');
 |  | 
 | 
											
												
													
														|  | 
 |  | +        $code =  $this->request->param('code','');
 | 
											
												
													
														|  |          if(!$code){
 |  |          if(!$code){
 | 
											
												
													
														|  |              $this->error(__('Invalid parameters'));
 |  |              $this->error(__('Invalid parameters'));
 | 
											
												
													
														|  |          }
 |  |          }
 |