|
|
@ -31,36 +31,14 @@ class PromoteController extends ThinkController {
|
|
|
|
$promoteid = $_REQUEST['promote_id'];
|
|
|
|
$promoteid = $_REQUEST['promote_id'];
|
|
|
|
unset($_REQUEST['promote_id']);
|
|
|
|
unset($_REQUEST['promote_id']);
|
|
|
|
if(isset($_REQUEST['parent_id'])) {
|
|
|
|
if(isset($_REQUEST['parent_id'])) {
|
|
|
|
|
|
|
|
|
|
|
|
$parent_id = $_REQUEST['parent_id'];
|
|
|
|
$parent_id = $_REQUEST['parent_id'];
|
|
|
|
unset($_REQUEST['parent_id']);
|
|
|
|
unset($_REQUEST['parent_id']);
|
|
|
|
if($promoteid == $parent_id) {
|
|
|
|
if($promoteid == $parent_id) {
|
|
|
|
$map['id'] = $promoteid;
|
|
|
|
$map['id'] = $promoteid;
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$maps['parent_id'] = $parent_id;
|
|
|
|
|
|
|
|
$maps['grand_id'] = $parent_id;
|
|
|
|
|
|
|
|
$maps['_logic'] = 'or';
|
|
|
|
|
|
|
|
$pro = M('promote','tab_')->field('id,account')->where([array('id'=>$promoteid),$maps])->select();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($pro_ids)){
|
|
|
|
|
|
|
|
$map['id'] = array('eq',-1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$map['id'] = $promoteid;
|
|
|
|
$map['id'] = $promoteid;
|
|
|
|
/* $maps['parent_id'] = $promoteid;
|
|
|
|
|
|
|
|
$maps['grand_id'] = $promoteid;
|
|
|
|
|
|
|
|
$maps['_logic'] = 'or';
|
|
|
|
|
|
|
|
$pro = M('promote','tab_')->field('id,account')->where($maps)->select();
|
|
|
|
|
|
|
|
$pro_ids = array_column($pro,'id');
|
|
|
|
|
|
|
|
$pro_ids[] = $promoteid;
|
|
|
|
|
|
|
|
if (!empty($pro_ids)){
|
|
|
|
|
|
|
|
$map['id'] = ['in',$pro_ids];
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$map['id'] = array('eq',-1);
|
|
|
|
|
|
|
|
} */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -315,32 +293,9 @@ unset($_REQUEST['parent_id']);
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$parent_id = get_promote_id($_REQUEST['parent_id']);
|
|
|
|
$parent_id = get_promote_id($_REQUEST['parent_id']);
|
|
|
|
$maps['parent_id'] = $parent_id;
|
|
|
|
|
|
|
|
$maps['grand_id'] = $parent_id;
|
|
|
|
|
|
|
|
$maps['_logic'] = 'or';
|
|
|
|
|
|
|
|
$pro = M('promote','tab_')->field('id,account')->where([array('id'=>$promoteid),$maps])->select();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($pro_ids)){
|
|
|
|
|
|
|
|
$map['tab_user.promote_id'] = array('eq',-1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
/*$maps['parent_id'] = $promoteid;
|
|
|
|
|
|
|
|
$maps['grand_id'] = $promoteid;
|
|
|
|
|
|
|
|
$maps['_logic'] = 'or';
|
|
|
|
|
|
|
|
$pro = M('promote','tab_')->field('id,account')->where($maps)->select();
|
|
|
|
|
|
|
|
$pro_ids = array_column($pro,'id');
|
|
|
|
|
|
|
|
$pro_ids[] = $promoteid;
|
|
|
|
|
|
|
|
if (!empty($pro_ids)){
|
|
|
|
|
|
|
|
$map['tab_user.promote_id'] = ['in',$pro_ids];
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$map['tab_user.promote_id'] = array('eq',-1);
|
|
|
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$map['tab_user.promote_id'] = $promoteid;
|
|
|
|
$map['tab_user.promote_id'] = $promoteid;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -348,10 +303,7 @@ unset($_REQUEST['parent_id']);
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($_REQUEST['parent_id'])){
|
|
|
|
if(isset($_REQUEST['parent_id'])){
|
|
|
|
$parent_id = get_promote_id($_REQUEST['parent_id']);
|
|
|
|
$parent_id = get_promote_id($_REQUEST['parent_id']);
|
|
|
|
$maps['parent_id'] = $parent_id;
|
|
|
|
$pro = M('promote','tab_')->field('id,account')->where("chain like '%/{$parent_id}/%'")->select();
|
|
|
|
$maps['grand_id'] = $parent_id;
|
|
|
|
|
|
|
|
$maps['_logic'] = 'or';
|
|
|
|
|
|
|
|
$pro = M('promote','tab_')->field('id,account')->where($maps)->select();
|
|
|
|
|
|
|
|
$pro_ids = array_column($pro,'id');
|
|
|
|
$pro_ids = array_column($pro,'id');
|
|
|
|
$pro_ids[] = get_promote_id($_REQUEST['parent_id']);
|
|
|
|
$pro_ids[] = get_promote_id($_REQUEST['parent_id']);
|
|
|
|
if (!empty($pro_ids)){
|
|
|
|
if (!empty($pro_ids)){
|
|
|
@ -510,10 +462,7 @@ unset($_REQUEST['parent_id']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$maps['parent_id'] = I('parent_id');
|
|
|
|
$pro = M('promote','tab_')->field('id')->where("chain like '%/{$_REQUEST['parent_id']}/%' or id={$_REQUEST['parent_id']}")->select();
|
|
|
|
$maps['grand_id'] =I('parent_id');
|
|
|
|
|
|
|
|
$maps['_logic'] = 'or';
|
|
|
|
|
|
|
|
$pro = M('promote','tab_')->field('id')->where([array('id'=>$map['promote_id']),$maps])->select();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!$pro) {
|
|
|
|
if(!$pro) {
|
|
|
|
$map['promote_id'] = array('eq',999999999);
|
|
|
|
$map['promote_id'] = array('eq',999999999);
|
|
|
@ -522,20 +471,6 @@ unset($_REQUEST['parent_id']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
/*$maps['parent_id'] = $map['promote_id'];
|
|
|
|
|
|
|
|
$maps['grand_id'] =$map['promote_id'];
|
|
|
|
|
|
|
|
$maps['_logic'] = 'or';
|
|
|
|
|
|
|
|
$pro = M('promote','tab_')->field('id')->where($maps)->select();
|
|
|
|
|
|
|
|
$pro_ids = array_column($pro,'id');
|
|
|
|
|
|
|
|
$pro_ids[] = $map['promote_id'];
|
|
|
|
|
|
|
|
if (!empty($pro_ids)){
|
|
|
|
|
|
|
|
$map['promote_id'] = ['in',$pro_ids];
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$map['promote_id'] = array('eq',999999999);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -543,10 +478,7 @@ unset($_REQUEST['parent_id']);
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
|
|
if(!empty(I('parent_id'))){
|
|
|
|
if(!empty(I('parent_id'))){
|
|
|
|
$maps['parent_id'] = I('parent_id');
|
|
|
|
$pro = M('promote','tab_')->field('id')->where("chain like '%/{$_REQUEST['parent_id']}/%'")->select();
|
|
|
|
$maps['grand_id'] =I('parent_id');
|
|
|
|
|
|
|
|
$maps['_logic'] = 'or';
|
|
|
|
|
|
|
|
$pro = M('promote','tab_')->field('id')->where($maps)->select();
|
|
|
|
|
|
|
|
$pro_ids = array_column($pro,'id');
|
|
|
|
$pro_ids = array_column($pro,'id');
|
|
|
|
$pro_ids[] = I('parent_id');
|
|
|
|
$pro_ids[] = I('parent_id');
|
|
|
|
if (!empty($pro_ids)){
|
|
|
|
if (!empty($pro_ids)){
|
|
|
@ -832,11 +764,7 @@ unset($_REQUEST['parent_id']);
|
|
|
|
public function del_promote(){
|
|
|
|
public function del_promote(){
|
|
|
|
if(IS_AJAX){
|
|
|
|
if(IS_AJAX){
|
|
|
|
M()->startTrans();
|
|
|
|
M()->startTrans();
|
|
|
|
$map['id'] = $_POST['id'];
|
|
|
|
$result = M('promote','tab_')->where("chain like '%/{$_POST['id']}/%' or id={$_POST['id']} ")->delete();
|
|
|
|
$map['parent_id'] = $_POST['id'];
|
|
|
|
|
|
|
|
$map['grand_id'] = $_POST['id'];
|
|
|
|
|
|
|
|
$map['_logic'] = 'or';
|
|
|
|
|
|
|
|
$result = M('promote','tab_')->where($map)->delete();
|
|
|
|
|
|
|
|
if($result){
|
|
|
|
if($result){
|
|
|
|
M()->commit();
|
|
|
|
M()->commit();
|
|
|
|
$this->ajaxReturn(array('status'=>1,'msg'=>'删除成功'));
|
|
|
|
$this->ajaxReturn(array('status'=>1,'msg'=>'删除成功'));
|
|
|
|