@ -345,7 +345,11 @@ class FinancePromoteController extends AdminController
$map['s.pay_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
$map['s.pay_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
}
}
//判断是否有推广员
//判断是否有推广员
$level = 1;
if ($_REQUEST['promote_id'] != '') {
if ($_REQUEST['promote_id'] != '') {
if ($_REQUEST['promote_id'] != 0){
$level = M('promote', 'tab_')->field('level')->where(array('id' => $_REQUEST['promote_id']))->find()['level'];
}
if ($_REQUEST['promote_id'] == 0 || $_REQUEST['promote_type'] == 2) {
if ($_REQUEST['promote_id'] == 0 || $_REQUEST['promote_type'] == 2) {
$map['s.promote_id'] = $_REQUEST['promote_id'];
$map['s.promote_id'] = $_REQUEST['promote_id'];
} else {
} else {
@ -355,6 +359,7 @@ class FinancePromoteController extends AdminController
}
}
}
}
}
}
$this->assign('promote_level', $level);
//游戏统计列表
//游戏统计列表
$data =self::gameStatisticsData($map, $row, $p);
$data =self::gameStatisticsData($map, $row, $p);
@ -388,6 +393,18 @@ class FinancePromoteController extends AdminController
//游戏订单详情
//游戏订单详情
public function gameStatisticsDetail($p = 1) {
public function gameStatisticsDetail($p = 1) {
set_time_limit(0);
set_time_limit(0);
if(isset($_REQUEST['game_id'])){
//转化为名称和类型,重新请求
$game = M("game","tab_")->field("relation_game_name,sdk_version")->where(" id = {$_REQUEST['game_id']} ")->find();
if($game === false){
$this->error("参数错误");
}
$_GET['game_name'] = $game['relation_game_name'];
$_GET['game_type'] = $game['sdk_version'];
unset($_GET['game_id']);
$this->redirect(ACTION_NAME, I('get.'));
}
if (isset($_REQUEST['pay_way'])) {
if (isset($_REQUEST['pay_way'])) {
$map['pay_way'] = $_REQUEST['pay_way'];
$map['pay_way'] = $_REQUEST['pay_way'];
@ -396,13 +413,16 @@ class FinancePromoteController extends AdminController
if (!empty($_REQUEST['pay_order_number'])) {
if (!empty($_REQUEST['pay_order_number'])) {
$map['pay_order_number'] = $_REQUEST['pay_order_number'];
$map['pay_order_number'] = $_REQUEST['pay_order_number'];
}
}
if (!empty(I('partner_id'))& & empty(I("game_id")) ) {
if (!empty(I('partner_id'))) {
$wherePartner = I('partner_id');
$wherePartner = I('partner_id');
$gameId = M("game","tab_")->field("id")->where("partner_id={$wherePartner}")->select();
$gameId = M("game","tab_")->field("id")->where("partner_id={$wherePartner}")->select();
$gameId = implode(',',array_column($gameId,'id'));
$gameId = implode(',',array_column($gameId,'id'));
$map['game_id'] = ['in',$gameId];
$map['game_id'] = ['in',$gameId];
}
}
if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type'])) {
$map["game_id"] = array("in",implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) );
}
if (isset($_REQUEST['time_start']) & & isset($_REQUEST['time_end'])) {
if (isset($_REQUEST['time_start']) & & isset($_REQUEST['time_end'])) {
$map['pay_time'] = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]];
$map['pay_time'] = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]];
@ -423,9 +443,6 @@ class FinancePromoteController extends AdminController
}
}
}
}
}
}
// if (!empty(I("promote_id"))) {
// $promote_id[] = I("promote_id");
// }
if (!empty(I("root_id"))) {
if (!empty(I("root_id"))) {
$root_id = I("root_id");
$root_id = I("root_id");
@ -459,7 +476,6 @@ class FinancePromoteController extends AdminController
if (!empty(I('user_nickname'))) {
if (!empty(I('user_nickname'))) {
$map['game_player_name'] = array('like',I("user_nickname").'%');
$map['game_player_name'] = array('like',I("user_nickname").'%');
}
}
// var_dump($map);die();
$field = "pay_order_number,FROM_UNIXTIME(pay_time) as pay_time,user_account,user_nickname,game_name,promote_account,spend_ip,server_name,game_player_name,pay_amount,cost,pay_way";
$field = "pay_order_number,FROM_UNIXTIME(pay_time) as pay_time,user_account,user_nickname,game_name,promote_account,spend_ip,server_name,game_player_name,pay_amount,cost,pay_way";
$group = "";
$group = "";
$order = "pay_time DESC";
$order = "pay_time DESC";
@ -468,7 +484,7 @@ class FinancePromoteController extends AdminController
$data[$key]['pay_way'] = getPayType($value['pay_way']);
$data[$key]['pay_way'] = getPayType($value['pay_way']);
}
}
$totalData = D('spend')->totalGameStatistics ($map, false);
$totalData = self::totalGameStatisticsData ($map, false);
$sumCash = $totalData['cash_count'] ?? 0;
$sumCash = $totalData['cash_count'] ?? 0;
$sumBalance = $totalData['balance_coin_count'] ?? 0;
$sumBalance = $totalData['balance_coin_count'] ?? 0;
$sumInside = $totalData['inside_cash_count'] ?? 0;
$sumInside = $totalData['inside_cash_count'] ?? 0;
@ -507,6 +523,7 @@ class FinancePromoteController extends AdminController
$query = $query->page($page,$row);
$query = $query->page($page,$row);
}
}
$data = $query->select();
$data = $query->select();
// dump($data);die();
return $data;
return $data;
}
}
private function totalGameStatisticsData($map, $join = true)
private function totalGameStatisticsData($map, $join = true)
@ -519,7 +536,7 @@ class FinancePromoteController extends AdminController
$query = $query->join('LEFT JOIN tab_game as g ON s.game_id=g.id')
$query = $query->join('LEFT JOIN tab_game as g ON s.game_id=g.id')
->join('LEFT JOIN tab_partner as p ON g.partner_id=p.id');
->join('LEFT JOIN tab_partner as p ON g.partner_id=p.id');
}
}
$data = $query->where(['s.pay_status' => 1, 'pay_game_status' => 1 ])
$data = $query->where(['s.pay_status' => 1])
->where($map)
->where($map)
->find();
->find();
return $data;
return $data;