diff --git a/Application/Admin/Controller/FinancePromoteController.class.php b/Application/Admin/Controller/FinancePromoteController.class.php index e3c0d0f57..f2da8c88e 100644 --- a/Application/Admin/Controller/FinancePromoteController.class.php +++ b/Application/Admin/Controller/FinancePromoteController.class.php @@ -69,8 +69,9 @@ class FinancePromoteController extends AdminController } if(array_key_exists(0,$senddata) || $_REQUEST['promote_id']==0){ $pmap['status']=1; - $pmap['create_time'] = $istimeselect; - + if($istimeselect){ + $pmap['create_time'] = $istimeselect; + } $admininside = M("provide_user p","tab_")->field("sum(amount) amount")->where($pmap)->find(); if($admininside['amount'] >0){ $senddata[0]['inside_cash_count']= $admininside['amount']; @@ -103,6 +104,7 @@ class FinancePromoteController extends AdminController $data = my_sort($data, $data_order_type, (int)$data_order); $this->assign('list_data', $data); $this->assign('all_count', $count); + $this->meta_title = '公会统计'; $this->display(); # code... } @@ -155,7 +157,174 @@ class FinancePromoteController extends AdminController } //渠道查看 + public function promoteUser($p = 0) + { + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + $arraypage = $page; + + if (isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; + } + + $istimeselect = false; + if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) { + $istimeselect = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]]; + } elseif (isset($_REQUEST['time_start'])) { + $istimeselect = ['GT', strtotime($_REQUEST['time_start'])]; + } elseif (isset($_REQUEST['time_end'])) { + $istimeselect = ['LT', strtotime($_REQUEST['time_end']) + 86399]; + } + $senddata = []; + //获取各会长的现金充值 + $cash = self::promoteUserData(array("pay_way"=>array("GT",0)),$istimeselect); + foreach($cash as $k=>$v){ + $v['cash_count'] = $v['pay_amount']; + unset($v['pay_amount']); + $senddata[$v['promote_id']] = $v; + } + //平台币直充支出 + $balance = self::promoteUserData(array("pay_way"=>array("EQ",0)),$istimeselect); + foreach($balance as $k=>$v){ + if(array_key_exists($v['promote_id'],$senddata)){ + $senddata[$v['promote_id']]['balance_coin_count']= $v['pay_amount']; + }else{ + $v['balance_coin_count'] = $v['pay_amount']; + unset($v['pay_amount']); + $senddata[$v['promote_id']] = $v; + }; + } + //平台币内充 + $bind = self::promoteUserData(array("pay_way"=>array("LT",0)),$istimeselect); + foreach($bind as $k=>$v){ + if(array_key_exists($v['promote_id'],$senddata)){ + $senddata[$v['promote_id']]['bind_coin_count']= $v['pay_amount']; + }else{ + $v['bind_coin_count'] = $v['pay_amount']; + unset($v['pay_amount']); + $senddata[$v['promote_id']] = $v; + }; + } + $inside = self::promoteUserData([],$istimeselect,"promote_coin"); + foreach($inside as $k=>$v){ + if(array_key_exists($v['promote_id'],$senddata)){ + $senddata[$v['promote_id']]['inside_cash_count']= $v['pay_amount']; + }else{ + $v['inside_cash_count'] = $v['pay_amount']; + unset($v['pay_amount']); + $senddata[$v['promote_id']] = $v; + }; + } + if(array_key_exists(0,$senddata) || $_REQUEST['promote_id']==0){ + $pmap['status']=1; + if($istimeselect){ + $pmap['create_time'] = $istimeselect; + } + $admininside = M("provide_user p","tab_")->field("sum(amount) amount")->where($pmap)->find(); + if($admininside['amount'] >0){ + $senddata[0]['inside_cash_count']= $admininside['amount']; + } + + } + $count = count($senddata); + 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); + } + + $page = set_pagination($count, $row); + if ($page) { + $this->assign('_page', $page); + } + $data = []; + $allcount =array( + "cash_count"=>0, + "balance_coin_count"=>0, + "bind_coin_count"=>0, + "inside_cash_count"=>0, + ); + foreach($senddata as $k=>$v){ + + 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']; + $allcount['cash_count'] += $v['cash_count']; + $allcount['balance_coin_count'] += $v['balance_coin_count']; + $allcount['bind_coin_count'] += $v['bind_coin_count']; + $allcount['inside_cash_count'] += $v['inside_cash_count']; + $allcount['all_count'] += $v['allcount']; + $data[] = $v; + } - + $data = my_sort($data, $data_order_type, (int)$data_order); + $size = $row; + $data = array_slice($data, ($arraypage - 1) * $size, $size); + $this->assign('all_count', $allcount); + $this->assign('list_data', $data); + $this->display(); + // dump($senddata); + + } + private function promoteUserData($map,$istimeselect,$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($istimeselect){ + $map['s.pay_time']=$istimeselect; + } + $map['s.pay_status']=1; + $field= "sum(pay_amount) pay_amount,IFNULL(company_id,0) company_id,company_name,promote_id"; + return M() + ->table("tab_spend s") + ->field($field) + ->where($map) + ->join("tab_promote promote ON s.promote_id = promote.id", "left") + ->join("tab_promote_company company ON promote.company_id = company.id", "left") + ->group('promote_id') + ->select(); + }else{ + if($istimeselect){ + $map['s.create_time']=$istimeselect; + } + $map['s.status']=1; + $map['s.source_id']=0; + $map['s.type']=1; + $field= "sum(num) pay_amount,promote_id"; + return M("promote_coin s","tab_") + ->field($field) + ->where($map) + ->join("tab_promote promote ON s.promote_id = promote.id","left") + ->group('promote_id') + ->select(); + } + # code... + } + private function data_total($data) + { + $total['sum_count'] = array_sum(array_column($data, 'count')); + $total['sum_today'] = array_sum(array_column($data, 'today')); + $total['sum_week'] = array_sum(array_column($data, 'week')); + $total['sum_mounth'] = array_sum(array_column($data, 'mounth')); + return $total; + } } \ No newline at end of file diff --git a/Application/Admin/View/FinancePromote/index.html b/Application/Admin/View/FinancePromote/index.html index b4757c72c..9855286e4 100644 --- a/Application/Admin/View/FinancePromote/index.html +++ b/Application/Admin/View/FinancePromote/index.html @@ -77,12 +77,8 @@ + + + +
+ +
+
+ +
+
+ +
+
+ +
+
+ +  -  +
+ + +
+
+
+ +
+
+ +
+ + + +
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
推广公司推广员账号 + 游戏现金金额▲ + + 游戏现金金额▼ + 游戏现金金额 + + 第三方支付(微信,支付宝,快捷) + + 平台币直充支出▲ + + 平台币直充支出▼ + 平台币直充支出 + + 平台币购买游戏道具所产生的金额 + + 内充支出▲ + + 内充支出▼ + 内充支出 + + 公会下的玩家使用绑定币消费的金额 + + 平台币内充▲ + + 平台币内充▼ + 平台币内充 + + 管理后台直接下放给会长的平台币 渠道游戏内充值合计 游戏现金金额(游戏现金流水+平台币支出+公会内充支出=总流水 操作
aOh! 暂时还没有内容!
{$data.company_name}{:get_promote_name($data['promote_id'])}{$data.cash_count}{$data.balance_coin_count}{$data.bind_coin_count} + {$data.inside_cash_count}{$data.allcount} + 游戏查看 + 渠道查看 +
汇总:{$all_count['cash_count']}{$all_count['balance_coin_count']}{$all_count['bind_coin_count']}{$all_count['inside_cash_count']}{$all_count['all_count']} + 游戏查看 + 渠道查看 +
+
+
+
+ 导出 + {$_page|default=''} +
+ + +
+ +
+ + +
+ + 已添加 + 添加至常用设置 + +
+ + + + + + + if(C('COLOR_STYLE')=='blue_color') echo ' + '; + + + + + + + + \ No newline at end of file