|  | @@ -714,7 +714,7 @@ class User extends Api
 | 
											
												
													
														|  |      //微信登录
 |  |      //微信登录
 | 
											
												
													
														|  |      public function wechatlogin(){
 |  |      public function wechatlogin(){
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -        $code = input_post('code','');
 |  | 
 | 
											
												
													
														|  | 
 |  | +        $code = $this->request->param('code','');
 | 
											
												
													
														|  |          if(!$code){
 |  |          if(!$code){
 | 
											
												
													
														|  |              $this->error(__('Invalid parameters'));
 |  |              $this->error(__('Invalid parameters'));
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
										
											
												
													
														|  | @@ -729,10 +729,7 @@ class User extends Api
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          $user = Db::name('user')->where('openid',$openid)->find();
 |  |          $user = Db::name('user')->where('openid',$openid)->find();
 | 
											
												
													
														|  |          if ($user) {
 |  |          if ($user) {
 | 
											
												
													
														|  | -            if ($user['status'] == 2) {
 |  | 
 | 
											
												
													
														|  | -                $this->error(__('Account is log off'));
 |  | 
 | 
											
												
													
														|  | -            }
 |  | 
 | 
											
												
													
														|  | -            if ($user['status'] != 1) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +            if ($user['status'] != 'normal') {
 | 
											
												
													
														|  |                  $this->error(__('Account is locked'));
 |  |                  $this->error(__('Account is locked'));
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |              //如果已经有账号则直接登录
 |  |              //如果已经有账号则直接登录
 | 
											
										
											
												
													
														|  | @@ -1122,7 +1119,8 @@ class User extends Api
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  |      public function bindmobile()
 |  |      public function bindmobile()
 | 
											
												
													
														|  |      {
 |  |      {
 | 
											
												
													
														|  | -        $user = $this->auth->getUser();
 |  | 
 | 
											
												
													
														|  | 
 |  | +        //$user = $this->auth->getUser();
 | 
											
												
													
														|  | 
 |  | +        $user = model('User')->find($this->auth->id);
 | 
											
												
													
														|  |          $mobile = $this->request->post('mobile');
 |  |          $mobile = $this->request->post('mobile');
 | 
											
												
													
														|  |          $captcha = $this->request->post('captcha');
 |  |          $captcha = $this->request->post('captcha');
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -1160,18 +1158,19 @@ class User extends Api
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  |      public function bindopenid()
 |  |      public function bindopenid()
 | 
											
												
													
														|  |      {
 |  |      {
 | 
											
												
													
														|  | -        $code = input_post('code','');
 |  | 
 | 
											
												
													
														|  | 
 |  | +        $code =  $this->request->post('code','');
 | 
											
												
													
														|  |          if(!$code){
 |  |          if(!$code){
 | 
											
												
													
														|  |              $this->error(__('Invalid parameters'));
 |  |              $this->error(__('Invalid parameters'));
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          //微信
 |  |          //微信
 | 
											
												
													
														|  |          $wechat = new Wechat();
 |  |          $wechat = new Wechat();
 | 
											
												
													
														|  |          $openid = $wechat->getOpenid($code);
 |  |          $openid = $wechat->getOpenid($code);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          if(!$openid){
 |  |          if(!$openid){
 | 
											
												
													
														|  |              $this->error('openid获取失败');
 |  |              $this->error('openid获取失败');
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -        $user = $this->auth->getUser();
 |  | 
 | 
											
												
													
														|  | 
 |  | +        $user = model('User')->find($this->auth->id);
 | 
											
												
													
														|  |          if(!empty($this->auth->openid)){
 |  |          if(!empty($this->auth->openid)){
 | 
											
												
													
														|  |              $this->error('已经绑定了微信号');
 |  |              $this->error('已经绑定了微信号');
 | 
											
												
													
														|  |          }
 |  |          }
 |