每日概况、数据汇总、订单查询、注册明细 组长检索bug修复

master
chenxiaojun 5 years ago
commit 837d168f2d

@ -831,24 +831,24 @@ function isParentPromote($parentId, $promoteId)
}
//获取所有该类型的渠道 $promoteId-渠道ID $promoteType-1:本账号 2:组长 3:推广员
function getAllPromoteListByType($promoteType = 1, $retOne = false)
function getAllPromoteListByType($promoteType = 1, $retOne = false, $promoteId = PID)
{
$childPromoteData = array();
switch ($promoteType) {
case 1:
$map['id'] = PID;
$map['id'] = $promoteId;
break;
case 2:
case 3:
$promoteData = D('Promote')->where(array('id' => PID))->find();
$promoteData = D('Promote')->where(array('id' => $promoteId))->find();
if ($promoteData['grand_id'] > 0) {
return [];
} elseif ($promoteData['parent_id'] > 0) {
$promoteType--;
}
$childPromoteIds = getAllPromoteIdsByType((string)PID, $promoteType);
$childPromoteIds = getAllPromoteIdsByType((string)$promoteId, $promoteType);
break;
}
@ -901,10 +901,10 @@ function getAllPromoteIdsByType($promoteIds, $level = 3, $nowLevel = 1)
}
//获取所有子渠道列表 $type 1-返回数组 2-返回id数组 3-返回id字符串
function getAllChildPromoteList($type = 1)
function getAllChildPromoteList($type = 1, $promoteId = PID)
{
$childPromoteData = array();
$childPromoteIds = getAllChildPromoteIds((string)PID);
$childPromoteIds = getAllChildPromoteIds((string)$promoteId);
if (!empty($childPromoteIds)) {
$map['id'] = ['in', $childPromoteIds];

@ -44,14 +44,21 @@ class QueryController extends BaseController
$map['tab_spend.promote_id'] = ['in', $childPromoteIds];
}
$teamLeaderId = I('team_leader_id');//组长账号
$teamLeaderId = intval(I('team_leader_id'));//组长账号
if (!empty($teamLeaderId)) {
$hasTeamLeaderPermission = hasPromotePermission(PID, $teamLeaderId);
if ($hasTeamLeaderPermission === false) {
$this->error('组长权限异常');
}
$map['tab_spend.promote_id'] = $teamLeaderId;
$childPromoteIds = getAllChildPromoteList(3, $teamLeaderId);
if (empty($childPromoteIds)) {
$map['tab_spend.promote_id'] = $teamLeaderId;
} else {
$childPromoteIds = $teamLeaderId . ',' . $childPromoteIds;
$map['tab_spend.promote_id'] = ['in', $childPromoteIds];
}
}
$promoteId = I('promote_id');//推广员账号
@ -164,6 +171,9 @@ class QueryController extends BaseController
$this->assign('pID', PID);
$this->assign('ownId', I('own_id'));
$this->assign('payWayData', QueryController::$payWay);
if (!empty(I('team_leader_id'))) {
$this->assign('teamLeaderData', getAllPromoteListByType(1, false, intval(I('team_leader_id'))));
}
$this->meta_title = "订单查询";
$this->display();
}
@ -186,14 +196,21 @@ class QueryController extends BaseController
$map['tab_user.promote_id'] = ['in', $childPromoteIds];
}
$teamLeaderId = I('team_leader_id');//组长账号
$teamLeaderId = intval(I('team_leader_id'));//组长账号
if (!empty($teamLeaderId)) {
$hasTeamLeaderPermission = hasPromotePermission(PID, $teamLeaderId);
if ($hasTeamLeaderPermission === false) {
$this->error('组长权限异常');
}
$map['tab_user.promote_id'] = $teamLeaderId;
$childPromoteIds = getAllChildPromoteList(3, $teamLeaderId);
if (empty($childPromoteIds)) {
$map['tab_user.promote_id'] = $teamLeaderId;
} else {
$childPromoteIds = $teamLeaderId . ',' . $childPromoteIds;
$map['tab_user.promote_id'] = ['in', $childPromoteIds];
}
}
$promoteId = I('promote_id');//推广员账号
@ -277,6 +294,9 @@ class QueryController extends BaseController
$this->assign('thisParentPromoteId', $thisParentPromoteId);
$this->assign('pID', PID);
$this->assign('ownId', I('own_id'));
if (!empty(I('team_leader_id'))) {
$this->assign('teamLeaderData', getAllPromoteListByType(1, false, intval(I('team_leader_id'))));
}
$this->meta_title = '注册明细';
$this->display();
}
@ -979,16 +999,25 @@ class QueryController extends BaseController
$spendWhere['tab_spend.promote_id'] = ['in', $childPromoteIds];
}
$teamLeaderId = I('team_leader_id');//组长账号
$teamLeaderId = intval(I('team_leader_id'));//组长账号
if (!empty($teamLeaderId)) {
$hasTeamLeaderPermission = hasPromotePermission(PID, $teamLeaderId);
if ($hasTeamLeaderPermission === false) {
$this->error('组长权限异常');
}
$userPlayInfoWhere['tab_user_play_info.promote_id'] = $teamLeaderId;
$userGameLoginWhere['tab_user_game_login_record.promote_id'] = $teamLeaderId;
$spendWhere['tab_spend.promote_id'] = $teamLeaderId;
$childPromoteIds = getAllChildPromoteList(3, $teamLeaderId);
if (empty($childPromoteIds)) {
$userPlayInfoWhere['tab_user_play_info.promote_id'] = $teamLeaderId;
$userGameLoginWhere['tab_user_game_login_record.promote_id'] = $teamLeaderId;
$spendWhere['tab_spend.promote_id'] = $teamLeaderId;
} else {
$childPromoteIds = $teamLeaderId . ',' . $childPromoteIds;
$userPlayInfoWhere['tab_user_play_info.promote_id'] = ['in', $childPromoteIds];
$userGameLoginWhere['tab_user_game_login_record.promote_id'] = ['in', $childPromoteIds];
$spendWhere['tab_spend.promote_id'] = ['in', $childPromoteIds];
}
}
$promoteId = I('promote_id');//推广员账号
@ -998,24 +1027,12 @@ class QueryController extends BaseController
$this->error('推广员权限异常');
}
if (!empty($userPlayInfoWhere['tab_apply.promote_id'])) {
$userPlayInfoWhere['_string'] = 'tab_user_play_info.promote_id = ' . $promoteId;
$userGameLoginWhere['_string'] = 'tab_user_game_login_record.promote_id = ' . $promoteId;
$spendWhere['_string'] = 'tab_spend.promote_id = ' . $promoteId;
} else {
$userPlayInfoWhere['tab_user_play_info.promote_id'] = $promoteId;
$userGameLoginWhere['tab_user_game_login_record.promote_id'] = $promoteId;
$spendWhere['tab_spend.promote_id'] = $promoteId;
}
$userPlayInfoWhere['tab_user_play_info.promote_id'] = $promoteId;
$userGameLoginWhere['tab_user_game_login_record.promote_id'] = $promoteId;
$spendWhere['tab_spend.promote_id'] = $promoteId;
}
if (!empty(I('own_id'))) {
if (!empty($userPlayInfoWhere['_string'])) {
unset($userPlayInfoWhere['_string']);
unset($userGameLoginWhere['_string']);
unset($spendWhere['_string']);
}
$userPlayInfoWhere['tab_user_play_info.promote_id'] = I('own_id');
$userGameLoginWhere['tab_user_game_login_record.promote_id'] = I('own_id');
$spendWhere['tab_spend.promote_id'] = I('own_id');
@ -1203,6 +1220,9 @@ class QueryController extends BaseController
$this->assign('serverData', $serverData['data']);
$this->assign('thisParentPromoteId', $thisParentPromoteId);
$this->assign('pID', PID);
if (!empty(I('team_leader_id'))) {
$this->assign('teamLeaderData', getAllPromoteListByType(1, false, intval(I('team_leader_id'))));
}
$this->display();
}
@ -1237,10 +1257,20 @@ class QueryController extends BaseController
$this->error('组长权限异常');
}
$map['tab_apply.promote_id'] = $teamLeaderId;
$userPlayInfoMap['tab_user_play_info.promote_id'] = $teamLeaderId;
$userGameLoginMap['tab_user_game_login_record.promote_id'] = $teamLeaderId;
$spendMap['tab_spend.promote_id'] = $teamLeaderId;
$childPromoteIds = getAllChildPromoteList(3, $teamLeaderId);
if (empty($childPromoteIds)) {
$map['tab_apply.promote_id'] = $teamLeaderId;
$userPlayInfoMap['tab_user_play_info.promote_id'] = $teamLeaderId;
$userGameLoginMap['tab_user_game_login_record.promote_id'] = $teamLeaderId;
$spendMap['tab_spend.promote_id'] = $teamLeaderId;
} else {
$childPromoteIds = $teamLeaderId . ',' . $childPromoteIds;
$map['tab_apply.promote_id'] = ['in', $childPromoteIds];
$userPlayInfoMap['tab_user_play_info.promote_id'] = ['in', $childPromoteIds];
$userGameLoginMap['tab_user_game_login_record.promote_id'] = ['in', $childPromoteIds];
$spendMap['tab_spend.promote_id'] = ['in', $childPromoteIds];
}
}
$promoteId = intval(I('promote_id'));//推广员账号
@ -1250,21 +1280,14 @@ class QueryController extends BaseController
$this->error('推广员权限异常');
}
$map['_string'] = 'tab_apply.promote_id = ' . $promoteId;
$userPlayInfoMap['_string'] = 'tab_user_play_info.promote_id = ' . $promoteId;
$userGameLoginMap['_string'] = 'tab_user_game_login_record.promote_id = ' . $promoteId;
$spendMap['_string'] = 'tab_spend.promote_id = ' . $promoteId;
$map['tab_apply.promote_id'] = $promoteId;
$userPlayInfoMap['tab_user_play_info.promote_id'] = $promoteId;
$userGameLoginMap['tab_user_game_login_record.promote_id'] = $promoteId;
$spendMap['tab_spend.promote_id'] = $promoteId;
}
$ownId = intval(I('own_id'));//本账号
if (!empty($ownId)) {
if (!empty($map['_string'])) {
unset($map['_string']);
unset($userPlayInfoMap['_string']);
unset($userGameLoginMap['_string']);
unset($spendMap['_string']);
}
$map['tab_apply.promote_id'] = $ownId;
$userPlayInfoMap['tab_user_play_info.promote_id'] = $ownId;
$userGameLoginMap['tab_user_game_login_record.promote_id'] = $ownId;
@ -1457,6 +1480,9 @@ class QueryController extends BaseController
$this->assign('serverData', $serverData['data']);
$this->assign('thisParentPromoteId', $thisParentPromoteId);
$this->assign('pID', PID);
if (!empty(I('team_leader_id'))) {
$this->assign('teamLeaderData', getAllPromoteListByType(1, false, intval(I('team_leader_id'))));
}
$this->display();
}
@ -2146,4 +2172,21 @@ class QueryController extends BaseController
$this->assign('count', $count);
$this->display();
}
public function getChildPromoteList()
{
$promoteId = I('post.promote_id', 0);
if ($promoteId == 0) {
$data['status'] = 0;
$data['msg'] = '数据异常';
$this->ajaxReturn($data);
}
$promoteList = getAllPromoteListByType(3, false, $promoteId);
$data['status'] = 1;
$data['data'] = $promoteList;
$this->ajaxReturn($data);
}
}

