diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 1c4473c52..b9577352e 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -2083,4 +2083,31 @@ class QueryController extends BaseController $this->ajaxReturn($data); } + + public function userPlayDataCount() + { + $time = strtotime(date('Y-m-d 00:00:00',time() - (3600 * 24))); + $spendMap['pay_status'] = 1; + $spendMap['pay_game_status'] = 1; + $spendMap['game_player_id'] = ['gt', 0]; + $spendMap['pay_time'] = ['between', [$time, strtotime(date('Y-m-d 23:59:59', $time))]]; + + $field = 'FROM_UNIXTIME(pay_time,"%Y-%m-%d") as day,game_id,server_id,game_player_id,sum(pay_amount) as recharge_cost,count(id) as recharge_count'; + $spendCostData = M('spend', 'tab_')->field($field) + ->where($spendMap) + ->group('day,game_player_id,server_id,game_id') + ->select(); + + $data = []; + foreach ($spendCostData as $list) { + $save['game_id'] = $list['game_id']; + $save['server_id'] = $list['server_id']; + $save['role_id'] = $list['game_player_id']; + $save['recharge_cost'] = $list['recharge_cost']; + $save['recharge_count'] = $list['recharge_count']; + $save['create_time'] = strtotime($list['day']); + $data[] = $save; + } + M('user_play_data_count', 'tab_')->addAll($data); + } }