|
|
@ -894,27 +894,55 @@ public function auto_rrdae(){
|
|
|
|
public function userPlayDataCount()
|
|
|
|
public function userPlayDataCount()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$time = strtotime(date('Y-m-d 00:00:00', time() - (3600 * 24)));
|
|
|
|
$time = strtotime(date('Y-m-d 00:00:00', time() - (3600 * 24)));
|
|
|
|
$spendMap['pay_status'] = 1;
|
|
|
|
$res = M('user_play_data_count', 'tab_')->where(array('create_time' => $time))->find();
|
|
|
|
$spendMap['pay_game_status'] = 1;
|
|
|
|
if (empty($res)) {
|
|
|
|
$spendMap['game_player_id'] = ['gt', 0];
|
|
|
|
$spendMap['pay_status'] = 1;
|
|
|
|
$spendMap['pay_time'] = ['between', [$time, strtotime(date('Y-m-d 23:59:59', $time))]];
|
|
|
|
$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))]];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->userPlayDataCountByMap($spendMap);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//根据时间统计玩家充值--初始
|
|
|
|
|
|
|
|
public function userPlayDataCountInitial()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$res = M('user_play_data_count', 'tab_')->order('id asc')->find();
|
|
|
|
|
|
|
|
if (empty($res)) {
|
|
|
|
|
|
|
|
$time = strtotime(date('Y-m-d 00:00:00', time()));
|
|
|
|
|
|
|
|
$spendMap['pay_status'] = 1;
|
|
|
|
|
|
|
|
$spendMap['pay_game_status'] = 1;
|
|
|
|
|
|
|
|
$spendMap['game_player_id'] = ['gt', 0];
|
|
|
|
|
|
|
|
$spendMap['pay_time'] = ['lt', $time];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->userPlayDataCountByMap($spendMap);
|
|
|
|
|
|
|
|
echo '初始化成功';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
echo '表存在记录,无法初始化';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function userPlayDataCountByMap($map)
|
|
|
|
|
|
|
|
{
|
|
|
|
$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';
|
|
|
|
$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)
|
|
|
|
$spendCostData = M('spend', 'tab_')->field($field)
|
|
|
|
->where($spendMap)
|
|
|
|
->where($map)
|
|
|
|
->group('day,game_player_id,server_id,game_id')
|
|
|
|
->group('day,game_player_id,server_id,game_id')
|
|
|
|
->select();
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
|
|
$data = [];
|
|
|
|
if (!empty($spendCostData)) {
|
|
|
|
foreach ($spendCostData as $list) {
|
|
|
|
$data = [];
|
|
|
|
$save['game_id'] = $list['game_id'];
|
|
|
|
foreach ($spendCostData as $list) {
|
|
|
|
$save['server_id'] = $list['server_id'];
|
|
|
|
$save['game_id'] = $list['game_id'];
|
|
|
|
$save['role_id'] = $list['game_player_id'];
|
|
|
|
$save['server_id'] = $list['server_id'];
|
|
|
|
$save['recharge_cost'] = $list['recharge_cost'];
|
|
|
|
$save['role_id'] = $list['game_player_id'];
|
|
|
|
$save['recharge_count'] = $list['recharge_count'];
|
|
|
|
$save['recharge_cost'] = $list['recharge_cost'];
|
|
|
|
$save['create_time'] = strtotime($list['day']);
|
|
|
|
$save['recharge_count'] = $list['recharge_count'];
|
|
|
|
$data[] = $save;
|
|
|
|
$save['create_time'] = strtotime($list['day']);
|
|
|
|
|
|
|
|
$data[] = $save;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
M('user_play_data_count', 'tab_')->addAll($data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
M('user_play_data_count', 'tab_')->addAll($data);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|