Merge branch 'feature/apply_game' of wmtx/platform into release

task440
master
廖金灵 4 years ago committed by Gogs
commit bc00b1112f

@ -1224,6 +1224,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);
@ -1231,7 +1235,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 {

Loading…
Cancel
Save