diff --git a/Application/Admin/Controller/FinanceController.class.php b/Application/Admin/Controller/FinanceController.class.php index 9e07c8ac1..e19ce3fd6 100644 --- a/Application/Admin/Controller/FinanceController.class.php +++ b/Application/Admin/Controller/FinanceController.class.php @@ -705,7 +705,9 @@ class FinanceController extends ThinkController $page = $page ? $page : 1; //默认显示第一页数据 $row = $_REQUEST['row'] ?? 10; - $map = []; + $map = [ + "_string" => "1 = 1" + ]; $searchGameIds = null; $game_ids = array_column(getGameByName(I("game_name"), I("sdk_type")), 'id'); @@ -896,14 +898,18 @@ class FinanceController extends ThinkController //统计合计 if (count($exceptIds) > 0) { - if (isset($map['_string'])) { - $map['_string'] .= " and s.game_id not in (" . implode(',', $exceptIds) . ")"; - } else { - $map['_string'] = " s.game_id not in (" . implode(',', $exceptIds) . ")"; + if(IS_SUBSITE){ + $wmtotalMap = $map; + $wmtotalMap['_string'] .= " and s.game_id in (" . implode(',', $exceptIds) . ")"; } + $map['_string'] .= " and s.game_id not in (" . implode(',', $exceptIds) . ")"; } $totalData = D("spend")->totalGameStatistics($map,$searchGameIds); - + if(IS_SUBSITE){ + $wmTotalData = D("spend")->totalWmGameStatistics($wmtotalMap,$searchGameIds); + $aggWmTotal = $wmTotalData['aggwmtotal']??0; + $aggWmFailTotal = $wmTotalData['aggwmfailtotal']??0; + } $sumCash = $totalData['cash_count']; $sumBalance = $totalData['balance_coin_count']; $sumInside = $totalData['inside_cash_count']; diff --git a/Application/Admin/Model/SpendModel.class.php b/Application/Admin/Model/SpendModel.class.php index 842d9a78e..0ce2fb602 100644 --- a/Application/Admin/Model/SpendModel.class.php +++ b/Application/Admin/Model/SpendModel.class.php @@ -947,5 +947,25 @@ class SpendModel extends Model return $data; } + /** + *获取聚合万盟数据 + */ + public function totalWmGameStatistics($map,$gameIds) + { + if($gameIds){ + $map['s.game_id'] = ['in', $gameIds]; + } + $data = M("Spend","tab_") + ->alias('s') + ->index('game_time') + ->field(" + SUM(CASE WHEN pay_game_status = 1 THEN pay_amount ELSE 0 END) as aggwmtotal, + SUM(CASE WHEN pay_game_status = 0 THEN pay_amount ELSE 0 END) as aggwmfailtotal") + ->where(['s.pay_status' => 1]) + ->where($map) + ->find(); + return $data; + } + }