diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 544cd3208..b9b65f66e 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -196,7 +196,7 @@ class ExportController extends Controller } break; case 3: - if($_REQUEST['type']==2){ + if($_REQUEST['type']==2){ // $xlsCell = array( // array('id', L('Account_number_ID')), // array('register_type', L('Third_party_source'), "get_registertype", '*'), @@ -213,15 +213,14 @@ class ExportController extends Controller // array('register_ip', L('Register_iP')), // array('lock_status', L('Account_status'), 'get_info_status', '*', '4'), // ); - $field = 'a.id,a.account,a.id as get_registertype,a.promote_account,a.balance,IFNULL(sum(ss.pay_amount),0) as recharge_total, - a.gold_coin,a.alipay,a.id as small_count,a.id as vip_level,a.register_type - ,a.register_ip,a.login_time,a.device_number,a.lock_status,check_status,a.age_status,a.register_way, - a.register_type'; - $xlsCell = [L('Account_number_ID'),"第三方来源","绑定账号",L('Subordinate_channel'), "账户平台币" - , "累计充值", "金币", "绑定支付宝", "小号", "VIP等级", L('Registration_time'), - L('Register_iP'), "最后登录时间","设备号", L('Account_status'),"拉黑状态"]; -// $map['tab_user.register_type']= ['in','3,4,5,6']; - }else{ + $field = 'tab_user.id,tab_user.register_type,tab_user.account,tab_user.promote_account,tab_user.balance + ,IFNULL(sum(ss.pay_amount),0) AS recharge_total,tab_user.gold_coin,tab_user.alipay,tab_user.id as small_count, + tab_user.id as vip_level,register_time,tab_user.login_time,tab_user.register_ip,tab_user.lock_status, + tab_user.age_status,tab_user.register_way'; + $xlsCell = [L('Account_number_ID'),L('Third_party_source'),"玩家账号",L('Subordinate_channel'), "账户平台币" + , "累计充值", "金币", "绑定支付宝", "小号", "VIP等级", L('Registration_time'), "最后登录时间", L('Register_iP'), L('Account_status')]; + $map['tab_user.register_type']= ['in','3,4,5,6']; + }else{ // $xlsCell = array( // array('id', L('Account_number_ID')), // array('account', "玩家账号"), @@ -238,192 +237,111 @@ class ExportController extends Controller // array('register_ip', L('Register_iP')), // array('lock_status', L('Account_status'), 'get_info_status', '*', '4'), // ); - $field = 'a.id,a.account,a.promote_account,a.balance,IFNULL(sum(ss.pay_amount),0) as recharge_total, - a.gold_coin,a.alipay,a.id as small_count,a.id as vip_level,a.register_type,a.register_time - ,a.register_ip,a.login_time,a.device_number,a.lock_status,check_status,a.age_status,a.register_way, - a.register_type'; - $xlsCell = [L('Account_number_ID'),"玩家账号",L('Subordinate_channel'), "账户平台币" - , "累计充值", "金币", "绑定支付宝", "小号", "VIP等级", "注册方式", L('Registration_time'), - L('Register_iP'), "最后登录时间","设备号", L('Account_status'),"拉黑状态"]; - $map['tab_user.register_type']=['in','1,2']; - $map['tab_user.register_type']=['in','0,1,2,7']; - - } - - $hav = ''; + $field = 'tab_user.id,tab_user.account,tab_user.promote_account,tab_user.balance, + IFNULL(sum(ss.pay_amount),0) AS recharge_total,tab_user.gold_coin,tab_user.alipay + ,tab_user.id as small_count,tab_user.id as vip_level,tab_user.register_type,register_time,tab_user.login_time + ,tab_user.register_ip,tab_user.lock_status,tab_user.age_status,tab_user.register_way'; + $xlsCell = [L('Account_number_ID'),"玩家账号",L('Subordinate_channel'), "账户平台币" + , "累计充值", "金币", "绑定支付宝", "小号", "VIP等级", "注册方式", L('Registration_time'), + "最后登录时间", L('Register_iP'), L('Account_status')]; + $map['tab_user.register_type']=['in','1,2']; + $map['tab_user.register_type']=['in','0,1,2,7']; + + } + + if (isset($_REQUEST['user_id'])) { + $map['tab_user.id'] = $_REQUEST['user_id']; + unset($_REQUEST['user_id']); + } + + if (isset($_REQUEST['device_number'])) { + $map['tab_user.device_number'] = $_REQUEST['device_number']; + unset($_REQUEST['device_number']); + } if ($_REQUEST['promote_id'] != '') { - if ($_REQUEST['promote_id'] == 'UC') { - $maps['tab_user.promote_account'] = 'UC用户'; - $hav .= "tab_user.promote_account = 'UC用户' "; - } else if ($_REQUEST['promote_id'] == 0) { - $maps['tab_user.promote_id'] = 0; - $hav .= "tab_user.promote_id = 0"; - } else { + if($_REQUEST['promote_id']=='UC'){ + $map['tab_user.promote_account'] = 'UC用户'; + } else if ($_REQUEST['promote_id']==0) { + $map['tab_user.promote_id'] = 0; + } else{ $promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select(); if ($promoter_ids) { - $maps['tab_user.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))]; - $hav .= "tab_user.promote_id in (" . implode(',', array_column($promoter_ids, 'id')) . ") "; + $map['tab_user.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))]; $spendprom = " AND ss.promote_id IN (" . implode(',', array_column($promoter_ids, 'id')) . ") "; } } } - if (I('type', 1) == 1) { - if (isset($_GET['register_way'])) { + $game_map = ""; + if (isset($_REQUEST['game_name'])) { + $game_map .= " and tab_user_play.game_id in (".implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')).")"; + } + $game_play_map = ''; + if (isset($_REQUEST['server_name'])) { + $game_play_map .= " and tab_user_play_info.server_name = '{$_REQUEST['server_name']}' "; + } + // if (isset($_REQUEST['promote_account'])) { + // $map['promote_id'] = get_promote_id(trim(I('promote_account'))); + // unset($_REQUEST['promote_account']); + // } + if (isset($_REQUEST['register_way'])) { + if($_REQUEST['type']==1) { if ($_GET['register_way'] == 1) { empty($hav) || $hav .= ' AND '; - $hav .= ' tab_user.register_type in (1)'; - $maps['tab_user.register_type'] = 1; - } elseif ($_GET['register_way'] == 7) { + $hav .= ' tab_user.register_type in (0,1)'; + $maps['tab_user.register_type'] = ['in',[0,1]]; + } elseif($_GET['register_way'] == 7){ empty($hav) || $hav .= ' AND '; $hav .= ' tab_user.register_type in(7)'; $maps['tab_user.register_type'] = 7; - } else { + }else { empty($hav) || $hav .= ' AND '; $hav .= ' tab_user.register_type in(2)'; $maps['tab_user.register_type'] = 2; } } else { - empty($hav) || $hav .= ' AND '; - $hav .= ' tab_user.register_type in (1,2,7)'; - $maps['tab_user.register_type'] = ['in', [1, 2, 7]]; - } - } else { - if (isset($_GET['register_type'])) { - empty($hav) || $hav .= ' AND '; - $hav .= ' tab_user.register_type = ' . $_GET['register_type']; - $maps['tab_user.register_type'] = $_GET['register_type']; - - } else { - empty($hav) || $hav .= ' AND '; - $hav .= ' tab_user.register_type in (0,3,4,5,6)'; - $maps['tab_user.register_type'] = ['in', [0, 3, 4, 5, 6]]; - } - } - if (isset($_REQUEST['user_id'])) { - empty($hav) || $hav .= ' AND '; - $hav .= "tab_user.id = '{$_REQUEST['user_id']}'"; - $maps['tab_user.id'] = $_REQUEST['user_id']; - unset($_REQUEST['user_id']); - } - if (isset($_REQUEST['account'])) { - empty($hav) || $hav .= ' AND '; - $hav .= "tab_user.account like '%" . I('account') . "%'"; - $maps['tab_user.account'] = ['like', "%" . I('account') . "%"]; - unset($_REQUEST['account']); - } - if (isset($_REQUEST['device_number'])) { - empty($hav) || $hav .= ' AND '; - $hav .= "tab_user.device_number = '{$_REQUEST['device_number']}'"; - $maps['tab_user.device_number'] = $_REQUEST['device_number']; - unset($_REQUEST['device_number']); - } - if (isset($_REQUEST['age_status'])) { - empty($hav) || $hav .= ' AND '; - $hav .= 'tab_user.age_status =' . I('age_status'); - $maps['tab_user.age_status'] = I('age_status'); - unset($_REQUEST['age_status']); - } - if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) { - empty($hav) || $hav .= ' AND '; - $hav .= 'tab_user.register_time BETWEEN ' . strtotime(I('time_start')) . ' AND ' . (strtotime(I('time_end')) + 24 * 60 * 60 - 1); - $maps['tab_user.register_time'] = ['between', [strtotime(I('time_start')), strtotime(I('time_end')) + 86399]]; - unset($_REQUEST['time_start']); - unset($_REQUEST['time_end']); - } elseif (isset($_REQUEST['time_start'])) { - empty($hav) || $hav .= ' AND '; - $hav .= 'tab_user.register_time > ' . strtotime(I('time_start')); - $maps['tab_user.register_time'] = ['GT', strtotime(I('time_start'))]; - unset($_REQUEST['time_start']); - } elseif (isset($_REQUEST['time_end'])) { - empty($hav) || $hav .= ' AND '; - $hav .= 'tab_user.register_time < ' . (strtotime(I('time_end')) + 86399); - $maps['tab_user.register_time'] = ['LT', strtotime(I('time_end')) + 86399]; - unset($_REQUEST['time_end']); - } - if (isset($_REQUEST['start']) && isset($_REQUEST['end'])) { - empty($hav) || $hav .= ' AND '; - $hav .= 'tab_user.register_time BETWEEN ' . strtotime(I('start')) . ' AND ' . strtotime(I('end')); - $maps['tab_user.register_time'] = array('between', [strtotime(I('start')), strtotime(I('end'))]); - unset($_REQUEST['start']); - unset($_REQUEST['end']); + $map['register_way'] = I('register_way'); + unset($_REQUEST['register_way']); + } } - if (!empty(I('line_day'))) { - $day = strtotime(date('Y-m-d')) - intval(I('line_day')) * 86400; - empty($hav) || $hav .= ' AND '; - $hav .= $day . '> tab_user.login_time'; - $maps['tab_user.login_time'] = ['lt', $day]; + if (isset($_REQUEST['register_type'])) { + $map['register_type'] = I('register_type'); + unset($_REQUEST['register_type']); } if (isset($_REQUEST['status'])) { - $map['lock_status'] = $_REQUEST['status']; + $map['lock_status'] = I('status'); unset($_REQUEST['status']); } - - - // if (isset($_REQUEST['game_name'])) { - // //$game_map .= " and tab_user_play.game_id in (" . implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) . ")"; - // } - - $game_map = ""; - -// $game_map .= " and tab_user_play.game_id in (" . implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) . ")"; - - if (!empty($_REQUEST['game_name']) || !empty($_REQUEST['game_type'])) { - $game_map .= " and tab_user_play.game_id in (" . implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) . ")"; - } - - $spendprom = " and ss.game_id in (".implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')).")"; - if (isset($_REQUEST['server_name'])) { - $map['server_name'] = ['like', "{$_REQUEST['server_name']}%"]; + if (!empty(I('time_start')) && !empty(I('time_end'))) { + $map['register_time'] = array('BETWEEN', array(strtotime(I('get.time_start')), strtotime(I('time_end')) + 24 * 60 * 60 - 1)); + unset($_REQUEST['time_start']); + unset($_REQUEST['time_end']); } - $game_play_map = ''; - if (isset($_REQUEST['server_name'])) { - $game_play_map .= " and tab_user_play_info.server_name = '{$_REQUEST['server_name']}' "; + empty(I('account')) || $map['account'] = ['like', '%' . I('account') . '%']; + //排序 + if (I('total_status') == 1) { + $order = 'cumulative asc'; + } elseif (I('total_status') == 2) { + $order = 'cumulative desc'; + } else { + $order = 'id desc'; } - if (isset($_REQUEST['viplevel'])) { - $havs = get_vip_level_limit('recharge_total', $_REQUEST['viplevel']); + $havs = get_vip_level_limit('recharge_total',$_REQUEST['viplevel']); } - //排序 - $order = ''; - if (I('key') == 1) { - if (I('balance_status') == 1) { - $order = 'balance,'; - } elseif (I('balance_status') == 2) { - $order = 'balance desc,'; - } - } else { - if (I('recharge_status') == 1) { - $order .= 'recharge_total,'; - } elseif (I('recharge_status') == 2) { - $order .= 'recharge_total desc,'; - } - } - $order .= 'a.id desc'; - - $user = M('user', 'tab_'); - $map['puid'] = array('eq', 0); + $map['puid'] = array('eq',0); $map['is_platform'] = 0; - $usermodel = M('user', 'tab_'); - $sql1 = $usermodel->field('tab_user.*,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); - set_time_limit(0); // $columns = [ // '序号ID', '姓名', '电话', // ]; -// $fileName = '导出.xlsx'; + $fileName = '导出.xlsx'; $csvFileName = $xlsName.'.csv'; //设置好告诉浏览器要下载excel文件的headers header('Content-Description: File Transfer'); @@ -437,57 +355,68 @@ class ExportController extends Controller fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中 $accessNum = '100000';//从数据库获取总量,假设是十万 - - - //计数 - $sql = M('user', 'tab_')->field('tab_user.id,IFNULL(sum(ss.pay_amount),0) AS recharge_total') - ->join('left join tab_spend as ss on ss.user_id=tab_user.id AND ss.pay_status = 1'.$spendprom) - ->where($map) - ->group('tab_user.id') - ->where($hav) - ->having($havs)->select(false); - - //替换为新表 if($_REQUEST['promote_id'] && $_REQUEST['promote_id'] > -1){ - $sql = M('user', 'tab_')->field('tab_user.id,IFNULL(sum(ss.pay_amount),0) AS recharge_total') - ->join('left join tab_spend as ss on ss.user_id=tab_user.id AND ss.pay_status = 1'.$spendprom) + $accessNum = M('user', 'tab_') + ->field('IFNULL(sum(ss.pay_amount),0) AS recharge_total,count(tab_user.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') - ->where($hav) - ->having($havs)->select(false); - } + ->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_') +// ->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') + ->having($havs) + ->select(false); - $jcount = M('User', 'tab_')->field('count(a.id) as count,sum(a.recharge_total) recharge_total')->table('(' . $sql . ') as a')->select(); - $accessNum = $jcount[0]['count'] ?:0 ; + $sql = "select count(t.count) as count from ({$accessNum}) as t "; + $accessNum = M('user', 'tab_')->query($sql); + } + $accessNum = $accessNum[0]['count']; $perSize = 5000;//每次查询的条数 $pages = ceil($accessNum / $perSize); - + $lastId = 0; for($i = 1; $i <= $pages; $i++) { if($_REQUEST['promote_id'] && $_REQUEST['promote_id'] > -1){ - $xlsData = $usermodel->table('(' . $sql1 . ') as a ')->field($field) - ->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) + $xlsData = M('user', 'tab_') +// ->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) ->limit(($i-1)*$perSize ,$perSize) - ->having($havs) - ->group('a.id') + ->group('tab_user.id') ->order($order) + ->having($havs) ->select(); - // echo $data;die(); }else{ - $xlsData = $usermodel->table('(' . $sql1 . ') as a ')->field($field) - ->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) + $xlsData = M('user', 'tab_') +// ->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) ->limit(($i-1)*$perSize ,$perSize) - ->having($havs) - ->group('a.id') + ->group('tab_user.id') ->order($order) + ->having($havs) ->select(); } -// echo $usermodel->_sql();die(); //数据 @@ -505,17 +434,10 @@ class ExportController extends Controller if(empty($v['alipay'])){ $xlsData[$k]['alipay'] = '--'; } - if($_REQUEST['type']==2){ - $xlsData[$k]['register_type'] = get_registertype($v['register_type']); - } - if ($_REQUEST['type']!=2) { - $xlsData[$k]['register_time'] = date('Y-m-d H:i:s',$xlsData[$k]['register_time']); - } + $xlsData[$k]['register_time'] = date('Y-m-d H:i:s',$xlsData[$k]['register_time']); $xlsData[$k]['login_time'] = date('Y-m-d H:i:s',$xlsData[$k]['login_time']); $xlsData[$k]['lock_status'] = $xlsData[$k]['lock_status']==1?'正常':'锁定'; - $xlsData[$k]['check_status'] = $xlsData[$k]['check_status']==1?'正常':'已拉黑'; - $xlsData[$k]['device_number'] = $xlsData[$k]['device_number']."'"; $xlsData[$k]['register_type'] = $v['register_type'] == 2?'手机号':($v['register_type']==7?'邮箱':'账号'); @@ -532,17 +454,15 @@ class ExportController extends Controller } unset($xlsData[$k]['age_status']); unset($xlsData[$k]['register_way']); - mb_convert_variables('GBK', 'UTF-8', $v); - fputcsv($fp, $v); } } -// foreach($xlsData as $value) { -// mb_convert_variables('GBK', 'UTF-8', $value); -// fputcsv($fp, $value); -// $lastId = $value['id']; -// } + foreach($xlsData as $value) { + mb_convert_variables('GBK', 'UTF-8', $value); + fputcsv($fp, $value); + $lastId = $value['id']; + } unset($xlsData);//释放变量的内存 //刷新输出缓冲到浏览器 ob_flush(); @@ -1725,11 +1645,18 @@ class ExportController extends Controller $arraypage=$page; $row = 10; $user=M('User','tab_'); - $map['fgame_id']=array('gt',0);$map['puid'] = 0; + $map['fgame_id']=array('egt',0);$map['puid'] = 0; if(isset($_REQUEST['timestart'])&&isset($_REQUEST['timeend'])){ $map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+24*60*60-1)); unset($_REQUEST['timestart']);unset($_REQUEST['timeend']); + } elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) { + $map['register_time'] = ['between', array(strtotime($_REQUEST['timestart']), time())]; + unset($_REQUEST['timestart']); + } elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { + $map['register_time'] = ['elt', strtotime($_REQUEST['timeend']) + 86399]; + unset($_REQUEST['timeend']); } + if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){ $map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1)); unset($_REQUEST['start']);unset($_REQUEST['end']); @@ -1748,13 +1675,18 @@ class ExportController extends Controller count(IF(register_time '.$mounth.',1,null)) as mounth') ->where($map) ->group('fgame_id') - ->order('count desc') + ->order('count desc,register_time') ->select(); + $count=count($data); foreach ($data as $key => $value) { static $i=0; $i++; $data[$key]['rand']=$i; + + if ($data[$key]['fgame_id'] == 0) { + $data[$key]['fgame_name'] = '其他注册'; + } } $total=A('Platform')->data_total($data); if($_REQUEST['data_order']!=''){ @@ -1767,7 +1699,7 @@ class ExportController extends Controller $size=$row;//每页显示的记录数 $pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数 //用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度) - $data = array_slice($data, ($arraypage-1)*$size, $size); +// $data = array_slice($data, ($arraypage-1)*$size, $size); $length = count($data); $data[$length] = array( 'fgame_name'=>'汇总', @@ -1846,7 +1778,7 @@ class ExportController extends Controller $size=$row;//每页显示的记录数 $pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数 //用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度) - $data = array_slice($data, ($arraypage-1)*$size, $size); +// $data = array_slice($data, ($arraypage-1)*$size, $size); $length = count($data); $data[$length] = array( 'game_name'=>'汇总', @@ -2046,11 +1978,18 @@ class ExportController extends Controller if(isset($_REQUEST['timestart'])&&isset($_REQUEST['timeend'])){ $map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+24*60*60-1)); unset($_REQUEST['timestart']);unset($_REQUEST['timeend']); + } elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) { + $map['register_time'] = ['between', array(strtotime($_REQUEST['timestart']), time())]; + unset($_REQUEST['timestart']); + } elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { + $map['register_time'] = ['elt', strtotime($_REQUEST['timeend']) + 86399]; + unset($_REQUEST['timeend']); } - if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){ - $map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1)); - unset($_REQUEST['start']);unset($_REQUEST['end']); - } + +// if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){ +// $map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1)); +// unset($_REQUEST['start']);unset($_REQUEST['end']); +// } $play_info_map = ''; if (isset($_REQUEST['game_name'])) { @@ -2070,28 +2009,51 @@ class ExportController extends Controller $map['tp1.chain'] = '/'; } - $data = M('promote', 'tab_')->alias('tp1')->field('tp1.account as promote_account,tp1.id as promote_id, date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(u.id) as count, + $data = M('promote', 'tab_')->alias('tp1')->field('tp1.account as promote_account,tp1.id, date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(u.id) as count, count(IF(register_time ' . $today . ',1,null)) as today, count(IF(register_time ' . $week . ',1,null)) as week, count(IF(register_time ' . $mounth . ',1,null)) as mounth') - ->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%')", 'left') + ->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left') ->join("tab_user as u on tp2.id = u.promote_id", 'left') ->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false) ->where($map) ->group('tp1.id') ->order('count desc, register_time') ->select(); + unset($map['tp1.id']); + unset($map['tp1.chain']); + $map['promote_id'] = 0; + //官方渠道数据添加 + $authorityData = M('user', 'tab_')->field('date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(id) as count, + count(IF(register_time ' . $today . ',1,null)) as today, + count(IF(register_time ' . $week . ',1,null)) as week, + count(IF(register_time ' . $mounth . ',1,null)) as mounth') + ->where($map) + ->find(); + $authorityData['promote_account'] = "官方渠道"; + $authorityData['id'] = "1"; + if (isset($_REQUEST['promote_id'])||$authorityData['count']==0) { + $authorityData = []; + } else { + array_push($data, $authorityData); + } + +//数据排序 + $last_names = array_column($data,'count'); + array_multisort($last_names,SORT_DESC,$data); +// var_dump($data);die(); + $count=count($data); foreach ($data as $key => $value) { static $i=0; $i++; $data[$key]['rand']=$i; } - foreach ($data as $key => $value) { - if($data[$key]['promote_id']==0){ - unset($data[$key]); - } - } +// foreach ($data as $key => $value) { +// if($data[$key]['promote_id']==0){ +// unset($data[$key]); +// } +// } $total=A('Platform')->data_total($data); if($_REQUEST['data_order']!=''){ @@ -2107,24 +2069,27 @@ class ExportController extends Controller } $data=my_sort($data,$data_order_type,(int)$data_order); $size=$row;//每页显示的记录数 + $pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数 //用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度) - $data = array_slice($data, ($arraypage-1)*$size, $size); +// $data = array_slice($data, ($arraypage-1)*$size, $size); $xlsName = $_REQUEST['xlsname']?$_REQUEST['xlsname']:'推广员注册统计'; $xlsCell = array( - array('promote_id', "推广员账号"), + array('promote_account', "推广员账号"), array('count' , "累计注册"), array('rand' , "排行榜"), array('today' , "今日注册"), array('week' , "本周注册"), array('mounth' , "本月注册"), ); - foreach ($data as $key => $value) { - $data[$key]['promote_id'] = get_promote_account($data[$key]['promote_id']); - } +// foreach ($data as $key => $value) { +// $data[$key]['promote_id'] = get_promote_account($data[$key]['promote_id']); +// } +// var_dump($data);die(); + $length = count($data); $data[$length] = array( - 'promote_id'=>'汇总', + 'promote_account'=>'汇总', 'count'=>$total['sum_count'], 'rand'=>'---', 'today'=>$total['sum_today'], @@ -2132,6 +2097,7 @@ class ExportController extends Controller 'mounth'=>$total['sum_mounth'] ); $xlsData = $data; +// var_dump($xlsData);die(); $this->exportExcel($xlsName, $xlsCell, $xlsData); } @@ -2145,7 +2111,18 @@ class ExportController extends Controller if(isset($_REQUEST['timestart'])&&isset($_REQUEST['timeend'])){ $map['pay_time'] =array('BETWEEN',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+24*60*60-1)); unset($_REQUEST['timestart']);unset($_REQUEST['timeend']); + } elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) { + $map['create_time'] = ['between', array(strtotime($_REQUEST['timestart']), time())]; + $pay_time = " between " . strtotime($_REQUEST['timestart']) . " and " . time() . " "; + unset($_REQUEST['timestart']); + } elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { + $map['create_time'] = ['elt', strtotime($_REQUEST['timeend']) + 86399]; + $pay_time = " between 0 and " . (strtotime($_REQUEST['timeend']) + 86399) . " "; + unset($_REQUEST['timeend']); + } else { + $pay_time = " between 0 and " . time(); } + if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){ $map['pay_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1)); unset($_REQUEST['start']);unset($_REQUEST['end']); @@ -2155,82 +2132,82 @@ class ExportController extends Controller // unset($_REQUEST['promote_id']); // } $map1['pay_status'] = $map['pay_status']=1; - $map1['pay_way'] = $map['pay_way'] = array('gt', 0); +// $map1['pay_way'] = $map['pay_way'] = array('gt', 0); $today=total(1); $week=total(2); $mounth=total(3); - $map1['pay_way'] = $map['pay_way'] = array('gt',0); - $bindrecharge_data = M('bind_recharge','tab_') - ->field('max(id) as id,promote_account,promote_id,create_time as ordertime,date_format(FROM_UNIXTIME(create_time),"%Y-%m-%d") AS time, sum(real_amount) as count, - sum(IF(create_time '.$today.',real_amount,0)) as today, - sum(IF(create_time '.$week.',real_amount,0)) as week, - sum(IF(create_time '.$mounth.',real_amount,0)) as mounth') - ->where($map1) - ->group('promote_id') - ->select(false); - - $deposit_data = M('deposit','tab_') - ->field('max(id) as id,promote_account,promote_id,create_time as ordertime,date_format(FROM_UNIXTIME(create_time),"%Y-%m-%d") AS time, sum(pay_amount) as count, - sum(IF(create_time '.$today.',pay_amount,0)) as today, - sum(IF(create_time '.$week.',pay_amount,0)) as week, - sum(IF(create_time '.$mounth.',pay_amount,0)) as mounth') - ->where($map1) - ->group('promote_id') - ->select(false); - if(isset($_REQUEST['game_name'])){ - $map['game_name'] = $_REQUEST['game_name']; - if(isset($_REQUEST['server_id'])){ - $map['server_name'] = $_REQUEST['server_id']; - unset($_REQUEST['server_id']); - } - $data=$spend - ->field('max(id) as id,promote_account,promote_id,pay_time as ordertime,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time, sum(pay_amount) as count, - sum(IF(pay_time '.$today.',pay_amount,0)) as today, - sum(IF(pay_time '.$week.',pay_amount,0)) as week, - sum(IF(pay_time '.$mounth.',pay_amount,0)) as mounth') - ->where($map) - ->group('promote_id') - ->select(false); - }else{ - $data=$spend - ->field('max(id) as id,promote_account,promote_id,pay_time as ordertime,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time, sum(pay_amount) as count, - sum(IF(pay_time '.$today.',pay_amount,0)) as today, - sum(IF(pay_time '.$week.',pay_amount,0)) as week, - sum(IF(pay_time '.$mounth.',pay_amount,0)) as mounth') - ->where($map) - ->union(' ('.$bindrecharge_data.') ') - ->union(' ('.$deposit_data.') ') - ->group('promote_id') - ->select(false); - } - $promote_map = "tp1.`chain` = '/'"; + unset( $map['create_time']); + + //获取所有会长 + $promote_map = "`chain` = '/'"; if (isset($_REQUEST['promote_id'])) { - $promote_map = "tp1.`id` = {$_REQUEST['promote_id']}"; - unset($_REQUEST['promote_id']); + $promote_map = "`chain` = '%/{$_REQUEST['promote_id']}/%' OR id = {$_REQUEST['promote_id']}"; } - $data = $spend->field('t.pid as promote_id,t.promote_account,sum(a.count) AS count,sum(a.today) AS today,sum(a. WEEK) AS WEEK,sum(a.mounth) AS mounth') - ->join("INNER JOIN (SELECT tp2.*, tp1.id AS pid, tp1.account as promote_account FROM tab_promote tp1 LEFT JOIN tab_promote tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') where $promote_map ) AS t ON promote_id = t.id") - ->where($condition)->table('(' . $data . ') as a')->group('t.pid')->order('count desc,a.ordertime')->select(); - $count=count($data); - foreach ($data as $key => $value) { - static $i=0; - $i++; - $data[$key]['rand']=$i; - if($data[$key]['promote_id']=='0'){ - unset($data[$key]); + + $promote = M("promote","tab_")->field("id,account")->page($page,$row)->where($promote_map)->select(); + $pcount = M("promote","tab_")->field("count(*) acount")->where($promote_map)->find()['acount']; + + // var_dump( $promote); + $data =array(); + for ($i=0; $i < count($promote); $i++) { + # code... + $proid = M("promote","tab_")->field("id")->where("`chain` like '%/{$promote[$i]['id']}/%'")->select(); + $str = ''; + for($k=0; $kfield(' + floor(sum(IF(pay_time ' . $pay_time . ',pay_amount,0))*100) as count, + floor(sum(IF(pay_time ' . $today . ',pay_amount,0))*100) as today, + floor(sum(IF(pay_time ' . $week . ',pay_amount,0))*100) as week, + floor(sum(IF(pay_time ' . $mounth . ',pay_amount,0))*100) as mounth') + ->where($map) + ->where("pay_time".$pay_time) + ->find(); + $dbdata['promote_account'] = $promote[$i]['account']; + $dbdata['promote_id'] = $promote[$i]['id']; + } else { + $dbdata = $spend + ->field(' + floor(sum(IF(pay_time ' . $pay_time . ',pay_amount,0))*100) as count, + floor(sum(IF(pay_time ' . $today . ',pay_amount,0))*100) as today, + floor(sum(IF(pay_time ' . $week . ',pay_amount,0))*100) as week, + floor(sum(IF(pay_time ' . $mounth . ',pay_amount,0))*100) as mounth') + ->where($map) + ->where("pay_time".$pay_time) + ->find(); + $dbdata['promote_account'] = $promote[$i]['account']; + $dbdata['promote_id'] = $promote[$i]['id']; } + $data[] = $dbdata; } - $total=A('Platform')->data_total($data); - if($_REQUEST['data_order']!=''){ - $data_order=reset(explode(',',$_REQUEST['data_order'])); - $data_order_type=end(explode(',',$_REQUEST['data_order'])); + $count = count($data); + foreach ($data as $key => $value) { + $value['count'] ?: 0; + $value['today'] ?: 0; + $value['week'] ?: 0; + $value['mounth'] ?: 0; + static $i = 0; + $i++; + $data[$key]['rand'] = $i; + $data[$key]['count'] = $value['count'] / 100; + $data[$key]['today'] = $value['today'] / 100; + $data[$key]['week'] = $value['week'] / 100; + $data[$key]['mounth'] = $value['mounth'] / 100; } - $data=my_sort($data,$data_order_type,(int)$data_order); - $size=$row;//每页显示的记录数 - $pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数 - //用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度) - $data = array_slice($data, ($arraypage-1)*$size, $size); + $total = $this->data_total($data); + $xlsName = $_REQUEST['xlsname']?$_REQUEST['xlsname']:'推广员充值统计'; $xlsCell = array( array('promote_id', "推广员账号"), @@ -2256,6 +2233,15 @@ class ExportController extends Controller $this->exportExcel($xlsName, $xlsCell, $xlsData); } + public function data_total($data) + { + $total['sum_count'] = array_sum(array_column($data, 'count')); + $total['sum_today'] = array_sum(array_column($data, 'today')); + $total['sum_week'] = array_sum(array_column($data, 'week')); + $total['sum_mounth'] = array_sum(array_column($data, 'mounth')); + return $total; + } + public function userretention_export($p = 0) { $request=$_REQUEST; diff --git a/Application/Admin/Controller/IndexController.class.php b/Application/Admin/Controller/IndexController.class.php index 1cbe5477d..be83e75d0 100644 --- a/Application/Admin/Controller/IndexController.class.php +++ b/Application/Admin/Controller/IndexController.class.php @@ -60,6 +60,21 @@ class IndexController extends AdminController { //累计统计 $this->display(); } + /** + * 速度测试 + * + * @param [type] $num + * @return void + */ + public function test($start,$end) + { + set_time_limit(0); + $t1 = microtime(true); + $this->foldLineDiagram($start,$end,1,true); + $t2 = microtime(true); + echo ("success runtime:".round($t2-$t1,3).'s'.PHP_EOL); + # code... + } /* * 今日折线图 */ diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 3eda0922f..f7424d0c0 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -100,7 +100,8 @@ unset($_REQUEST['parent_id']); } } - $promote = D(self::model_name)->field('id,account')->where(['oa_associated' => 0])->order('id DESC')->select(); + // $promote = D(self::model_name)->field('id,account')->where(['oa_associated' => 0])->order('id DESC')->select(); //只获取之前未关联 + $promote = D(self::model_name)->field('id,account')->order('id DESC')->select(); //全部重新获取 $oa_data = array_column($oa_data, 'platform_account'); foreach($promote as $k => $v) { $v['account'] = trim($v['account']); @@ -115,10 +116,10 @@ unset($_REQUEST['parent_id']); if(I('oa_associated',-1) == -1) { foreach($list_data as $k => $v) { - $list_data[$k]['account'] = trim($v['account']); - if($v['oa_associated'] != 1) { - $oa_data[] = $list_data[$k]['account']; - } + // $list_data[$k]['account'] = trim($v['account']); + // if($v['oa_associated'] != 1) { + $oa_data[] = trim($v['account']); + // } } if(!empty($oa_data)) { diff --git a/Application/Admin/Controller/access_data_foldline.txt b/Application/Admin/Controller/access_data_foldline.txt index 248024757..18f7fceb5 100644 --- a/Application/Admin/Controller/access_data_foldline.txt +++ b/Application/Admin/Controller/access_data_foldline.txt @@ -1 +1 @@ -{"news":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":2},{"time":"20:00","count":1},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"sum":{"news":3,"active":4,"player":0,"money":0},"active":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":3},{"time":"20:00","count":1},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"player":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"money":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}]} \ No newline at end of file +{"news":[{"time":"0:00","count":6},{"time":"1:00","count":9},{"time":"2:00","count":7},{"time":"3:00","count":11},{"time":"4:00","count":16},{"time":"5:00","count":7},{"time":"6:00","count":9},{"time":"7:00","count":11},{"time":"8:00","count":14},{"time":"9:00","count":40},{"time":"10:00","count":58},{"time":"11:00","count":86},{"time":"12:00","count":41},{"time":"13:00","count":55},{"time":"14:00","count":194},{"time":"15:00","count":180},{"time":"16:00","count":121},{"time":"17:00","count":98},{"time":"18:00","count":120},{"time":"19:00","count":147},{"time":"20:00","count":146},{"time":"21:00","count":124},{"time":"22:00","count":93},{"time":"23:00","count":56}],"sum":{"news":1649,"active":8210,"player":1715,"money":226618},"active":[{"time":"0:00","count":967},{"time":"1:00","count":343},{"time":"2:00","count":176},{"time":"3:00","count":135},{"time":"4:00","count":118},{"time":"5:00","count":177},{"time":"6:00","count":465},{"time":"7:00","count":661},{"time":"8:00","count":622},{"time":"9:00","count":547},{"time":"10:00","count":480},{"time":"11:00","count":414},{"time":"12:00","count":326},{"time":"13:00","count":237},{"time":"14:00","count":354},{"time":"15:00","count":328},{"time":"16:00","count":215},{"time":"17:00","count":219},{"time":"18:00","count":256},{"time":"19:00","count":335},{"time":"20:00","count":274},{"time":"21:00","count":244},{"time":"22:00","count":197},{"time":"23:00","count":120}],"player":[{"time":"0:00","count":211},{"time":"1:00","count":84},{"time":"2:00","count":29},{"time":"3:00","count":25},{"time":"4:00","count":16},{"time":"5:00","count":24},{"time":"6:00","count":32},{"time":"7:00","count":56},{"time":"8:00","count":71},{"time":"9:00","count":66},{"time":"10:00","count":63},{"time":"11:00","count":69},{"time":"12:00","count":58},{"time":"13:00","count":62},{"time":"14:00","count":50},{"time":"15:00","count":99},{"time":"16:00","count":68},{"time":"17:00","count":61},{"time":"18:00","count":77},{"time":"19:00","count":157},{"time":"20:00","count":107},{"time":"21:00","count":101},{"time":"22:00","count":74},{"time":"23:00","count":55}],"money":[{"time":"0:00","count":"31554.00"},{"time":"1:00","count":"4117.00"},{"time":"2:00","count":"1839.00"},{"time":"3:00","count":"4513.00"},{"time":"4:00","count":"1008.00"},{"time":"5:00","count":"1981.00"},{"time":"6:00","count":"1270.00"},{"time":"7:00","count":"1906.00"},{"time":"8:00","count":"6683.00"},{"time":"9:00","count":"6119.00"},{"time":"10:00","count":"8974.00"},{"time":"11:00","count":"14147.00"},{"time":"12:00","count":"9775.00"},{"time":"13:00","count":"11908.00"},{"time":"14:00","count":"6781.00"},{"time":"15:00","count":"12626.00"},{"time":"16:00","count":"6742.00"},{"time":"17:00","count":"8303.00"},{"time":"18:00","count":"8804.00"},{"time":"19:00","count":"23476.00"},{"time":"20:00","count":"17464.00"},{"time":"21:00","count":"16899.00"},{"time":"22:00","count":"13143.00"},{"time":"23:00","count":"6586.00"}]} \ No newline at end of file diff --git a/Application/Admin/View/User/rolelist.html b/Application/Admin/View/User/rolelist.html index bad81eab1..e565a8218 100644 --- a/Application/Admin/View/User/rolelist.html +++ b/Application/Admin/View/User/rolelist.html @@ -279,23 +279,30 @@ $(".select_gallery").select2(); }) }); $("#promote_level").change(); - var game_server = "{:I('server_name')}"; + var game_id = "{:I('server_id')}"; $("#game_type").change(function(){ - $.ajax({ - url:"{:U('Ajax/getGmeServer')}", - type:"post", - data:{sdk_version:$("#game_type option:selected").val(), game_name:$("#game_name option:selected").val()}, - dataType:'json', - success:function(data){ - str = ""; - for (var i in data){ - str += "" + var game_name = $("#game_name option:selected").val(); + if(game_name != ''){ + $.ajax({ + url:"{:U('Ajax/getGmeServer')}", + type:"post", + data:{sdk_version:$("#game_type option:selected").val(), game_name:$("#game_name option:selected").val()}, + dataType:'json', + success:function(data){ + str = ""; + for (var i in data){ + str += "" + } + $("#server_id").empty(); + $("#server_id").append(str); + $("#server_id").select2(); } - $("#server_name").empty(); - $("#server_name").append(str); - $("#server_name").select2(); - } - }) + }) + }else{ + $("#server_id").html(""); + $("#server_id").append(""); + } + }); $("#game_name").change(function(){ diff --git a/Application/Home/Controller/CoinOrderController.class.php b/Application/Home/Controller/CoinOrderController.class.php index 16a086223..652bb5556 100644 --- a/Application/Home/Controller/CoinOrderController.class.php +++ b/Application/Home/Controller/CoinOrderController.class.php @@ -10,6 +10,7 @@ use QRcode; */ class CoinOrderController extends BaseController { + const LV = 2;//平台币充值手续费 public function page_show($model,$map,$p=1) { if (isset($_REQUEST['row'])) { @@ -89,7 +90,7 @@ class CoinOrderController extends BaseController //创建订单 public function order_add(){ - + $status = promoteCan(session('promote_auth.pid'), function($level) { if ($level == 1) { return true; @@ -104,7 +105,7 @@ class CoinOrderController extends BaseController $this->error('无权限操作'); } } - + $this->assign("LV",self::LV); if(IS_POST){ SafeFilter($_POST); $coin_num = I("coin_num"); @@ -122,7 +123,7 @@ class CoinOrderController extends BaseController $data['create_time'] = time(); $data['discount'] = "0"; if($pay_type==1){ // 在线转账 - $free = sprintf("%.2f",$coin_num*(0.2/100)); + $free = sprintf("%.2f",$coin_num*(self::LV/100)); $free = $free<'0.1' ? '0.1':$free; $data['pay_amount'] = bcadd($coin_num,$free,2); $data['order_status'] = 0; diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index 22d8a87ac..43de91eaa 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -1295,13 +1295,14 @@ class DownloadController extends BaseController { $map = ['promote_id' => ['in', $ids]]; $subMap = ['promote_id' => ['in', $ids]]; - if ($gameId != 0) { - $gameMap['relation_game_id'] = $gameId; + if ($gameId != 0 || $sdkVersion != 0) { + if ($gameId != 0) { + $gameMap['relation_game_id'] = $gameId; + } if ($sdkVersion != 0) { $gameMap['sdk_version'] = $sdkVersion; } $gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true); - $map['game_id'] = ['in', $gameId1]; $subMap['game_id'] = ['in', $gameId1]; } @@ -1416,22 +1417,24 @@ class DownloadController extends BaseController { $map['parentsinfo'] = json_encode($parent,FALSE);; $map['currentDisplay'] = $currentDisplay; $map['ids'] = $ids; - if ($gameId > 0) { - $gameMap['relation_game_id'] = $gameId; - if ($sdkVersion > 0) { + if ($gameId != 0 || $sdkVersion != 0) { + if ($gameId != 0) { + $gameMap['relation_game_id'] = $gameId; + } + if ($sdkVersion != 0) { $gameMap['sdk_version'] = $sdkVersion; } $gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true); - $params['game_id'] = ['in', $gameId1]; + $map['game_id'] = ['in', $gameId1]; } if ($serverId > 0) { - $params['server_id'] = $serverId; + $map['server_id'] = $serverId; } if ($sdkVersion > 0) { - $params['sdk_version'] = $sdkVersion; + $map['sdk_version'] = $sdkVersion; } if ($status > 0) { - $params['lock_status'] = $status; + $map['lock_status'] = $status; } list($beginTime, $endTime) = $this->getBetweenTime($time); $map['begin_time'] = $beginTime; @@ -1513,9 +1516,10 @@ class DownloadController extends BaseController { $map['_string'] = '1<>1'; } - - if ($gameId != 0) { - $gameMap['relation_game_id'] = $gameId; + if ($gameId != 0 || $sdkVersion != 0) { + if ($gameId != 0) { + $gameMap['relation_game_id'] = $gameId; + } if ($sdkVersion != 0) { $gameMap['sdk_version'] = $sdkVersion; } @@ -1633,7 +1637,7 @@ class DownloadController extends BaseController { array_push($ids,PID); } - array_push($ids,$queryPromote['id']); + // array_push($ids,$queryPromote['id']); if (!empty($ids)) { $map['tab_apply.promote_id'] = ['in',$ids]; @@ -1661,7 +1665,7 @@ class DownloadController extends BaseController { $map["apply_time"] = ["between",[strtotime($begtime1),strtotime($endtime1)]]; } if(!empty($begtime) && !empty($endtime)) { - $map["apply_time"] = ["between",[strtotime($begtime),strtotime($endtime)]]; + $map["apply_time"] = ["between",[strtotime($begtime),strtotime($endtime) + 3600 * 24 -1]]; } $serverField = ''; $serverJoin = ''; @@ -1860,12 +1864,12 @@ class DownloadController extends BaseController { $begTime = strtotime($initBegTime); $endTime = strtotime($initEndTime); $params['begin_time'] = $begTime; - $params['end_time'] = $endTime -1; + $params['end_time'] = $endTime +3600 * 24 -1; if(!empty($map['apply_time'][1])) { $begTime = $map['apply_time'][1][0]; $endTime = $map['apply_time'][1][1]; $params['begin_time'] = $begTime; - $params['end_time'] = $endTime; + $params['end_time'] = $endTime + 3600 * 24 -1; unset($map['apply_time']); } if(!empty($map['tab_server.server_id'])) { @@ -1880,6 +1884,7 @@ class DownloadController extends BaseController { ->group('tab_apply.game_id') ->order('g.sort desc,g.id desc') ->select(); + $records = []; if (!empty($data)) { if (intval($endTime - $begTime) / (24 * 3600) <= 30) { @@ -1888,7 +1893,6 @@ class DownloadController extends BaseController { $gameIds[] = $list['game_id']; } $params['game_ids'] = $gameIds; - $userRepository = new UserRepository(); $spendRepository = new SpendRepository(); $roleNumList = $userRepository->getCreateRoleCountByGame($params);//创角数 diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index dfda7397a..bfa3f4c86 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -1633,8 +1633,10 @@ class QueryController extends BaseController $map['_string'] = '1<>1'; } - if ($relationGameId != 0) { - $gameMap['relation_game_id'] = $relationGameId; + if ($relationGameId != 0 || $sdkVersion != 0) { + if ($relationGameId != 0) { + $gameMap['relation_game_id'] = $relationGameId; + } if ($sdkVersion != 0) { $gameMap['sdk_version'] = $sdkVersion; } @@ -1743,8 +1745,10 @@ class QueryController extends BaseController $map = ['uc.promote_id' => ['in', $ids]]; $subMap = ['promote_id' => ['in', $ids]]; - if ($relationGameId != 0) { - $gameMap['relation_game_id'] = $relationGameId; + if ($relationGameId != 0 || $sdkVersion != 0) { + if ($relationGameId != 0) { + $gameMap['relation_game_id'] = $relationGameId; + } if ($sdkVersion != 0) { $gameMap['sdk_version'] = $sdkVersion; } @@ -1998,9 +2002,11 @@ class QueryController extends BaseController 'isContainSubs' => true, 'basicPromotes' => $basicPromotes, ]; - if ($relationGameId > 0) { - $gameMap['relation_game_id'] = $relationGameId; - if ($sdkVersion > 0) { + if ($relationGameId != 0 || $sdkVersion != 0) { + if ($relationGameId != 0) { + $gameMap['relation_game_id'] = $relationGameId; + } + if ($sdkVersion != 0) { $gameMap['sdk_version'] = $sdkVersion; } $gameId = M('game', 'tab_')->where($gameMap)->getField('id', true); diff --git a/Application/Home/View/default/CoinOrder/order_add.html b/Application/Home/View/default/CoinOrder/order_add.html index abe4b71f3..ca65fc73a 100644 --- a/Application/Home/View/default/CoinOrder/order_add.html +++ b/Application/Home/View/default/CoinOrder/order_add.html @@ -42,7 +42,7 @@ 购买数量: - + 平台币 @@ -87,7 +87,7 @@ - (手续费说明:每笔交易支付服务商将收取 0.20% 手续费,最低收取0.1元,上不封顶) + (手续费说明:每笔交易支付服务商将收取 {$LV}% 手续费,最低收取0.1元,上不封顶) @@ -143,7 +143,7 @@ var rodio_val = $('.jspayradio input:radio:checked').val(); coin_num = (discount/100)*coin_num; if(rodio_val==1){ //在线转账 - var fee = coin_num*(0.2/100); + var fee = coin_num*({$LV}/100); if(fee<0.1){ fee=0.1 } diff --git a/Application/Home/View/default/Promote/children.html b/Application/Home/View/default/Promote/children.html index d0a0eaef7..3637f855b 100644 --- a/Application/Home/View/default/Promote/children.html +++ b/Application/Home/View/default/Promote/children.html @@ -125,7 +125,7 @@
- 导出 + 导出 {$pagination}