|
@@ -388,18 +388,14 @@ class User extends Api
|
|
|
}
|
|
|
|
|
|
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('您已经填写过邀请人');
|
|
|
- }*/
|
|
|
+ $intro_user = Db::name('user')->where('introcode',$data['introcode'])->field('id,intro_uid')->find();
|
|
|
+
|
|
|
|
|
|
- if($intro_user && empty($this->auth->intro_uid)){
|
|
|
+ if(!empty($intro_user) && empty($this->auth->intro_uid)
|
|
|
+ && $intro_user['id'] != $this->auth->id && $intro_user['intro_uid'] != $this->auth->id){
|
|
|
|
|
|
unset($data['introcode']);//别人的邀请码,不能改了自己的
|
|
|
- $data['intro_uid'] = $intro_user;
|
|
|
+ $data['intro_uid'] = $intro_user['id'];
|
|
|
|
|
|
//邀请用户注册,给邀请人奖励
|
|
|
if(isset($data['intro_uid']) && !empty($data['intro_uid'])){
|