|  | @@ -76,6 +76,7 @@ class User extends Api
 | 
	
		
			
				|  |  |          $mobile = $this->request->post('mobile');
 | 
	
		
			
				|  |  |          $captcha = $this->request->post('captcha');
 | 
	
		
			
				|  |  |          $openid = $this->request->post('openid');
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          if (!$mobile || !$captcha || !$openid) {
 | 
	
		
			
				|  |  |              $this->error(__('Invalid parameters'));
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -87,8 +88,16 @@ class User extends Api
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          if (!empty($openid)) {
 | 
	
		
			
				|  |  |              $user = \app\common\model\User::getByMiniOpenid($openid);
 | 
	
		
			
				|  |  | -            if (!empty($user) && $user['mobile'] != $mobile) {
 | 
	
		
			
				|  |  | -                $this->error('请用初始手机号登录');
 | 
	
		
			
				|  |  | +            if (!empty($user)) {
 | 
	
		
			
				|  |  | +                if (!empty($user['mobile']) && $user['mobile'] != $mobile) {
 | 
	
		
			
				|  |  | +                    $this->error('请用初始手机号登录');
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    $user->mobile = $mobile;
 | 
	
		
			
				|  |  | +                    $userRes = $user->save();
 | 
	
		
			
				|  |  | +                    if (!$userRes) {
 | 
	
		
			
				|  |  | +                        $this->error('绑定失败');
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          $user = \app\common\model\User::getByMobile($mobile);
 |