|  | @@ -375,13 +375,30 @@ class User extends Api
 | 
	
		
			
				|  |  |          if(isset($data['tag_ids'])){
 | 
	
		
			
				|  |  |              $data['tag_ids'] = implode(',',explode(',',$data['tag_ids']));
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        if(isset($data['introcode'])){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if(isset($data['introcode']) && !empty($data['introcode'])){
 | 
	
		
			
				|  |  |              $intro_user = Db::name('user')->where('introcode',$data['introcode'])->value('id');
 | 
	
		
			
				|  |  |              if(!$intro_user){
 | 
	
		
			
				|  |  |                  $this->error('不存在的邀请人');
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            if(!empty($this->auth->intro_uid)){
 | 
	
		
			
				|  |  | +                $this->error('您已经填写过邀请人');
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |              unset($data['introcode']);//别人的邀请码,不能改了自己的
 | 
	
		
			
				|  |  |              $data['intro_uid'] = $intro_user;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            //邀请用户注册,给邀请人奖励
 | 
	
		
			
				|  |  | +            if(isset($data['intro_uid']) && !empty($data['intro_uid'])){
 | 
	
		
			
				|  |  | +                $intro_gold = config('site.intro_newuser_gift_goldnum') ?: 0;
 | 
	
		
			
				|  |  | +                if($intro_gold > 0){
 | 
	
		
			
				|  |  | +                    $wallet_rs = model('wallet')->lockChangeAccountRemain($data['intro_uid'],'gold',$intro_gold,63,'邀请'.$this->auth->username);
 | 
	
		
			
				|  |  | +                    if($wallet_rs['status'] === false){
 | 
	
		
			
				|  |  | +                        Db::rollback();
 | 
	
		
			
				|  |  | +                        $this->setError($wallet_rs['msg']);
 | 
	
		
			
				|  |  | +                        return false;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          //dump($data);
 | 
	
		
			
				|  |  |          if(empty($data)){
 |