diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 4141db0c9..03b9fe207 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -1217,6 +1217,10 @@ class PromoteController extends ThinkController if (empty($id)) { $this->ajaxReturn(['code'=>0,'msg'=>'请选择推广员']); } + $promoter = M('promote', 'tab_')->where(['id'=>$id])->find(); + if (empty($promoter)) { + $this->ajaxReturn(['code'=>0,'msg'=>'未找到推广员']); + } $game_ids = I('game_ids', ''); if (!empty($game_ids)) { $game_ids = implode(',', $game_ids); @@ -1224,7 +1228,9 @@ class PromoteController extends ThinkController } else { $game_ids = 0; } - $res = M('promote', 'tab_')->where(['id'=>$id])->save(['game_ids'=>$game_ids]); + // 获取下级id + $childrens = M('promote', 'tab_')->where("chain like '{$promoter['chain']}{$promoter['id']}/%'")->select(); + $res = M('promote', 'tab_')->where(['id'=>['in', $childrens? array_merge([$id], array_column($childrens, 'id')) : [$id] ]])->save(['game_ids'=>$game_ids]); if ($res) { $this->ajaxReturn(['code'=>1,'msg'=>'更新成功']); } else {