->field('IFNULL(sum(ss.pay_amount),0) AS recharge_total,count(tab_user.id) as count')
$accessNum = $usermodel->table('(' . $sql1 . ') as a ')
->field('IFNULL(sum(ss.pay_amount),0) AS recharge_total,count(a.id) as count')
// ->field($field)
->join('left join tab_spend as ss on ss.user_id=tab_user.id AND ss.pay_status = 1'.$spendprom)
->join($game_map ? "tab_user_play on tab_user_play.user_id = tab_user.id $game_map" : false)
->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = tab_user.id $game_play_map" : false)
->where($map)
->group('tab_user.id')
->join('left join tab_spend as ss on ss.user_id=a.id AND ss.pay_status = 1'.$spendprom)
->join($game_map ? "tab_user_play on tab_user_play.user_id = a.id $game_map" : false)
->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = a.id $game_play_map" : false)
->group('a.id')
->having($havs)
->select(false);
$sql = "select count(t.count) as count from ({$accessNum}) as t ";
$accessNum = M('user', 'tab_')->query($sql);
}else{
$accessNum = M('user', 'tab_')
$accessNum = $usermodel->table('(' . $sql1 . ') as a ')
// ->field('tab_user.id,tab_user.age_status,tab_user.account,tab_user.gold_coin,tab_user.alipay,tab_user.balance,tab_user.promote_account,register_time,tab_user.lock_status,tab_user.register_way,tab_user.register_type,tab_user.register_ip,tab_user.login_time,IFNULL(sum(ss.pay_amount),0) AS recharge_total')
->field('IFNULL(sum(ss.pay_amount),0) AS recharge_total,count(tab_user.id) as count')
->join('left join tab_spend as ss on ss.user_id=tab_user.id AND ss.pay_status = 1')
->join($game_map ? "tab_user_play on tab_user_play.user_id = tab_user.id $game_map" : false)
->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = tab_user.id $game_play_map" : false)
->where($map)
->group('tab_user.id')
->field('IFNULL(sum(ss.pay_amount),0) AS recharge_total,count(a.id) as count')
->join('left join tab_spend as ss on ss.user_id=a.id AND ss.pay_status = 1')
->join($game_map ? "tab_user_play on tab_user_play.user_id = a.id $game_map" : false)
->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = a.id $game_play_map" : false)
->group('a.id')
->having($havs)
->select(false);
@ -388,31 +497,31 @@ class ExportController extends Controller
$xlsData = $usermodel->table('(' . $sql1 . ') as a ')
// ->field('tab_user.id,tab_user.age_status,tab_user.account,tab_user.gold_coin,tab_user.alipay,tab_user.balance,tab_user.promote_account,register_time,tab_user.lock_status,tab_user.register_way,tab_user.register_type,tab_user.register_ip,tab_user.login_time,IFNULL(sum(ss.pay_amount),0) AS recharge_total')
->field($field)
->join('left join tab_spend as ss on ss.user_id=tab_user.id AND ss.pay_status = 1'.$spendprom)
->join($game_map ? "tab_user_play on tab_user_play.user_id = tab_user.id $game_map" : false)
->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = tab_user.id $game_play_map" : false)
->where($map)
->join('left join tab_spend as ss on ss.user_id=a.id AND ss.pay_status = 1'.$spendprom)
->join($game_map ? "tab_user_play on tab_user_play.user_id = a.id $game_map" : false)
->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = a.id $game_play_map" : false)
->limit(($i-1)*$perSize ,$perSize)
->group('tab_user.id')
->group('a.id')
->order($order)
->having($havs)
->select();
}else{
$xlsData = M('user', 'tab_')
$xlsData = $usermodel->table('(' . $sql1 . ') as a ')
// ->field('tab_user.id,tab_user.age_status,tab_user.account,tab_user.gold_coin,tab_user.alipay,tab_user.balance,tab_user.promote_account,register_time,tab_user.lock_status,tab_user.register_way,tab_user.register_type,tab_user.register_ip,tab_user.login_time,IFNULL(sum(ss.pay_amount),0) AS recharge_total')
->field($field)
->join('left join tab_spend as ss on ss.user_id=tab_user.id AND ss.pay_status = 1')
->join($game_map ? "tab_user_play on tab_user_play.user_id = tab_user.id $game_map" : false)
->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = tab_user.id $game_play_map" : false)
->where($map)
->join('left join tab_spend as ss on ss.user_id=a.id AND ss.pay_status = 1')
->join($game_map ? "tab_user_play on tab_user_play.user_id = a.id $game_map" : false)
->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = a.id $game_play_map" : false)
$sql1 = $usermodel->field("{$userField},IFNULL(sum(b.pay_amount),0) as deposit_total")
->join('left join tab_deposit AS b ON tab_user.id = b.user_id AND b.pay_status = 1')
->where($map)
->group('tab_user.id')
->where($hav)
// ->order($order)
->select(false);
// $data = $usermodel->table('(' . $sql1 . ') as a ')->field('a.id,a.device_number,a.age_status,a.account,a.balance,a.gold_coin,a.alipay,a.promote_id,a.register_type,a.promote_account,a.register_time,a.lock_status,a.register_way,a.register_type,a.register_ip,a.login_time,IFNULL(sum(ss.pay_amount),0) as recharge_total,check_status')
// ->join('left join tab_spend as ss on ss.user_id=a.id AND ss.pay_status = 1')