From 3d3bfce9475f608062fe6f741247cdc267793665 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Mon, 25 Nov 2019 11:48:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=84=9A=E6=9C=AC->=E7=8E=A9?= =?UTF-8?q?=E5=AE=B6=E8=A7=92=E8=89=B2=E5=85=85=E5=80=BC=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/AutoController.class.php | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/Application/Admin/Controller/AutoController.class.php b/Application/Admin/Controller/AutoController.class.php index 4ad4af173..1c04e0d46 100644 --- a/Application/Admin/Controller/AutoController.class.php +++ b/Application/Admin/Controller/AutoController.class.php @@ -896,9 +896,6 @@ public function auto_rrdae(){ $time = strtotime(date('Y-m-d 00:00:00', time() - (3600 * 24))); $res = M('user_play_data_count', 'tab_')->where(array('create_time' => $time))->find(); if (empty($res)) { - $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))]]; $this->userPlayDataCountByMap($spendMap); @@ -911,9 +908,6 @@ public function auto_rrdae(){ $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); @@ -925,24 +919,29 @@ public function auto_rrdae(){ 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'; - $spendCostData = M('spend', 'tab_')->field($field) - ->where($map) - ->group('day,game_player_id,server_id,game_id') - ->select(); - - if (!empty($spendCostData)) { - $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; + if (isset($map['pay_time'])) { + $map['pay_status'] = 1; + $map['pay_game_status'] = 1; + $map['game_player_id'] = ['gt', 0]; + $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($map) + ->group('day,game_player_id,server_id,game_id') + ->select(); + + if (!empty($spendCostData)) { + $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); } - M('user_play_data_count', 'tab_')->addAll($data); } } }