From 6081e088dbe91ffa7b32ad41515ae7f7623e8627 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Tue, 28 Apr 2020 14:30:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=B8=E6=88=8F=E7=BB=9F=E8=AE=A1bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Model/SpendModel.class.php | 30 ++++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/Application/Admin/Model/SpendModel.class.php b/Application/Admin/Model/SpendModel.class.php index c674c1a37..d338b8aaf 100644 --- a/Application/Admin/Model/SpendModel.class.php +++ b/Application/Admin/Model/SpendModel.class.php @@ -840,8 +840,11 @@ class SpendModel extends Model */ public function gameStatistics($map, $row = 0, $page = 1) { + $noticeFailData = M("Spend s use index(game_time)","tab_") ->field("SUM(pay_amount) as notice_fail_count,game_id") + ->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') ->where(['s.pay_status' => 1, 'pay_game_status' => 0]) ->where($map) ->group('s.game_id') @@ -888,26 +891,35 @@ SUM(CASE WHEN pay_way = -1 and s.pay_status = 1 and pay_game_status = 1 THEN pay { + $noticeFailData = M("Spend s use index(game_time)","tab_") + ->field("SUM(pay_amount) as notice_fail_count,game_id") + ->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') + ->where(['s.pay_status' => 1, 'pay_game_status' => 0]) + ->where($map) + ->find(); +// var_dump($noticeFailData);die(); + $query = M("Spend s use index(game_time)","tab_") - ->field("SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count, -SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count, -SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count"); + ->field("SUM(CASE WHEN pay_way > 0 and s.pay_status = 1 and pay_game_status = 1 THEN pay_amount ELSE 0 END) as cash_count, +SUM(CASE WHEN pay_way = 0 and s.pay_status = 1 and pay_game_status = 1 THEN pay_amount ELSE 0 END) as balance_coin_count, +SUM(CASE WHEN pay_way = -1 and s.pay_status = 1 and pay_game_status = 1 THEN pay_amount ELSE 0 END) as inside_cash_count"); if ($join) { $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'); } - $data = $query->where(['s.pay_status' => 1, 'pay_game_status' => 1]) + $data = $query->where(['s.pay_status' => 1]) ->where($map) ->find(); // $gc_game_id = array_unique(explode(',',$data['gc_game_id'])); - $noticeFailData = M("Spend s use index(game_time)","tab_") - ->field("SUM(pay_amount) as notice_fail_count,game_id") - ->where(['s.pay_status' => 1, 'pay_game_status' => 0]) - ->where($map) - ->find(); +// $noticeFailData = M("Spend s use index(game_time)","tab_") +// ->field("SUM(pay_amount) as notice_fail_count,game_id") +// ->where(['s.pay_status' => 1, 'pay_game_status' => 0]) +// ->where($noticeMap) +// ->find(); $data['notice_fail_count'] = $noticeFailData['notice_fail_count']; // dd($query->_sql());