优化充值列表导出

master
chenzhi 4 years ago
parent 29636f2922
commit d08691c13a

@ -1187,12 +1187,8 @@ class ExportController extends Controller
if (I('platform_type', 0) != 0) { if (I('platform_type', 0) != 0) {
$sy = I('platform_type', 0) == 1 ? '=' : '<>'; $sy = I('platform_type', 0) == 1 ? '=' : '<>';
$platformWhere = 'exists (select 1 from tab_game where id = tab_spend.game_id and unique_code ' . $sy . ' "")'; $game_id = M("Game","tab_")->where('unique_code ' . $sy . ' ""')->getField("id",true);
if (isset($map['_string']) && $map['_string']) { $map['game_id'] = ['in',$game_id];
$map['_string'] = $map['_string'] . ' and ' . $platformWhere;
} else {
$map['_string'] = $platformWhere;
}
} }
// if (intval(($endTime + 1) - $startTime) / (24 * 3600) <= 31) { // if (intval(($endTime + 1) - $startTime) / (24 * 3600) <= 31) {
@ -1204,7 +1200,7 @@ class ExportController extends Controller
// } // }
$map1 = $map; $map1 = $map;
$map1['pay_status'] = 1; $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(); // var_dump($total);die();
$total=$total?$total:0; $total=$total?$total:0;
@ -1280,7 +1276,7 @@ class ExportController extends Controller
mb_convert_variables('GBK', 'UTF-8', $xlsCell); mb_convert_variables('GBK', 'UTF-8', $xlsCell);
fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中 fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
$accessNum = D('Spend') $accessNum = SM('Spend')
->where($map) ->where($map)
->count(); ->count();
@ -1289,7 +1285,7 @@ class ExportController extends Controller
// var_dump($count);die(); // var_dump($count);die();
for($i = 1; $i <= $pages; $i++) { for($i = 1; $i <= $pages; $i++) {
$xlsData = D('Spend') $xlsData = SM('Spend')
->field($fields) ->field($fields)
->where($map) ->where($map)
->limit(($i-1)*$perSize ,$perSize) ->limit(($i-1)*$perSize ,$perSize)

@ -80,11 +80,11 @@ class RechargeSumController extends ThinkController
} }
$map['pay_status'] = 1; $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']); 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]['date'] = date('Y-m-d', $start);
$data[$key]['game_id'] = empty($_REQUEST['game_name']) ? "全部" : $_REQUEST['game_name']; $data[$key]['game_id'] = empty($_REQUEST['game_name']) ? "全部" : $_REQUEST['game_name'];

@ -119,12 +119,8 @@ class SpendController extends ThinkController
} }
if (I('platform_type', 0) != 0) { if (I('platform_type', 0) != 0) {
$sy = I('platform_type', 0) == 1 ? '=' : '<>'; $sy = I('platform_type', 0) == 1 ? '=' : '<>';
$platformWhere = 'exists (select 1 from tab_game where id = tab_spend.game_id and unique_code ' . $sy . ' "")'; $game_id = M("Game","tab_")->where('unique_code ' . $sy . ' ""')->getField("id",true);
if (isset($map['_string']) && $map['_string']) { $map['game_id'] = ['in',$game_id];
$map['_string'] = $map['_string'] . ' and ' . $platformWhere;
} else {
$map['_string'] = $platformWhere;
}
} }
// if (intval(($endTime + 1) - $startTime) / (24 * 3600) <= 31) { // if (intval(($endTime + 1) - $startTime) / (24 * 3600) <= 31) {

Loading…
Cancel
Save