From d08691c13a92d5fffed0fda0341c592b858997cf Mon Sep 17 00:00:00 2001 From: chenzhi Date: Thu, 17 Dec 2020 17:47:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=85=85=E5=80=BC=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/ExportController.class.php | 14 +++++--------- .../Controller/RechargeSumController.class.php | 4 ++-- .../Admin/Controller/SpendController.class.php | 8 ++------ 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index fd0f58f99..686cb5a10 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -1187,12 +1187,8 @@ class ExportController extends Controller if (I('platform_type', 0) != 0) { $sy = I('platform_type', 0) == 1 ? '=' : '<>'; - $platformWhere = 'exists (select 1 from tab_game where id = tab_spend.game_id and unique_code ' . $sy . ' "")'; - if (isset($map['_string']) && $map['_string']) { - $map['_string'] = $map['_string'] . ' and ' . $platformWhere; - } else { - $map['_string'] = $platformWhere; - } + $game_id = M("Game","tab_")->where('unique_code ' . $sy . ' ""')->getField("id",true); + $map['game_id'] = ['in',$game_id]; } // if (intval(($endTime + 1) - $startTime) / (24 * 3600) <= 31) { @@ -1204,7 +1200,7 @@ class ExportController extends Controller // } $map1 = $map; $map1['pay_status'] = 1; - $total = M('Spend','tab_')->where($map1)->sum('pay_amount'); + $total = SM('Spend','tab_')->where($map1)->sum('pay_amount'); // var_dump($total);die(); $total=$total?$total:0; @@ -1280,7 +1276,7 @@ class ExportController extends Controller mb_convert_variables('GBK', 'UTF-8', $xlsCell); fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中 - $accessNum = D('Spend') + $accessNum = SM('Spend') ->where($map) ->count(); @@ -1289,7 +1285,7 @@ class ExportController extends Controller // var_dump($count);die(); for($i = 1; $i <= $pages; $i++) { - $xlsData = D('Spend') + $xlsData = SM('Spend') ->field($fields) ->where($map) ->limit(($i-1)*$perSize ,$perSize) diff --git a/Application/Admin/Controller/RechargeSumController.class.php b/Application/Admin/Controller/RechargeSumController.class.php index 05a34ef18..595322480 100644 --- a/Application/Admin/Controller/RechargeSumController.class.php +++ b/Application/Admin/Controller/RechargeSumController.class.php @@ -80,11 +80,11 @@ class RechargeSumController extends ThinkController } $map['pay_status'] = 1; - $newAddPay = D('Spend')->where(array_merge($map, array('_string' => '( small_id = 0 or small_id = user_id)')))->sum('pay_amount'); + $newAddPay = SM('spend',"tab_")->where(array_merge($map, array('_string' => '( small_id = 0 or small_id = user_id)')))->sum('pay_amount'); //当天累计付费 unset($map['user_id']); - $accumulated = D('Spend')->where($map)->sum('pay_amount'); + $accumulated = SM('spend',"tab_")->where($map)->sum('pay_amount'); $data[$key]['date'] = date('Y-m-d', $start); $data[$key]['game_id'] = empty($_REQUEST['game_name']) ? "全部" : $_REQUEST['game_name']; diff --git a/Application/Admin/Controller/SpendController.class.php b/Application/Admin/Controller/SpendController.class.php index 047cf8ba4..21cc11748 100644 --- a/Application/Admin/Controller/SpendController.class.php +++ b/Application/Admin/Controller/SpendController.class.php @@ -119,12 +119,8 @@ class SpendController extends ThinkController } if (I('platform_type', 0) != 0) { $sy = I('platform_type', 0) == 1 ? '=' : '<>'; - $platformWhere = 'exists (select 1 from tab_game where id = tab_spend.game_id and unique_code ' . $sy . ' "")'; - if (isset($map['_string']) && $map['_string']) { - $map['_string'] = $map['_string'] . ' and ' . $platformWhere; - } else { - $map['_string'] = $platformWhere; - } + $game_id = M("Game","tab_")->where('unique_code ' . $sy . ' ""')->getField("id",true); + $map['game_id'] = ['in',$game_id]; } // if (intval(($endTime + 1) - $startTime) / (24 * 3600) <= 31) {