|
@@ -90,6 +90,32 @@ class User extends Api
|
|
|
$this->success();
|
|
|
}
|
|
|
|
|
|
+ //绑定邀请人
|
|
|
+ public function bindintro(){
|
|
|
+ $introcode = input('introcode','');
|
|
|
+
|
|
|
+ $data = [];
|
|
|
+
|
|
|
+ if(!empty($introcode)){
|
|
|
+ $intro_user = Db::name('user')->where('username',$introcode)->field('id,intro_uid,group_id')->find();
|
|
|
+
|
|
|
+ //邀请人不为空 && 我没有上级 && 邀请人是推广组 && 邀请人不能是我 && 邀请人的上级不能是我
|
|
|
+ if(!empty($intro_user) && empty($this->auth->intro_uid) && $intro_user['group_id'] == 2
|
|
|
+ && $intro_user['id'] != $this->auth->id && $intro_user['intro_uid'] != $this->auth->id){
|
|
|
+
|
|
|
+ $data['intro_uid'] = $intro_user['id'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(empty($data)){
|
|
|
+ $this->success();
|
|
|
+ }
|
|
|
+
|
|
|
+ $update_rs = Db::name('user')->where('id',$this->auth->id)->update($data);
|
|
|
+
|
|
|
+ $this->success();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
/**
|