|
|
@ -1217,6 +1217,10 @@ class PromoteController extends ThinkController
|
|
|
|
if (empty($id)) {
|
|
|
|
if (empty($id)) {
|
|
|
|
$this->ajaxReturn(['code'=>0,'msg'=>'请选择推广员']);
|
|
|
|
$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', '');
|
|
|
|
$game_ids = I('game_ids', '');
|
|
|
|
if (!empty($game_ids)) {
|
|
|
|
if (!empty($game_ids)) {
|
|
|
|
$game_ids = implode(',', $game_ids);
|
|
|
|
$game_ids = implode(',', $game_ids);
|
|
|
@ -1224,7 +1228,9 @@ class PromoteController extends ThinkController
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$game_ids = 0;
|
|
|
|
$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) {
|
|
|
|
if ($res) {
|
|
|
|
$this->ajaxReturn(['code'=>1,'msg'=>'更新成功']);
|
|
|
|
$this->ajaxReturn(['code'=>1,'msg'=>'更新成功']);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|