公会统计2

master
chenzhi 5 years ago
parent ff04347526
commit 33bf8c1ea7

@ -5,27 +5,157 @@ class FinancePromoteController extends AdminController
public function _initialize(Type $var = null)
{
parent::_initialize();
echo "<pre>";
// echo "<pre>";
}
public function index()
{
if ($_REQUEST['data_order'] != '') {
$data_order = reset(explode(',', $_REQUEST['data_order']));
$data_order_type = end(explode(',', $_REQUEST['data_order']));
$this->assign('userarpu_order', $data_order);
$this->assign('userarpu_order_type', $data_order_type);
}
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
$pmap['create_time'] = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]];
} elseif (isset($_REQUEST['time_start'])) {
$pmap['create_time'] = ['GT', strtotime($_REQUEST['time_start'])];
} elseif (isset($_REQUEST['time_end'])) {
$pmap['create_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
}
$senddata = [];
//获取各会长的现金充值
$map = ["spend.pay_status"=>1];
$map['pay_way'] = array("GT",0);
$cash = self::getJoinPromoteData(array("pay_way"=>array("GT",0)));
foreach($cash as $k=>$v){
$v['cash_count'] = $v['pay_amount'];
unset($v['pay_amount']);
$senddata[$v['p_id']] = $v;
}
//平台币直充支出
$balance = self::getJoinPromoteData(array("pay_way"=>array("EQ",0)));
foreach($balance as $k=>$v){
if(array_key_exists($v['p_id'],$senddata)){
$senddata[$v['p_id']]['balance_coin_count']= $v['pay_amount'];
}else{
$v['balance_coin_count'] = $v['pay_amount'];
unset($v['pay_amount']);
$senddata[$v['p_id']] = $v;
};
}
//平台币内充
$bind = self::getJoinPromoteData(array("pay_way"=>array("LT",0)));
foreach($bind as $k=>$v){
if(array_key_exists($v['p_id'],$senddata)){
$senddata[$v['p_id']]['bind_coin_count']= $v['pay_amount'];
}else{
$v['bind_coin_count'] = $v['pay_amount'];
unset($v['pay_amount']);
$senddata[$v['p_id']] = $v;
};
}
//内冲
$inside = self::getJoinPromoteData([],"promote_coin");
foreach($inside as $k=>$v){
if(array_key_exists($v['p_id'],$senddata)){
$senddata[$v['p_id']]['inside_cash_count']= $v['pay_amount'];
}else{
$v['inside_cash_count'] = $v['pay_amount'];
unset($v['pay_amount']);
$senddata[$v['p_id']] = $v;
};
}
if(array_key_exists(0,$senddata) || $_REQUEST['promote_id']==0){
$pmap['status']=1;
$admininside = M("provide_user p","tab_")->field("sum(amount) amount")->where($pmap)->find();
if($admininside['amount'] >0){
$senddata[0]['inside_cash_count']= $admininside['amount'];
}
}
$data = [];
$count =array(
"cash_count"=>0,
"balance_coin_count"=>0,
"bind_coin_count"=>0,
"inside_cash_count"=>0,
);
foreach($senddata as $k=>$v){
$field = "spend.promote_id,spend.promote_account,sum(pay_amount) pay_amount";
$spendRes = M()
->table("tab_spend spend")
if(empty($v['company_name'])) $v['company_name']= "万盟天下科技";
if(!array_key_exists('cash_count',$v)) $v['cash_count']=0;
if(!array_key_exists('balance_coin_count',$v)) $v['balance_coin_count']=0;
if(!array_key_exists('bind_coin_count',$v)) $v['bind_coin_count']=0;
if(!array_key_exists('inside_cash_count',$v)) $v['inside_cash_count']=0;
$v['allcount'] = $v['cash_count']-0+$v['balance_coin_count']+$v['bind_coin_count'];
$count['cash_count'] += $v['cash_count'];
$count['balance_coin_count'] += $v['balance_coin_count'];
$count['bind_coin_count'] += $v['bind_coin_count'];
$count['inside_cash_count'] += $v['inside_cash_count'];
$count['all_count'] += $v['allcount'];
$data[] = $v;
}
$data = my_sort($data, $data_order_type, (int)$data_order);
$this->assign('list_data', $data);
$this->assign('all_count', $count);
$this->display();
# code...
}
private function getJoinPromoteData($map,$type="spend")
{
if ($_REQUEST['promote_id'] != '') {
if ($_REQUEST['promote_id'] == 0) {
$map['s.promote_id'] = 0;
} else {
$promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select();
if ($promoter_ids) {
$map['s.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))];
}
}
}
if($type == "spend"){
if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type'])) {
$map["s.game_id"] = array("in",implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) );
}
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
$map['s.pay_time'] = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]];
} elseif (isset($_REQUEST['time_start'])) {
$map['s.pay_time'] = ['GT', strtotime($_REQUEST['time_start'])];
} elseif (isset($_REQUEST['time_end'])) {
$maps['s.pay_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
}
$map['s.pay_status']=1;
$field= "sum(pay_amount) pay_amount,IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) p_id,IFNULL(company_id,0) company_id,company_name";
return M()
->table("tab_spend s")
->field($field)
->where($map)
->join("tab_promote promote ON spend.promote_id = promote.id","left")
->group('spend.promote_id')
->join("tab_promote promote ON s.promote_id = promote.id","left")
->join("tab_promote_company company ON promote.company_id = company.id","left")
->group('p_id')
->select();
dump($spendRes);die();
}else{
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
$map['s.create_time'] = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]];
} elseif (isset($_REQUEST['time_start'])) {
$map['s.create_time'] = ['GT', strtotime($_REQUEST['time_start'])];
} elseif (isset($_REQUEST['time_end'])) {
$maps['s.create_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
}
$map['s.status']=1;
$map['s.source_id']=0;
$map['s.type']=1;
$field= "sum(num) pay_amount,IFNULL(if(substring_index(substring_index(`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(`chain`,'/',2),'/',-1)),0) p_id";
return M("promote_coin s","tab_")
->field($field)
->where($map)
->join("tab_promote promote ON s.promote_id = promote.id","left")
->group('p_id')
->select();
}
$this->display();
# code...
}

