优化推广员统计

master
chenzhi 4 years ago
parent 1f694ef47b
commit 7f9bb248dd

@ -677,8 +677,9 @@ class PlatformController extends ThinkController
$today = total(1);
$week = total(2);
$mounth = total(3);
$isOffice = true;
if (isset($_REQUEST['promote_id']) || isset($_REQUEST['company_id'])) {
$isOffice = false;
$pwhere = "1";
if(isset($_REQUEST['promote_id'])){
$pwhere .= " and (chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']})";
@ -690,12 +691,18 @@ class PlatformController extends ThinkController
if ($promoter_ids) {
$map['u.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))];
}else{
$map['u.promote_id'] = -999;
}
}
$promoteTableMap = '';
$promoteTableMap = 'tab_promote promote ON u.promote_id = promote.id';
if (isset($_REQUEST['company_belong'])){
$isOffice = false;
$promoteTableMap .= " and promote.company_belong = {$_REQUEST['company_belong']}";
}
if($isOffice){
$promoteTableMap = "left join ".$promoteTableMap;
}
// 如果是市场专员那么只能看自己的会长信息
@ -715,7 +722,7 @@ class PlatformController extends ThinkController
IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',
u.promote_id,
substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) id")
->join("tab_promote promote ON u.promote_id = promote.id {$promoteTableMap}")
->join($promoteTableMap)
->join($play_map ? "left join tab_user_play as up on up.user_id = u.id " . $play_map : false)
->join($play_info_map ? "left join tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
->join('tab_game on u.fgame_id = tab_game.id',"left")
@ -746,7 +753,7 @@ class PlatformController extends ThinkController
IFNULL(tab_game.relation_game_id,0) relation_game_id,
IFNULL(tab_game.relation_game_name,'其他渠道') relation_game_name,
IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',u.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) id")
->join("tab_promote promote ON u.promote_id = promote.id {$promoteTableMap}")
->join($promoteTableMap)
->join($play_map ? "tab_user_play as up on up.user_id = u.id " . $play_map : false)
->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
->join('tab_game on u.fgame_id = tab_game.id')
@ -813,7 +820,12 @@ class PlatformController extends ThinkController
$this->checkListOrCountAuthRestMap($map,[]);
$data = my_sort($data, $data_order_type, (int)$data_order);
$size = $row;//每页显示的记录数
if(isset($_REQUEST["export"])){
$size = 999999;
}else{
$size = $row;//每页显示的记录数
}
$pnum = ceil(count($data) / $size); //总页数ceil()函数用于求大于数字的最小整数
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
$data = array_slice($data, ($arraypage - 1) * $size, $size);
@ -833,6 +845,19 @@ class PlatformController extends ThinkController
$item['promote_account'] = $companys[$item['id']]['promote_account'];
}
}
if(isset($_REQUEST["export"])){
data2csv($data,'推广员注册统计',array(
'company_name' => '公司',
"promote_account"=>"推广员账号",
'admin_username' => '市场专员',
'relation_game_name' => '游戏',
"count"=>"累计注册",
"rand"=>"排行榜",
"today"=>"今日注册",
"week"=>"本周注册",
"mounth"=>"本月注册",
));
}
$this->meta_title = '渠道注册统计列表';
$this->assign("is_admin",is_administrator());
$this->assign('list_data', $data);
@ -1025,7 +1050,7 @@ class PlatformController extends ThinkController
$authorityData['week'] = $tauthorityData['week'];
$authorityData['mounth'] = $tauthorityData['mounth'];
}
$authorityData['promote_account'] = "江息网络";
$authorityData['promote_account'] = C('OFFICIEL_CHANNEL');
$authorityData['id'] = "0";
if (isset($_REQUEST['promote_id'])||$authorityData['count']==0) {
$authorityData = [];

@ -28,6 +28,9 @@
th{
border-right: 1px solid #b6cad2;
}
.gotoinfo{
color: #056dae;cursor:pointer;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
@ -37,7 +40,7 @@
<a class="" href="{:U('Platform/promotepay_statistics')}">推广员充值统计</a>
</div>
<h3 class="page_title">推广员汇总</h3>
<p class="description_text">说明:统计各工会每月注册及充值总额(注册数:以玩家最后归属的公会为准)</p>
<p class="description_text">说明:统计各工会每月注册及充值总额(注册数:以玩家最后归属的公会为准,非去重</p>
</div>
<div class="cf top_nav_list">
@ -119,8 +122,8 @@
<td>{$data['company_belong']}</td>
<foreach name="data.list" item="item" key="date">
<foreach name="item" item="it">
<td data-id="{$data.id}" data-date="{$date}" >{$it}</td>
<foreach name="item" item="it" key="type">
<td <if condition="$it GT 0">class="gotoinfo"</if> data-id="{$data.id}" data-type="{$type}" data-date="{$date}" style="">{$it}</td>
</foreach>
</foreach>
@ -128,14 +131,6 @@
</tr>
</volist>
</empty>
<!-- <tr class="data_summary">
<td colspan="4"><span>汇总</span></td>
<td ><span>{$total.sum_count}</span></td>
<td>---</td>
<td>{$total.sum_today}</td>
<td>{$total.sum_week}</td>
<td>{$total.sum_mounth}</td>
</tr> -->
</tbody>
</table>
</div>
@ -149,11 +144,6 @@
<block name="script">
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js" ></script>
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
@ -162,15 +152,14 @@
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('Platform/promote_statistics')}');
highlight_subnav("{:U('Platform/promote_statistics')}");
var registerUrl = "{:U('Platform/promote_statistics')}";
var payamountrUrl = "{:U('Platform/promotepay_statistics')}";
$(function(){
//搜索功能
$("#search").click(function(){
var starttime = $.trim($('#time-start').val());
var endtime = $.trim($('#time-end').val());
if (starttime && endtime && starttime > endtime) {layer.msg('开始时间必须小于等于结束时间');return false;}
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
@ -190,98 +179,19 @@
$("#search").click();
}
});
// $(".ljzc").click(function(){
// var id = $(this).attr('data-value');
// var game_name = "{:I('game_name')}";
// var server_name = "{:I('server_id')}";
// var urlr = window.location.host;
// layer.open({
// type: 2,
// title: '注册记录',
// shadeClose: true,
// shade: 0.8,
// area: ['70%', '80%'],
// content: '/admin.php?s=/Platform/zhuce_detail/promote_id/'+id+'/game_name/'+game_name+'/server_name/'+server_name+''//iframe的url
// });
// });
$(".paixu").click(function(){
var that=$(this);
$data_order=that.attr('data-order');
$order_type='{$userarpu_order}';
if($order_type==''||$order_type=='4'){
$(".sortBy").attr('name','data_order');
val='3,'+$data_order;
$(".sortBy").attr('value',val);
$("#search").click();
}else if($order_type=='3'){
$(".sortBy").attr('name','data_order');
val='4,'+$data_order;
$(".sortBy").attr('value',val);
$("#search").click();
}
});
//点击排序
$('.list_sort').click(function(){
var url = $(this).attr('url');
var ids = $('.ids:checked');
var param = '';
if(ids.length > 0){
var str = new Array();
ids.each(function(){
str.push($(this).val());
});
param = str.join(',');
}
if(url != undefined && url != ''){
window.location.href = url.replace(".html","") + '/ids/' + param;
$(".gotoinfo").on("click",function(){
var data = $(this).data();
var date = data.date.split('-');
var timestart =data.date+'-' + new Date(date[0],date[1],1).getDate();
var timeend = data.date+'-' +new Date(date[0],date[1],0).getDate();
var str = "&timestart="+timestart+"&timeend="+timeend+"&company_id="+data.id;
if(data.type == "register"){
window.location.href = registerUrl+str;
}else{
window.location.href = payamountrUrl+str;
}
});
// var date="{$setdate}";
$('#time-start').datetimepicker({
format: 'yyyy-mm-dd',
language:"zh-CN",
minView:2,
autoclose:true,
// endDate:date
});
$('#datetimepicker').datetimepicker({
format: 'yyyy-mm-dd',
language:"zh-CN",
minView:2,
autoclose:true,
pickerPosition:'bottom-left',
// endDate:date
})
var game_server = "{:I('server_id')}";
$("#game_type").change(function(){
console.log({sdk_version:$("#game_type option:selected").val(), game_name:$("#game_name option:selected").val()})
$.ajax({
url:"{:U('Ajax/getGmeServer')}",
type:"post",
data:{sdk_version:$("#game_type option:selected").val(), game_name:$("#game_name option:selected").val()},
dataType:'json',
success:function(data){
console.log(data)
str = "<option value=''>请选择区服</option>";
for (var i in data){
str += "<option value='"+data[i].server_id+"' "+(game_server && data[i].server_id == game_server?'selected':'')+">"+data[i].server_name+"</option>"
}
$("#server_id").empty();
$("#server_id").append(str);
$("#server_id").select2();
}
})
});
$("#game_name").change(function(){
$("#game_type").change();
});
$("#game_name").change();
})
</script>
</block>

@ -209,9 +209,7 @@
</div>
<div class="page">
<if condition="$role_export_check eq true ">
<a class="sch-btn" href="{:U('Export/promote_statistics',
array('timestart'=>$_GET['timestart'],'timeend'=>$_GET['timeend'],'admin_id'=>$_GET['admin_id'],'promote_id'=>$_GET['promote_id'],p=>$_GET['p'],'game_name'=>$_GET['game_name'], 'game_type'=>$_GET['game_type'],'server_id'=>$_GET['server_id'],'xlsname'=>'统计_推广员统计_推广员注册统计',)
,false)}">导出</a>
<a class="sch-btn" href="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}" target="_blank">导出</a>
</if>
{$_page|default=''}
</div>

Loading…
Cancel
Save