|
|
|
@ -5359,7 +5359,7 @@ if ($key == 'model'){
|
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
|
|
array('game_name','游戏'),
|
|
|
|
|
array('collaborate_name','合作方'),
|
|
|
|
|
array('partner_name','合作方'),
|
|
|
|
|
array('cash_count','游戏现金流水'),
|
|
|
|
|
array('balance_coin_count','平台币流水'),
|
|
|
|
|
array('inside_cash_count','内冲流水'),
|
|
|
|
@ -5371,13 +5371,65 @@ if ($key == 'model'){
|
|
|
|
|
$map['count_date']=I('count_date');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!empty(I('root_id'))||I('root_id')=='0') {
|
|
|
|
|
$root_id = I('root_id');
|
|
|
|
|
if ($root_id == '0') {
|
|
|
|
|
$map['_string'] = "promote_id = {$root_id}";
|
|
|
|
|
} else if($root_id){
|
|
|
|
|
$map['_string'] = "promote_id = {$root_id} or parent_id = {$root_id} or root_id = {$root_id}";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty(I("game_id"))) {
|
|
|
|
|
$map['game_id'] = I("game_id");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (I('sign') == 2&&empty(I('root_id'))) {
|
|
|
|
|
|
|
|
|
|
$map['_string'] = "parent_id >0 or root_id>0";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (I('sign') == 3&&empty(I('root_id'))) {
|
|
|
|
|
$map['_string'] = "parent_id >0 and root_id>0";
|
|
|
|
|
}
|
|
|
|
|
// var_dump($map);die();
|
|
|
|
|
|
|
|
|
|
if(!empty(I('parent_id'))) {
|
|
|
|
|
$parent_id = I('parent_id');
|
|
|
|
|
$map['_string'] = "promote_id = {$parent_id} or parent_id = {$parent_id}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty(I('promote_id'))) {
|
|
|
|
|
$promote_id = I('promote_id');
|
|
|
|
|
$map['_string'] = "promote_id = {$promote_id}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$map['bind_coin_count'] = ['neq',0];
|
|
|
|
|
$insideData = D("spend_count")->getSpendCountData($map,"game_id,bind_coin_count as count","promote_id,count_date,game_id");
|
|
|
|
|
unset($map['bind_coin_count']);
|
|
|
|
|
//内充流水与绑定流水数据
|
|
|
|
|
$insideDataSum = [];
|
|
|
|
|
foreach ($insideData as $key => $value) {
|
|
|
|
|
if (isset($insideDataSum[$value['game_id']])) {
|
|
|
|
|
$insideDataSum[$value['game_id']] = $insideDataSum[$value['game_id']] + $value['count'];
|
|
|
|
|
} else {
|
|
|
|
|
$insideDataSum[$value['game_id']] = $value['count'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$field = "count_date,sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,
|
|
|
|
|
sum(bind_coin_count) as inside_cash_count,sum(cash_count+balance_coin_count+bind_coin_count) as all_cash_count,game_name,collaborate_name";
|
|
|
|
|
sum(bind_coin_count) as inside_cash_count,sum(cash_count+balance_coin_count+bind_coin_count) as all_cash_count,game_name,partner_name";
|
|
|
|
|
|
|
|
|
|
$group = "game_id";
|
|
|
|
|
$order = "id DESC";
|
|
|
|
|
$xlsData = D("spend_count")->getSpendCountData($map,$field,$group,$order);
|
|
|
|
|
|
|
|
|
|
foreach ($xlsData as $key => $value) {
|
|
|
|
|
$xlsData[$key]['inside_cash_count'] = number_format($insideDataSum[$value['game_id']],2,'.','');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$sumCash = D("spend_count")->sumSpendCountField($map,"cash_count");
|
|
|
|
|
$sumBalance = D("spend_count")->sumSpendCountField($map,"balance_coin_count");
|
|
|
|
|
$sumInside = D("spend_count")->sumSpendCountField($map,"bind_coin_count");
|
|
|
|
@ -5396,8 +5448,8 @@ if ($key == 'model'){
|
|
|
|
|
function gameFinanceDetail() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$month = I("count_date");
|
|
|
|
|
$xlsName = '充值流水';
|
|
|
|
|
$month = I("game_name");
|
|
|
|
|
$xlsName = $month.'充值流水';
|
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
|
|
array('pay_order_number','支付订单号'),
|
|
|
|
@ -5413,16 +5465,39 @@ if ($key == 'model'){
|
|
|
|
|
array('pay_way','充值方式'),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (!empty(I("count_date"))) {
|
|
|
|
|
$month = I("count_date");
|
|
|
|
|
} else {
|
|
|
|
|
$this->error('月份不能为空');
|
|
|
|
|
|
|
|
|
|
if (!empty(I("promote_id"))) {
|
|
|
|
|
$promote_id[] = I("promote_id");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty(I("root_id"))) {
|
|
|
|
|
$root_id = I("root_id");
|
|
|
|
|
$promote_id = $this->getPromoteList($root_id);
|
|
|
|
|
array_push($promote_id,$root_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($_REQUEST['root_id']=='0') {
|
|
|
|
|
$map['promote_id'] = $_REQUEST['root_id'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$startTime = strtotime(date("Y-m-01",strtotime($month)));
|
|
|
|
|
$endTime = strtotime(date("Y-m-t",strtotime($month)));
|
|
|
|
|
if (!empty(I("parent_id"))) {
|
|
|
|
|
$parent_id = I("parent_id");
|
|
|
|
|
$promote_id = $this->getPromoteList($parent_id);
|
|
|
|
|
array_push($promote_id,$parent_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$map['pay_time'] = array('between',array($startTime,$endTime));
|
|
|
|
|
$promote_id = implode(',',$promote_id);
|
|
|
|
|
if ($promote_id) {
|
|
|
|
|
$map['promote_id'] = ['in',$promote_id];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty(I("count_date"))) {
|
|
|
|
|
$month = I("count_date");
|
|
|
|
|
$tarry = explode('-',$month);
|
|
|
|
|
$startTime=mktime(0,0,0,$tarry[1],1,$tarry[0]);
|
|
|
|
|
$endTime =mktime(0,0,0,$tarry[1]-0+1,1,$tarry[0])-1;
|
|
|
|
|
$map['pay_time'] = array('between',array($startTime,$endTime));
|
|
|
|
|
}
|
|
|
|
|
$map['pay_status'] = 1;
|
|
|
|
|
if (!empty(I("game_id"))) {
|
|
|
|
|
$map['game_id'] = I("game_id");
|
|
|
|
@ -5440,7 +5515,7 @@ if ($key == 'model'){
|
|
|
|
|
$xlsData = D('spend')->getSpendData($map,$field,$group,$order);
|
|
|
|
|
|
|
|
|
|
foreach($xlsData as $key => $value) {
|
|
|
|
|
$data[$key]['pay_way'] = getPayType($value['pay_way']);
|
|
|
|
|
$xlsData[$key]['pay_way'] = getPayType($value['pay_way']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$sum = D('spend')->sumSpend($map,'pay_amount');
|
|
|
|
@ -5452,6 +5527,22 @@ if ($key == 'model'){
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getPromoteList($root_id = 0) {
|
|
|
|
|
|
|
|
|
|
$data = M('promote','tab_')
|
|
|
|
|
->field("id")
|
|
|
|
|
->where("parent_id={$root_id} or grand_id={$root_id}")
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
$handleData = [];
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
|
|
array_push($handleData,$data[$key]['id']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $handleData;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function exportGetRootUser() {
|
|
|
|
|
|
|
|
|
|
//获取所有数据
|
|
|
|
@ -5589,9 +5680,15 @@ if ($key == 'model'){
|
|
|
|
|
$parentData = $this->getParentSpendData($parent_id,$month);
|
|
|
|
|
|
|
|
|
|
$map['parent_id'] =$parent_id;
|
|
|
|
|
} else if (!empty(I('sign'))) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty(I('sign'))) {
|
|
|
|
|
$map['parent_id'] = ['neq',0];
|
|
|
|
|
$map['root_id'] = ['neq',0];
|
|
|
|
|
if (!empty(I('root_id'))) {
|
|
|
|
|
$map['root_id'] = I('root_id');
|
|
|
|
|
} else {
|
|
|
|
|
$map['root_id'] = ['neq',0];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$xlsName = '推广员月结统计';
|
|
|
|
|