|
@@ -59,24 +59,28 @@ class User extends Backend
|
|
|
|
|
|
//验证
|
|
|
if(empty($user_id)) $this->error("请输入需要转移的用户ID");
|
|
|
- if(empty($new_intro_uid)) $this->error("请输入新的上级用户ID");
|
|
|
-
|
|
|
- Db::startTrans();
|
|
|
+ if(empty($new_intro_uid)) $this->error("请输入新的推荐人用户ID");
|
|
|
|
|
|
$user = Db::name('user')->where('id',$user_id)->find();
|
|
|
if(empty($user)){
|
|
|
- Db::rollback();
|
|
|
$this->error('不存在的用户');
|
|
|
}
|
|
|
|
|
|
-
|
|
|
$new_intro = Db::name('user')->where('id',$new_intro_uid)->find();
|
|
|
if(empty($new_intro)){
|
|
|
- Db::rollback();
|
|
|
- $this->error('不存在的新上级用户');
|
|
|
+ $this->error('不存在的新推荐人');
|
|
|
}
|
|
|
|
|
|
+ if($user_id == $new_intro_uid){
|
|
|
+ $this->error('新邀请人不能是被转移用户');
|
|
|
+ }
|
|
|
+
|
|
|
+ $down_user_ids = $this->my_down_all($user_id,[$user_id]);
|
|
|
+ if(in_array($new_intro_uid,$down_user_ids)){
|
|
|
+ $this->error('新的邀请人不能在被转移用户下级网体内,会出现内循环');
|
|
|
+ }
|
|
|
|
|
|
+ Db::startTrans();
|
|
|
|
|
|
//我的多个下级,的推荐人,改成新人
|
|
|
$my_down = Db::name('user')->where('intro_uid',$user['id'])->select();
|