diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 7b3ecd2b8..0d78d3e5c 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -1224,6 +1224,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); @@ -1231,7 +1235,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 {