|
|
|
@ -47,44 +47,47 @@ class QueryController extends BaseController
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$map1['chain'] = ['like', '%' . PID . '/' . '%'];
|
|
|
|
|
$rs = M('promote', 'tab_')->where($map1)->field('id,account,nickname')->select();
|
|
|
|
|
$map1['chain'] = ['like','%'.PID.'/'.'%'];
|
|
|
|
|
$rs = M('promote','tab_')->where($map1)->field('id,account,nickname')->select();
|
|
|
|
|
$childPromoteIds = '';
|
|
|
|
|
if (empty($rs)) {
|
|
|
|
|
if(empty($rs)) {
|
|
|
|
|
$map['tab_spend.promote_id'] = PID;
|
|
|
|
|
} else {
|
|
|
|
|
foreach ($rs as $rsKey => $rsValue) {
|
|
|
|
|
}else {
|
|
|
|
|
foreach ($rs as $rsKey => $rsValue) {
|
|
|
|
|
$id = $rsValue['id'];
|
|
|
|
|
$childPromoteIds .= $id . ',';
|
|
|
|
|
$childPromoteIds .= $id.',';
|
|
|
|
|
}
|
|
|
|
|
$childPromoteIds = rtrim($childPromoteIds, ',');
|
|
|
|
|
$childPromoteIds .= ',' . PID;
|
|
|
|
|
$map['tab_spend.promote_id'] = ['in', $childPromoteIds];
|
|
|
|
|
$childPromoteIds = rtrim($childPromoteIds, ',');
|
|
|
|
|
$childPromoteIds .= ',' . PID;
|
|
|
|
|
$map['tab_spend.promote_id'] = ['in', $childPromoteIds];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$levelPromote = I('level_promote', []);
|
|
|
|
|
$promote = $this->getLoginPromote();
|
|
|
|
|
$levelPromote = $this->getLevelPromote();
|
|
|
|
|
$queryPromote = $this->getQueryPromote($levelPromote);
|
|
|
|
|
$map2['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%'];
|
|
|
|
|
$map2[] = [
|
|
|
|
|
'_logic' => 'or',
|
|
|
|
|
'id' => $queryPromote['id'],
|
|
|
|
|
'chain' => ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']
|
|
|
|
|
];
|
|
|
|
|
$ids = M('promote', 'tab_')->where($map2)->getField('id', true);
|
|
|
|
|
if (empty($ids)) {
|
|
|
|
|
$ids = array();
|
|
|
|
|
if(empty($ids)) {
|
|
|
|
|
$ids = array();
|
|
|
|
|
}
|
|
|
|
|
if (empty($levelPromote)) {
|
|
|
|
|
array_push($ids, PID);
|
|
|
|
|
if(empty($levelPromote)) {
|
|
|
|
|
array_push($ids,PID);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
array_push($ids, $queryPromote['id']);
|
|
|
|
|
array_push($ids,$queryPromote['id']);
|
|
|
|
|
if (!empty($ids)) {
|
|
|
|
|
$map['tab_spend.promote_id'] = ['in', $ids];
|
|
|
|
|
$map['tab_spend.promote_id'] = ['in',$ids];
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
}else {
|
|
|
|
|
$map['_string'] = '1<>1';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty(I('own_id'))) {
|
|
|
|
|
$map['tab_spend.promote_id'] = $promote['id'];//本账号
|
|
|
|
|
$map['tab_spend.promote_id'] = $queryPromote['id'];//本账号
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty(I('begtime')) && empty(I('endtime'))) {
|
|
|
|
@ -157,6 +160,9 @@ class QueryController extends BaseController
|
|
|
|
|
empty(I('own_id')) || $parameter['own_id'] = I('own_id');
|
|
|
|
|
empty(I('begtime')) || $parameter['begtime'] = I('begtime');
|
|
|
|
|
empty(I('endtime')) || $parameter['endtime'] = I('endtime');
|
|
|
|
|
empty(I('level_promote_2')) || $parameter['level_promote_2'] = I('level_promote_2');
|
|
|
|
|
empty(I('level_promote_3')) || $parameter['level_promote_3'] = I('level_promote_3');
|
|
|
|
|
empty(I('level_promote_4')) || $parameter['level_promote_4'] = I('level_promote_4');
|
|
|
|
|
!isset($_REQUEST['pay_way']) || $parameter['pay_way'] = I('pay_way');
|
|
|
|
|
|
|
|
|
|
$serverData = $this->getServer(I('relation_game_id'), I('sdk_version'));
|
|
|
|
@ -193,6 +199,7 @@ class QueryController extends BaseController
|
|
|
|
|
$row = 10;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//$childPromoteIds = getAllChildPromoteList(3);
|
|
|
|
|
// if (empty($childPromoteIds)) {
|
|
|
|
|
// $map['tab_user.promote_id'] = PID;
|
|
|
|
@ -201,44 +208,48 @@ class QueryController extends BaseController
|
|
|
|
|
//
|
|
|
|
|
// $map['tab_user.promote_id'] = ['in', $childPromoteIds];
|
|
|
|
|
// }
|
|
|
|
|
// $map['tab_user.promote_id'] = ['like','%'.PID.'/'.'%'];
|
|
|
|
|
$map1['chain'] = ['like', '%' . PID . '/' . '%'];
|
|
|
|
|
$rs = M('promote', 'tab_')->where($map1)->field('id,account,nickname')->select();
|
|
|
|
|
// $map['tab_user.promote_id'] = ['like','%'.PID.'/'.'%'];
|
|
|
|
|
$map1['chain'] = ['like','%'.PID.'/'.'%'];
|
|
|
|
|
$rs = M('promote','tab_')->where($map1)->field('id,account,nickname')->select();
|
|
|
|
|
$childPromoteIds = '';
|
|
|
|
|
if (empty($rs)) {
|
|
|
|
|
if(empty($rs)) {
|
|
|
|
|
$map['tab_user.promote_id'] = PID;
|
|
|
|
|
} else {
|
|
|
|
|
foreach ($rs as $rsKey => $rsValue) {
|
|
|
|
|
}else {
|
|
|
|
|
foreach ($rs as $rsKey => $rsValue) {
|
|
|
|
|
$id = $rsValue['id'];
|
|
|
|
|
$childPromoteIds .= $id . ',';
|
|
|
|
|
$childPromoteIds .= $id.',';
|
|
|
|
|
}
|
|
|
|
|
$childPromoteIds = rtrim($childPromoteIds, ',');
|
|
|
|
|
$childPromoteIds .= ',' . PID;
|
|
|
|
|
$map['tab_user.promote_id'] = ['in', $childPromoteIds];
|
|
|
|
|
$childPromoteIds = rtrim($childPromoteIds, ',');
|
|
|
|
|
$childPromoteIds .= ',' . PID;
|
|
|
|
|
$map['tab_user.promote_id'] = ['in', $childPromoteIds];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$levelPromote = I('level_promote', []);
|
|
|
|
|
$promote = $this->getLoginPromote();
|
|
|
|
|
$levelPromote = $this->getLevelPromote();
|
|
|
|
|
$queryPromote = $this->getQueryPromote($levelPromote);
|
|
|
|
|
$map2['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%'];
|
|
|
|
|
$map2[] = [
|
|
|
|
|
'_logic' => 'or',
|
|
|
|
|
'id' => $queryPromote['id'],
|
|
|
|
|
'chain' => ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']
|
|
|
|
|
];
|
|
|
|
|
$ids = M('promote', 'tab_')->where($map2)->getField('id', true);
|
|
|
|
|
if (empty($ids)) {
|
|
|
|
|
$ids = array();
|
|
|
|
|
if(empty($ids)) {
|
|
|
|
|
$ids = array();
|
|
|
|
|
}
|
|
|
|
|
if (empty($levelPromote)) {
|
|
|
|
|
array_push($ids, PID);
|
|
|
|
|
if(empty($levelPromote)) {
|
|
|
|
|
array_push($ids,PID);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
array_push($ids, $queryPromote['id']);
|
|
|
|
|
array_push($ids,$queryPromote['id']);
|
|
|
|
|
if (!empty($ids)) {
|
|
|
|
|
$map['tab_user.promote_id'] = ['in', $ids];
|
|
|
|
|
$map['tab_user.promote_id'] = ['in',$ids];
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
}else {
|
|
|
|
|
$map['_string'] = '1<>1';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty(I('own_id'))) {
|
|
|
|
|
$map['tab_user.promote_id'] = $promote['id'];//本账号
|
|
|
|
|
$map['tab_user.promote_id'] = $queryPromote['id'];//本账号
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty(I('begtime')) && empty(I('endtime'))) {
|
|
|
|
@ -288,7 +299,9 @@ class QueryController extends BaseController
|
|
|
|
|
empty(I('account')) || $parameter['account'] = I('account');
|
|
|
|
|
empty(I('begtime')) || $parameter['begtime'] = I('begtime');
|
|
|
|
|
empty(I('endtime')) || $parameter['endtime'] = I('endtime');
|
|
|
|
|
|
|
|
|
|
empty(I('level_promote_2')) || $parameter['level_promote_2'] = I('level_promote_2');
|
|
|
|
|
empty(I('level_promote_3')) || $parameter['level_promote_3'] = I('level_promote_3');
|
|
|
|
|
empty(I('level_promote_4')) || $parameter['level_promote_4'] = I('level_promote_4');
|
|
|
|
|
$thisParentPromoteId = getParentPromoteId(PID);//本账号上级渠道ID
|
|
|
|
|
$page = set_pagination($count, $row, $parameter);
|
|
|
|
|
if ($page) {
|
|
|
|
|