@ -89,7 +89,12 @@
<div class="form-group normal_space fl">
<select id="promote_id" name="promote_id" class="reselect select_gallery" style="min-width:130px;">
<option value="0">推广员账号</option>
<volist name=":getAllPromoteListByType(3)" id="vo">
<notempty name="teamLeaderData">
<volist name="teamLeaderData" id="vo">
<option value="{$vo.id}">{$vo['account']}({$vo['real_name']})</option>
</volist>
</notempty>
<volist name=":getAllPromoteListByType(3,false,empty(I('team_leader_id'))?PID:I('team_leader_id'))" id="vo">
<option value="{$vo.id}">{$vo['account']}({$vo['real_name']})</option>
</volist>
</select>
@ -447,6 +452,36 @@
setValue('server_id', {$Think.request.server_id |default = '""'});
setValue('row', '{:I("get.row",10)}');
$('#team_leader_id').change(function () {
var promoteId = parseInt($(this).val());
var promoteValue = $(this).find("option:selected").text();
$.ajax({
url: "{:U('getChildPromoteList')}",
type: "post",
data: {promote_id:promoteId},
dataType: 'json',
success: function (data) {
var html = "<option value='' selected>推广员账号</option>";
html += "<option value='" + promoteId + "'>" + promoteValue + "</option>";
if (data.status == 1) {
var promoteData = data.data;
if (promoteData.length > 0) {
for (var i in promoteData) {
html += "<option value='" + promoteData[i]['id'] + "'>" + promoteData[i]['account'] + "(" + promoteData[i]['real_name'] + ")</option>";
}
}
}
$("#promote_id").empty();
$('#promote_id').html(html);
$("#promote_id").select2();
}
});
});
$('#own').on('click', function () {
var ownId = $('#own_id').val();
var checkBox = $(this).children('i');

@ -117,7 +117,12 @@
<div class="form-group normal_space fl">
<select id="promote_id" name="promote_id" class="reselect select_gallery" style="min-width:130px;">
<option value="0">推广员账号</option>
<volist name=":getAllPromoteListByType(3)" id="vo">
<notempty name="teamLeaderData">
<volist name="teamLeaderData" id="vo">
<option value="{$vo.id}">{$vo['account']}({$vo['real_name']})</option>
</volist>
</notempty>
<volist name=":getAllPromoteListByType(3,false,empty(I('team_leader_id'))?PID:I('team_leader_id'))" id="vo">
<option value="{$vo.id}">{$vo['account']}({$vo['real_name']})</option>
</volist>
</select>
@ -273,6 +278,36 @@
endDate: date
});
$('#team_leader_id').change(function () {
var promoteId = parseInt($(this).val());
var promoteValue = $(this).find("option:selected").text();
$.ajax({
url: "{:U('getChildPromoteList')}",
type: "post",
data: {promote_id:promoteId},
dataType: 'json',
success: function (data) {
var html = "<option value='' selected>推广员账号</option>";
html += "<option value='" + promoteId + "'>" + promoteValue + "</option>";
if (data.status == 1) {
var promoteData = data.data;
if (promoteData.length > 0) {
for (var i in promoteData) {
html += "<option value='" + promoteData[i]['id'] + "'>" + promoteData[i]['account'] + "(" + promoteData[i]['real_name'] + ")</option>";
}
}
}
$("#promote_id").empty();
$('#promote_id').html(html);
$("#promote_id").select2();
}
});
});
$('#own').on('click',function () {
var ownId = $('#own_id').val();
var checkBox = $(this).children('i');

@ -36,27 +36,32 @@
<div class="trunk-content article">
<div class="trunk-search clearfix">
<!-- <form action="{:U('Query/register',array('row'=>I('get.row')))}" method="post" enctype="multipart/form-data">-->
<if condition="$thisParentPromoteId eq 0">
<div class="form-group normal_space fl">
<select id="team_leader_id" name="team_leader_id" class="reselect select_gallery" style="min-width:130px;">
<option value="0">组长账号</option>
<volist name=":getAllPromoteListByType(2)" id="vo">
<option value="{$vo.id}">{$vo['account']}({$vo['real_name']})</option>
</volist>
</select>
</div>
</if>
<if condition="$thisParentPromoteId eq 0">
<div class="form-group normal_space fl">
<select id="team_leader_id" name="team_leader_id" class="reselect select_gallery" style="min-width:130px;">
<option value="0">组长账号</option>
<volist name=":getAllPromoteListByType(2)" id="vo">
<option value="{$vo.id}">{$vo['account']}({$vo['real_name']})</option>
</volist>
</select>
</div>
</if>
<eq name="pID|isMinPromote" value="0">
<div class="form-group normal_space fl">
<select id="promote_id" name="promote_id" class="reselect select_gallery" style="min-width:130px;">
<option value="0">推广员账号</option>
<volist name=":getAllPromoteListByType(3)" id="vo">
<eq name="pID|isMinPromote" value="0">
<div class="form-group normal_space fl">
<select id="promote_id" name="promote_id" class="reselect select_gallery" style="min-width:130px;">
<option value="0">推广员账号</option>
<notempty name="teamLeaderData">
<volist name="teamLeaderData" id="vo">
<option value="{$vo.id}">{$vo['account']}({$vo['real_name']})</option>
</volist>
</select>
</div>
</eq>
</notempty>
<volist name=":getAllPromoteListByType(3,false,empty(I('team_leader_id'))?PID:I('team_leader_id'))" id="vo">
<option value="{$vo.id}">{$vo['account']}({$vo['real_name']})</option>
</volist>
</select>
</div>
</eq>
<div class="form-group fl">
<input type="text" name="account" class="txt normal_txt" placeholder="请输入玩家账号"
@ -178,6 +183,36 @@
endDate: date
});
$('#team_leader_id').change(function () {
var promoteId = parseInt($(this).val());
var promoteValue = $(this).find("option:selected").text();
$.ajax({
url: "{:U('getChildPromoteList')}",
type: "post",
data: {promote_id:promoteId},
dataType: 'json',
success: function (data) {
var html = "<option value='' selected>推广员账号</option>";
html += "<option value='" + promoteId + "'>" + promoteValue + "</option>";
if (data.status == 1) {
var promoteData = data.data;
if (promoteData.length > 0) {
for (var i in promoteData) {
html += "<option value='" + promoteData[i]['id'] + "'>" + promoteData[i]['account'] + "(" + promoteData[i]['real_name'] + ")</option>";
}
}
}
$("#promote_id").empty();
$('#promote_id').html(html);
$("#promote_id").select2();
}
});
});
$('#own').on('click',function () {
var ownId = $('#own_id').val();
var checkBox = $(this).children('i');

@ -79,7 +79,12 @@
<div class="form-group normal_space fl">
<select id="promote_id" name="promote_id" class="reselect select_gallery" style="min-width:130px;">
<option value="0">推广员账号</option>
<volist name=":getAllPromoteListByType(3)" id="vo">
<notempty name="teamLeaderData">
<volist name="teamLeaderData" id="vo">
<option value="{$vo.id}">{$vo['account']}({$vo['real_name']})</option>
</volist>
</notempty>
<volist name=":getAllPromoteListByType(3,false,empty(I('team_leader_id'))?PID:I('team_leader_id'))" id="vo">
<option value="{$vo.id}">{$vo['account']}({$vo['real_name']})</option>
</volist>
</select>
@ -234,6 +239,36 @@
setValue('server_id', {$Think.request.server_id |default = '""'});
setValue('row', '{:I("get.row",10)}');
$('#team_leader_id').change(function () {
var promoteId = parseInt($(this).val());
var promoteValue = $(this).find("option:selected").text();
$.ajax({
url: "{:U('getChildPromoteList')}",
type: "post",
data: {promote_id:promoteId},
dataType: 'json',
success: function (data) {
var html = "<option value='' selected>推广员账号</option>";
html += "<option value='" + promoteId + "'>" + promoteValue + "</option>";
if (data.status == 1) {
var promoteData = data.data;
if (promoteData.length > 0) {
for (var i in promoteData) {
html += "<option value='" + promoteData[i]['id'] + "'>" + promoteData[i]['account'] + "(" + promoteData[i]['real_name'] + ")</option>";
}
}
}
$("#promote_id").empty();
$('#promote_id').html(html);
$("#promote_id").select2();
}
});
});
$('#own').on('click',function () {
var ownId = $('#own_id').val();
var checkBox = $(this).children('i');

Loading…
Cancel
Save