You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
182 lines
6.3 KiB
PHP
182 lines
6.3 KiB
PHP
<?php
|
|
|
|
|
|
namespace Admin\Controller;
|
|
|
|
use OSS\Core\OssException;
|
|
|
|
|
|
class FinanceController extends ThinkController
|
|
{
|
|
|
|
function index($p = 1) {
|
|
//总流水查询
|
|
$allField = "";
|
|
$page = intval($p);
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
$row=10;
|
|
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
|
|
|
|
$map = [];
|
|
if(!empty(I('count_date'))){
|
|
$map['count_date']=I('count_date');
|
|
}
|
|
|
|
if (!empty(I('game_id'))) {
|
|
$map['game_id']=I('game_id');
|
|
}
|
|
if (!empty(I('partner_id'))) {
|
|
$map['partner_id']=I('collaborate_id');
|
|
}
|
|
|
|
// $data = M("spend_count","tab_")
|
|
// ->field("count_date,cash_count,balance_coin_count,inside_cash_count,all_cash_count")
|
|
// ->where($map)
|
|
// ->page($page,$row)
|
|
// ->group("count_date")
|
|
// ->select();
|
|
if (empty(I('game_id'))) {
|
|
$field = "count_date,sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,
|
|
sum(inside_cash_count) as inside_cash_count,sum(cash_count+balance_coin_count+inside_cash_count) as all_cash_count";
|
|
$allField = "cash_count+balance_coin_count+inside_cash_count";
|
|
$InsideField = "inside_cash_count";
|
|
} else {
|
|
$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";
|
|
$allField = "cash_count+balance_coin_count+bind_coin_count";
|
|
$InsideField = "bind_coin_count";
|
|
}
|
|
$group = "count_date";
|
|
$order = "id DESC";
|
|
$data = D("spend_count")->getSpendCountData($map,$field,$group,$order,$page,$row);
|
|
|
|
$sumCash = D("spend_count")->sumSpendCountField($map,"cash_count");
|
|
$sumBalance = D("spend_count")->sumSpendCountField($map,"balance_coin_count");
|
|
$sumInside = D("spend_count")->sumSpendCountField($map,$InsideField);
|
|
$sumAll = D("spend_count")->sumSpendCountField($map,$allField);
|
|
|
|
$count = D("spend_count")->getSpendCountData($map,$field,$group,$order);
|
|
$count = count($count);
|
|
$page = set_pagination($count,$row);
|
|
if($page) {$this->assign('_page', $page);}
|
|
|
|
$this->assign('sumCash',$sumCash);
|
|
$this->assign('sumBalance',$sumBalance);
|
|
$this->assign('sumInside',$sumInside);
|
|
$this->assign('sumAll',$sumAll);
|
|
|
|
$this->assign('data',$data);
|
|
|
|
$this->display();
|
|
}
|
|
|
|
function gameFinance($p = 1) {
|
|
$page = intval($p);
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
$row=10;
|
|
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
|
|
|
|
$map = [];
|
|
if(!empty(I('count_date'))){
|
|
$map['count_date']=I('count_date');
|
|
}
|
|
|
|
// if (!empty(I('game_id'))) {
|
|
// $map['game_id']=I('game_id');
|
|
// }
|
|
// if (!empty(I('collaborate_id'))) {
|
|
// $map['collaborate_id']=I('collaborate_id');
|
|
// }
|
|
|
|
// $data = M("spend_count","tab_")
|
|
// ->field("count_date,cash_count,balance_coin_count,inside_cash_count,all_cash_count")
|
|
// ->where($map)
|
|
// ->page($page,$row)
|
|
// ->group("game_id")
|
|
// ->select();
|
|
|
|
|
|
$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,game_id,partner_name";
|
|
|
|
$group = "game_id";
|
|
$order = "id DESC";
|
|
$data = D("spend_count")->getSpendCountData($map,$field,$group,$order,$page,$row);
|
|
|
|
$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");
|
|
$sumAll = D("spend_count")->sumSpendCountField($map,"cash_count+balance_coin_count+bind_coin_count");
|
|
|
|
$count = D("spend_count")->getSpendCountData($map,$field,$group,$order);
|
|
|
|
$count = count($count);
|
|
$page = set_pagination($count,$row);
|
|
if($page) {$this->assign('_page', $page);}
|
|
|
|
$this->assign('sumCash',$sumCash);
|
|
$this->assign('sumBalance',$sumBalance);
|
|
$this->assign('sumInside',$sumInside);
|
|
$this->assign('sumAll',$sumAll);
|
|
|
|
$this->assign('data',$data);
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
function gameFinanceDetail($p = 1) {
|
|
|
|
$page = intval($p);
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
$row=10;
|
|
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
|
|
|
|
if (!empty(I("count_date"))) {
|
|
$month = I("count_date");
|
|
} else {
|
|
$this->error('月份不能为空');
|
|
}
|
|
|
|
$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");
|
|
}
|
|
if (!empty(I('user_account'))) {
|
|
$map['user_account'] = array('like','%'.I("user_account").'%');
|
|
}
|
|
if (!empty(I('user_nickname'))) {
|
|
$map['user_nickname'] = array('like',I("user_nickname").'%');
|
|
}
|
|
|
|
$field = "pay_order_number,FROM_UNIXTIME(pay_time) as pay_time,user_account,game_name,promote_account,spend_ip,server_name,game_player_name,pay_amount,cost,pay_way";
|
|
$group = "";
|
|
$order = "pay_time DESC";
|
|
$data = D('spend')->getSpendData($map,$field,$group,$order,$page,$row);
|
|
|
|
foreach($data as $key => $value) {
|
|
$data[$key]['pay_way'] = getPayType($value['pay_way']);
|
|
}
|
|
|
|
$sum = D('spend')->sumSpend($map,'pay_amount');
|
|
|
|
$count = D("spend")->getSpendData($map,$field,$group,$order);
|
|
|
|
$count = count($count);
|
|
$page = set_pagination($count,$row);
|
|
if($page) {$this->assign('_page', $page);}
|
|
|
|
$this->assign('data',$data);
|
|
$this->assign('sum_amount',$sum);
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
|
|
} |