@ -13,20 +13,66 @@
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
box-shadow: 0px 3px 3px #F7F8F9 inset;
height: 35px;
height: 28px;
border-radius: 3px;
font-size: 12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: 35px;
line-height: 28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height: 26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
height: 26px;
line-height: 26px;
font-size: 12px;
}
.select2-results__option[aria-selected] {
font-size: 12px;
}
.tooltip {
position: relative;
/* display: block; */
/* color: #056dae; */
}
.tooltip .tooltiptext {
display: none;
width: 100%;
background-color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 10px 5px 5px;
position: absolute;
z-index: 1;
bottom: 80%;
left: 0;
border: #000 solid 1px;
line-height: 20px;
}
.tooltip .tooltiptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: black transparent transparent transparent;
}
.tooltip:hover .tooltiptext {
color: #333;
display: block;
}
.select2-results__option[aria-selected] {font-size:12px;}
</style>
<!-- 标题栏 -->
<div class="cf main-place top_nav_list navtab_list">
@ -52,7 +98,8 @@
<select id="company_id" name="company_id" class="select_gallery" style="width:150px;">
<option value="">请选择推广公司</option>
<volist name=":getPromoteCompany()" id="vo">
<option value="{$vo.id}" <if condition="I('company_id') && $vo.id eq I('company_id')">selected</if> >{$vo.company_name}</option>
<option value="{$vo.id}" <if condition="I('company_id') && $vo.id eq I('company_id')">selected
</if> >{$vo.company_name}</option>
</volist>
</select>
</div>
@ -64,10 +111,12 @@
</select>
</div>
<div class="input-list">
<input type="text" readonly id="time_start" name="time_start" class="" value="{:I('time_start')}" placeholder="开始时间" />
<input type="text" readonly id="time_start" name="time_start" class="" value="{:I('time_start')}"
placeholder="开始时间" />
&nbsp;-&nbsp;
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly id="time_end" name="time_end" class="" value="{:I('time_end')}" placeholder="结束时间" />
<input type="text" readonly id="time_end" name="time_end" class="" value="{:I('time_end')}"
placeholder="结束时间" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
@ -75,7 +124,8 @@
<select id="game_name" name="game_name" class="select_gallery">
<option value="">游戏名称</option>
<volist name=":getAllGame()" id="vo">
<option value="{$vo.game_name}" <if condition="$vo.game_name eq I('game_name')">selected</if> >{$vo.game_name}</option>
<option value="{$vo.game_name}" <if condition="$vo.game_name eq I('game_name')">selected</if>
>{$vo.game_name}</option>
</volist>
</select>
</div>
@ -86,8 +136,10 @@
<option value="2" <?php echo I('game_type') == 2 ? "selected" : ''?>>苹果</option>
</select>
</div>
<input type="hidden" name="" value="" class="sortBy">
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('FinancePromote/index','model='.$model['name'] .'&row='.I('row'),false)}">
<a class="sch-btn" href="javascript:;" id="search"
url="{:U('FinancePromote/index','model='.$model['name'] .'&row='.I('row'),false)}">
搜索</a>
</div>
@ -105,11 +157,41 @@
<th>推广公司</th>
<th>会长渠道</th>
<th>游戏现金金额</th>
<th>平台币直充支出</th>
<th>内充支出</th>
<th>平台币内充</th>
<th>渠道游戏内充值合计</th>
<th class="tooltip"><a class="paixu" data-order='cash_count'>
<if condition="$userarpu_order eq 4 and $userarpu_order_type eq 'cash_count'">游戏现金金额▲
<elseif condition="$userarpu_order eq 3 and $userarpu_order_type eq 'cash_count'" />
游戏现金金额▼
<else />游戏现金金额<img src="__IMG__/up-down.png" width="13px">
</if>
</a> <span class="tooltiptext">第三方支付(微信,支付宝,快捷)</span> </th>
<th class="tooltip"><a class="paixu" data-order='balance_coin_count'>
<if condition="$userarpu_order eq 4 and $userarpu_order_type eq 'balance_coin_count'">
平台币直充支出▲
<elseif
condition="$userarpu_order eq 3 and $userarpu_order_type eq 'balance_coin_count'" />
平台币直充支出▼
<else />平台币直充支出<img src="__IMG__/up-down.png" width="13px">
</if>
</a> <span class="tooltiptext">平台币购买游戏道具所产生的金额</span> </th>
<th class="tooltip"><a class="paixu" data-order='bind_coin_count'>
<if condition="$userarpu_order eq 4 and $userarpu_order_type eq 'bind_coin_count'">
内充支出▲
<elseif
condition="$userarpu_order eq 3 and $userarpu_order_type eq 'bind_coin_count'" />
内充支出▼
<else />内充支出<img src="__IMG__/up-down.png" width="13px">
</if>
</a> <span class="tooltiptext">公会下的玩家使用绑定币消费的金额</span> </th>
<th class="tooltip"><a class="paixu" data-order='inside_cash_count'>
<if condition="$userarpu_order eq 4 and $userarpu_order_type eq 'inside_cash_count'">
平台币内充▲
<elseif
condition="$userarpu_order eq 3 and $userarpu_order_type eq 'inside_cash_count'" />
平台币内充▼
<else />平台币内充<img src="__IMG__/up-down.png" width="13px">
</if>
</a> <span class="tooltiptext">管理后台直接下放给会长的平台币</span> </th>
<th class="tooltip">渠道游戏内充值合计 <span class="tooltiptext">游戏现金金额(游戏现金流水+平台币支出+公会内充支出=总流水</span> </th>
<th>操作</th>
</tr>
</thead>
@ -120,83 +202,48 @@
<else />
<volist name="list_data" id="data">
<tr>
<td >{$data.id}</td>
<if condition="I('type') eq 2">
<td >{:get_registertype($data['register_type'])}</td>
<td >{$data.account}</td>
<else/>
<td >{$data.account}</td>
</if>
<td >
<if condition="$data['promote_account'] eq '自然注册'">
官方渠道
<else/>
<empty name='data["promote_account"]'>---<else/>{$data.promote_account}</empty>
</if>
</td>
<td >{$data.balance}</td>
<td >{$data.recharge_total}</td>
<td >{$data.gold_coin|default='0.00'}</td>
<td >{$data.alipay|default='--'}</td>
<td >
<gt name="data.small_count" value="0">
<a class="jssamlllist" data-url="{:U('Member/small_list',array('id'=>$data['id'],'account'=>$data['account']))}" data-account="{$data.account}" href="javascript:;">{$data.small_count|default=0}</a>
<else />--
</gt>
</td>
<td>{:get_vip_level($data['recharge_total'])}</td>
<if condition="I('type') eq 1 or I('type') eq ''">
<td >
<switch name="data['register_type']">
<case value='2'>手机号</case>
<case value='7'>邮箱</case>
<default />账号
</switch>
</td>
</if>
<td>{$data.company_name}</td>
<td>{:get_promote_name($data['p_id'])}</td>
<td >{$data.register_time|date='Y-m-d H:i:s',###}</td>
<td >{$data.register_ip}</td>
<td >
<if condition="$data.login_time eq null">
<else />
<span class="login_old">{$data['login_time']|date='Y-m-d H:i:s',###}</span>
</if>
<td>{$data.cash_count}</td>
<td><span class='ljzc'
data-value="{$data['id']}"><a>{$data.balance_coin_count}</a></span></td>
<td><span class='ljzc' data-value="{$data['id']}"><a>{$data.bind_coin_count}</a></span>
</td>
<td >{$data.device_number|encryptStr}</td>
<td><span class='ljzc'
data-value="{$data['id']}"><a>{$data.inside_cash_count}</a></span></td>
<td>{$data.allcount}</td>
<if condition="get_info_status($data['lock_status'],4) eq 锁定">
<td style="color:red;">已{:get_info_status($data['lock_status'],4)}</td>
<else />
<td >{:get_info_status($data['lock_status'],4)}</td>
</if>
<eq name="data.check_status" value="1">
<td>正常</td>
<else/>
<td style="color:red;">已拉黑</td>
</eq>
<td>
<a href="{:U('Member/edit?id='.$data['id'])}">查看 </a>
<a class="ajax-get" href="{:U('Member/lock_status',array('id'=>$data['id'],'lock_status'=>1))}">启用 </a>
<a class="ajax-get" href="{:U('Member/lock_status',array('id'=>$data['id'],'lock_status'=>0))}">{:L('Lock')}</a>
<a href="{:U('Finance/gameFinance',
array('sign'=>$_GET['count_date']?1:'','count_date'=>$data['count_date'],'game_id'=>$_GET['game_id'],'partner_id'=>$_GET['partner_id'],'from'=>'index'))}" >游戏查看</a>
<a href="{:U('Finance/getRootUser',
array('sign'=>$_GET['count_date']?1:'','count_date'=>$data['count_date'],'game_id'=>$_GET['game_id'],'partner_id'=>$_GET['partner_id'])
,false)}" >渠道查看</a>
</td>
</tr>
</volist>
</empty>
<tr class="data_summary">
<td colspan="2" style="text-align: center;">汇总:</td>
<td colspan="99">
当前用户累计充值:{$now_count}&#12288;&#12288;用户数:{$user_count}
<td>{$all_count['cash_count']}</td>
<td>{$all_count['balance_coin_count']}</td>
<td>{$all_count['bind_coin_count']}</td>
<td>{$all_count['inside_cash_count']}</td>
<td>{$all_count['all_count']}</td>
<td style="text-align: center;">
<a href="{:U('Finance/gameFinance',array('sign'=>1,'game_id'=>$_GET['game_id'],'count_date'=>$_GET['count_date'],'partner_id'=>$_GET['partner_id'],'from'=>'index'))}" >游戏查看</a>
<a href="{:U('Finance/getRootUser',array('sign'=>1,'count_date'=>$_GET['count_date'],'game_id'=>$_GET['game_id'],'partner_id'=>$_GET['partner_id']))}" >渠道查看</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="page">
<a class="sch-btn" href="{:U('Export/expUser',array_merge(['id'=>3,'xlsname'=>'玩家_玩家列表_'.(I('get.type')==2?'第三方玩家':'本站玩家')],I('get.')))}">导出</a>
<a class="sch-btn"
href="{:U('Export/expUser',array_merge(['id'=>3,'xlsname'=>'玩家_玩家列表_'.(I('get.type')==2?'第三方玩家':'本站玩家')],I('get.')))}">导出</a>
{$_page|default=''}
</div>
@ -207,7 +254,12 @@
<input type="hidden" name="title" value="{$m_title}">
<input type="hidden" name="url" value="Member/user_info">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;"
target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img
src="__IMG__/zwmimages/icon_jia.png"><span>
<notempty name='commonset'>已添加
<else />添加至常用设置</notempty>
</span></a>
</div>
<!--end 添加常用设置 -->
@ -215,10 +267,12 @@
<block name="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>
<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 type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script type="text/javascript">
</script>
<script type="text/javascript">
@ -256,6 +310,22 @@ $(function(){
}
window.location.href = 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();
}
});
$('.jssamlllist').click(function () {
var that = $(this), url = that.attr('data-url');

Loading…
Cancel
Save