diff --git a/Addons/SiteStat/info.html b/Addons/SiteStat/info.html index 840ef2248..8b4765f33 100644 --- a/Addons/SiteStat/info.html +++ b/Addons/SiteStat/info.html @@ -178,7 +178,7 @@ $(document).ready(function () { 【返利设置】 - 【{$vo.game_name}】充值返利已到期 + 【{$vo.game_name}】充值返利已到期 @@ -186,7 +186,7 @@ $(document).ready(function () { 【礼包列表】 - + 【{$vo.game_name}】{$vo.giftbag_name}数量不足 diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 882be5ec0..e4832f814 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -37,17 +37,22 @@ function get_user_big_info($id=0, $flag=false) { * @author 鹿文学 */ function get_promote_list_by_id($id=0) { + //为数据权限修改 2019-12-19 lww + $query = M("Promote","tab_")->field('id,account,balance_coin'); + $map = array(); + setPowerPromoteIds($map, 'id'); if(is_numeric($id) && $id>=0) { - $list = M("Promote","tab_")->field('id,account,balance_coin')->where(['parent_id'=>$id])->select(); + $map['parent_id'] = $id; + $list = $query->where($map)->select(); } elseif(is_array($id)) { - $list = M("Promote","tab_")->field('id,account,balance_coin')->where(['parent_id'=>array('in',$id)])->select(); + $map['parent_id'] = array('in',$id); + $list = $query->where($map)->select(); } elseif(is_numeric($id) && $id<0){ - $list = M("Promote","tab_")->field('id,account,balance_coin')->select(); + $list = $query->where($map)->select(); } else { $list = ''; } - return $list; } @@ -202,6 +207,8 @@ function get_promote_list($select='') { function get_all_toppromote(){ $map['status']=1; $map['level']=['lt', 4]; + //为数据权限添加 + setPowerPromoteIds($map, 'id'); $list = M("Promote","tab_")->where($map)->select(); if (empty($list)){return '';} return $list; @@ -584,6 +591,8 @@ function promote_lists($type){ } else{ $map = ''; } + //为数据权限添加 + setPowerPromoteIds($map, 'id'); $data = M('promote','tab_')->where($map)->select(); $items = M('PromoteBalanceCoin', 'tab_')->where(['game_id' => 0])->select(); @@ -1601,6 +1610,11 @@ function getPowerPromoteIds() } } } +// var_dump(in_array('-1',explode(',',$userAuth['data_president'])));die(); + if (in_array('-1',explode(',',$userAuth['data_president']))) { + $promoteIds = $promoteIds .',0'; + } +// var_dump($promoteIds);die(); session('user_auth_promote_ids', $promoteIds); return $promoteIds; } diff --git a/Application/Admin/Controller/AuthManagerController.class.php b/Application/Admin/Controller/AuthManagerController.class.php index 44c5293c7..5ebaa6eee 100644 --- a/Application/Admin/Controller/AuthManagerController.class.php +++ b/Application/Admin/Controller/AuthManagerController.class.php @@ -482,7 +482,7 @@ class AuthManagerController extends AdminController{ if ($AuthGroup->where("id = {$gid}")->save(array('data_empower_type'=>$data_empower_type,'data_president'=>$promoteData))) { $this->success('操作成功',U('AuthManager/index')); } else { - $this->error('操作失败'); + $this->error('操作失败,请改变成员'); } } @@ -491,6 +491,8 @@ class AuthManagerController extends AdminController{ $promoteData = M('promote','tab_')->field('id as value,account as title')->where(array('level'=>1,'chain'=>'/'))->select(); $data_president = M('AuthGroup')->field('data_president')->where(array('id'=>$_REQUEST['group_id']))->find(); + $promoteData = array_merge([0=>['value'=>'-1','title'=>'官方渠道']],$promoteData); + $returnData = array('data_president'=>$data_president['data_president'],'list'=>$promoteData); $this->ajaxReturn(json_encode($returnData)); diff --git a/Application/Admin/Controller/BehaviorLogController.class.php b/Application/Admin/Controller/BehaviorLogController.class.php index 5720a6f55..c08352411 100644 --- a/Application/Admin/Controller/BehaviorLogController.class.php +++ b/Application/Admin/Controller/BehaviorLogController.class.php @@ -41,6 +41,9 @@ class BehaviorLogController extends ThinkController $startTime = strtotime($startDate); $endTime = strtotime($endDate) + 86399; $map['create_time'] = array('BETWEEN', [$startTime, $endTime]); + + setPowerPromoteIds($map,'promote_id'); + if (isset($params['promote_id'])) { $promoteId = $params['promote_id']; if ($promoteId == 0) { diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 45c53902b..15ba5d902 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -77,7 +77,7 @@ class ExportController extends Controller $map['server_name'] = array('like','%'.trim($_REQUEST['server_name']).'%'); unset($_REQUEST['server_name']); } - if (isset($_REQUEST['server_id'])) { + if (isset($_REQUEST['server_id'])) { $map['server_id'] = trim($_REQUEST['server_id']); unset($_REQUEST['server_id']); } @@ -111,6 +111,14 @@ class ExportController extends Controller } } + if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) { + $map['create_time'] = ['between', [strtotime(I('time_start')), strtotime(I('time_end')) + 86399]]; + } elseif (isset($_REQUEST['time_start'])) { + $map['create_time'] = ['GT', strtotime(I('time_start'))]; + } elseif (isset($_REQUEST['time_end'])) { + $map['create_time'] = ['LT', strtotime(I('time_end')) + 86399]; + } + $csvFileName = $xlsName.'.csv'; //设置好告诉浏览器要下载excel文件的headers header('Content-Description: File Transfer'); @@ -243,27 +251,29 @@ class ExportController extends Controller unset($_REQUEST['start']); unset($_REQUEST['end']); } + //为数据权限添加 + setPowerPromoteIds($map); $model = array( 'm_name' => 'User', 'join' => 'tab_promote ON tab_user.promote_id = tab_promote.id', 'fields' => array( - 'tab_user.id', - 'tab_user.account', - 'tab_user.fgame_name', - 'tab_user.nickname', - 'tab_user.email', - 'tab_user.phone', - 'promote_id', - 'tab_user.parent_id', - 'tab_user.register_time', - 'tab_user.register_way', - 'tab_user.register_ip', - 'promote_account', - 'tab_user.parent_name', - 'is_check', - 'tab_promote.ba_id', - "REPLACE(substring_index(tab_promote.chain, '/', 2),'/','') as top_promote" - ), + 'tab_user.id', + 'tab_user.account', + 'tab_user.fgame_name', + 'tab_user.nickname', + 'tab_user.email', + 'tab_user.phone', + 'promote_id', + 'tab_user.parent_id', + 'tab_user.register_time', + 'tab_user.register_way', + 'tab_user.register_ip', + 'promote_account', + 'tab_user.parent_name', + 'is_check', + 'tab_promote.ba_id', + "REPLACE(substring_index(tab_promote.chain, '/', 2),'/','') as top_promote" + ), 'key' => array('tab_user.account', 'tab_game.fgame_name'), 'map' => $map, 'order' => 'id desc', @@ -406,6 +416,22 @@ class ExportController extends Controller } $hav = ''; + +// $promoteRoot = getPowerPromoteIds(); +// if ($promoteRoot) { +// $map['tab_user.promote_id'] =array('in',$promoteRoot); +// } + + $promoteRoot = getPowerPromoteIds(); +// $data_empower_type = session('user_auth')['data_empower_type']; +// +// if ($promoteRoot) { +// $map['tab_user.promote_id'] =array('in',$promoteRoot); +// } else if(!$promoteRoot&&$data_empower_type!=1){ +// $map['tab_user.id'] = array('lt',1); +// } + setPowerPromoteIds($map,'tab_user.promote_id'); + if ($_REQUEST['promote_id'] != '') { if($_REQUEST['promote_id']=='UC'){ $maps['tab_user.promote_account'] = 'UC用户'; @@ -414,7 +440,16 @@ class ExportController extends Controller $maps['tab_user.promote_id'] = 0; $hav .= "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 ($promoteRoot) { + $promoteRoot = " and id IN({$promoteRoot})"; + } + + if ($promoteRoot == 'all') { + $promoteRoot = ''; + } + + $promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}.$promoteRoot")->field('id')->select(); if ($promoter_ids) { $map['tab_user.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))]; $hav .= "tab_user.promote_id in (" . implode(',', array_column($promoter_ids, 'id')) . ") "; @@ -797,91 +832,91 @@ class ExportController extends Controller unset($_REQUEST['end']); } */ - if(isset($_REQUEST['game_name'])){ - if($_REQUEST['game_name']=='全部'){ - unset($_REQUEST['game_name']); - }else{ - $map['game_name']=$_REQUEST['game_name']; - unset($_REQUEST['game_name']); - } - } - if(!empty($_REQUEST['server_id'])){ - $map['server_name']=$_REQUEST['server_id']; - unset($_REQUEST['server_id']); - } - if(!empty($_REQUEST['pay_order_number'])){ - $map['pay_order_number']=array('like','%'.$_REQUEST['pay_order_number'].'%'); - unset($_REQUEST['pay_order_number']); - } - if(isset($_REQUEST['promote_name'])){ - if($_REQUEST['promote_name']=='全部'){ - unset($_REQUEST['promote_name']); - }else if($_REQUEST['promote_name']=='自然注册'){ - $map['promote_id']=array("lte",0); - unset($_REQUEST['promote_name']); - }else{ - $map['promote_id']=get_promote_id($_REQUEST['promote_name']); - unset($_REQUEST['promote_name']); - } - }else{ - $map['promote_id']=array("gt",0); - } + if(isset($_REQUEST['game_name'])){ + if($_REQUEST['game_name']=='全部'){ + unset($_REQUEST['game_name']); + }else{ + $map['game_name']=$_REQUEST['game_name']; + unset($_REQUEST['game_name']); + } + } + if(!empty($_REQUEST['server_id'])){ + $map['server_name']=$_REQUEST['server_id']; + unset($_REQUEST['server_id']); + } + if(!empty($_REQUEST['pay_order_number'])){ + $map['pay_order_number']=array('like','%'.$_REQUEST['pay_order_number'].'%'); + unset($_REQUEST['pay_order_number']); + } + if(isset($_REQUEST['promote_name'])){ + if($_REQUEST['promote_name']=='全部'){ + unset($_REQUEST['promote_name']); + }else if($_REQUEST['promote_name']=='自然注册'){ + $map['promote_id']=array("lte",0); + unset($_REQUEST['promote_name']); + }else{ + $map['promote_id']=get_promote_id($_REQUEST['promote_name']); + unset($_REQUEST['promote_name']); + } + }else{ + $map['promote_id']=array("gt",0); + } - if(isset($_REQUEST['pay_way'])){ - $map['pay_way']=$_REQUEST['pay_way']; - unset($_REQUEST['pay_way']); - } - if(isset($_REQUEST['user_account'])){ - $map['user_account']=array('like','%'.$_REQUEST['user_account'].'%'); - unset($_REQUEST['user_account']); - } - if(isset($_REQUEST['spend_ip'])){ - $map['spend_ip']=array('like','%'.$_REQUEST['spend_ip'].'%'); - unset($_REQUEST['spend_ip']); - } - if(isset($_REQUEST['promote_name'])){ - $map['promote_account']=$_REQUEST['promote_name']; - unset($_REQUEST['promote_name']); - } - if(isset($_REQUEST['time-start'])&&isset($_REQUEST['time-end'])){ - $map['pay_time']=array('BETWEEN',array(strtotime($_REQUEST['time-start']),strtotime($_REQUEST['time-end'])+24*60*60-1)); - unset($_REQUEST['time-start']);unset($_REQUEST['time_end']); - }elseif(isset($_REQUEST['time-start'])){ - $map['pay_time'] = ['GT',strtotime(I('time-start'))]; - unset($_REQUEST['time-start']); - }elseif(isset($_REQUEST['time-end'])){ - $map['pay_time'] = ['LT',strtotime(I('time-end'))+86399]; - unset($_REQUEST['time-end']); - } - 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']); - }elseif(isset($_REQUEST['start'])){ - $map['pay_time'] = ['GT',strtotime(I('start'))]; - unset($_REQUEST['start']); - }elseif(isset($_REQUEST['end'])){ - $map['pay_time'] = ['LT',strtotime(I('end'))+86399]; - unset($_REQUEST['end']); - } - if(!empty(I('parent_id'))){ - $parent_id = I('parent_id'); - $pro = M('promote','tab_')->field('id')->where("chain like '%/{$parent_id}/%'")->select(); - $pro_ids = array_column($pro,'id'); - $pro_ids[] = I('parent_id'); - if (!empty($pro_ids)){ - $map['promote_id'] = ['in',$pro_ids]; - }else{ - $map['promote_id'] = array('eq',999999999); - } - } - if(isset($_REQUEST['ba_id'])){ - $all_promote_id = array_column(get_admin_promotes($_REQUEST['ba_id'],'ba_id'),'id'); - if(empty($all_promote_id)){ - $all_promote_id[]=-1; - } + if(isset($_REQUEST['pay_way'])){ + $map['pay_way']=$_REQUEST['pay_way']; + unset($_REQUEST['pay_way']); + } + if(isset($_REQUEST['user_account'])){ + $map['user_account']=array('like','%'.$_REQUEST['user_account'].'%'); + unset($_REQUEST['user_account']); + } + if(isset($_REQUEST['spend_ip'])){ + $map['spend_ip']=array('like','%'.$_REQUEST['spend_ip'].'%'); + unset($_REQUEST['spend_ip']); + } + if(isset($_REQUEST['promote_name'])){ + $map['promote_account']=$_REQUEST['promote_name']; + unset($_REQUEST['promote_name']); + } + if(isset($_REQUEST['time-start'])&&isset($_REQUEST['time-end'])){ + $map['pay_time']=array('BETWEEN',array(strtotime($_REQUEST['time-start']),strtotime($_REQUEST['time-end'])+24*60*60-1)); + unset($_REQUEST['time-start']);unset($_REQUEST['time_end']); + }elseif(isset($_REQUEST['time-start'])){ + $map['pay_time'] = ['GT',strtotime(I('time-start'))]; + unset($_REQUEST['time-start']); + }elseif(isset($_REQUEST['time-end'])){ + $map['pay_time'] = ['LT',strtotime(I('time-end'))+86399]; + unset($_REQUEST['time-end']); + } + 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']); + }elseif(isset($_REQUEST['start'])){ + $map['pay_time'] = ['GT',strtotime(I('start'))]; + unset($_REQUEST['start']); + }elseif(isset($_REQUEST['end'])){ + $map['pay_time'] = ['LT',strtotime(I('end'))+86399]; + unset($_REQUEST['end']); + } + if(!empty(I('parent_id'))){ + $parent_id = I('parent_id'); + $pro = M('promote','tab_')->field('id')->where("chain like '%/{$parent_id}/%'")->select(); + $pro_ids = array_column($pro,'id'); + $pro_ids[] = I('parent_id'); + if (!empty($pro_ids)){ + $map['promote_id'] = ['in',$pro_ids]; + }else{ + $map['promote_id'] = array('eq',999999999); + } + } + if(isset($_REQUEST['ba_id'])){ + $all_promote_id = array_column(get_admin_promotes($_REQUEST['ba_id'],'ba_id'),'id'); + if(empty($all_promote_id)){ + $all_promote_id[]=-1; + } - $map['promote_id']=array($map['promote_id'],array('in',implode(',',$all_promote_id)),'and'); - } + $map['promote_id']=array($map['promote_id'],array('in',implode(',',$all_promote_id)),'and'); + } $model = array( @@ -924,6 +959,9 @@ class ExportController extends Controller break; case 5: $map['promote_id'] = array("neq", 0); + if (isset($_REQUEST['promote_id'])) { + $map['_string'] = 'promote_id=' . $_REQUEST['promote_id']; + } if (isset($_REQUEST['user_account'])) { $map['user_account'] = array('like', '%' . $_REQUEST['user_account'] . '%'); unset($_REQUEST['user_account']); @@ -962,6 +1000,9 @@ class ExportController extends Controller unset($_REQUEST['game_name']); } } + //为数据权限添加 + setPowerPromoteIds($map); + $map1 = $map; $map1['pay_status'] = 1; $total = M('Agent', 'tab_')->where($map1)->sum('amount'); @@ -1063,6 +1104,17 @@ class ExportController extends Controller $map['pay_game_status'] = $_REQUEST['pay_game_status']; unset($_REQUEST['pay_game_status']); } + +// $promoteRoot = getPowerPromoteIds(); +// $data_empower_type = session('user_auth')['data_empower_type']; +// +// if ($promoteRoot) { +// $map['promote_id'] =array('in',$promoteRoot); +// } else if(!$promoteRoot&&$data_empower_type!=1){ +// $map['id'] = array('lt',1); +// } + setPowerPromoteIds($map,'promote_id'); + if(isset($_REQUEST['promote_id'])) { if ($_REQUEST['promote_id'] == 0) { $map['promote_id'] = 0; @@ -1167,6 +1219,17 @@ class ExportController extends Controller $map['pay_ip'] = array('like', '%' . trim($_REQUEST['pay_ip']) . '%'); unset($_REQUEST['pay_ip']); } + +// $promoteRoot = getPowerPromoteIds(); +// $data_empower_type = session('user_auth')['data_empower_type']; +// +// if ($promoteRoot) { +// $map['promote_id'] =array('in',$promoteRoot); +// } else if(!$promoteRoot&&$data_empower_type!=1){ +// $map['id'] = array('lt',1); +// } + setPowerPromoteIds($map,'promote_id'); + if (!isset($_REQUEST['promote_id'])) { } else if (isset($_REQUEST['promote_id']) && $_REQUEST['promote_id'] == 0) { @@ -1253,6 +1316,15 @@ class ExportController extends Controller unset($_REQUEST['game_name']); } } + + $game_ids = array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['sdk_version1']), 'id'); + if ($game_ids) { + $map['game_id'] = ['in', $game_ids]; + unset($_REQUEST['game_name'], $_REQUEST['sdk_version1']); + } + + $map['op_account']=session('user_auth')['username']; + if (isset($_REQUEST['op_account'])) { if ($_REQUEST['op_account'] == L('All')) { unset($_REQUEST['op_account']); @@ -1456,7 +1528,8 @@ class ExportController extends Controller $map['promote_account'] = $_REQUEST['promote_account']; } } - + //为数据权限添加 + setPowerPromoteIds($map); if ($_REQUEST['create_time'] == 2) { $order = 'create_time desc'; } elseif ($_REQUEST['create_time'] == 1) { @@ -1534,7 +1607,8 @@ class ExportController extends Controller unset($_REQUEST['game_name']); } } - + //为数据权限添加 + setPowerPromoteIds($map); $xlsData = M('settlement', 'tab_') ->field(array( 'settlement_number', @@ -1569,9 +1643,11 @@ class ExportController extends Controller $map['user_account'] = array('like', '%' . trim($_REQUEST['user_account']) . '%'); } if (isset($_REQUEST['op_id'])) { - $map['op_id'] = $_REQUEST['op_id']; + $map['op_id'] = $_REQUEST['op_id']; } + $map['op_account']=session('user_auth')['username']; + if (isset($_REQUEST['start']) && isset($_REQUEST['end'])) { $map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['start']), strtotime($_REQUEST['end']) + 24 * 60 * 60 - 1)); } @@ -1614,12 +1690,12 @@ class ExportController extends Controller ->order('id DESC') ->select(); - foreach($xlsData as $k => $v) { - $xlsData[$k]['last_login_time'] = $v['last_login_time']>0?date('Y-m-d H:i',$v['last_login_time']):'暂无登录'; - $xlsData[$k]['mobile_phone'] = $v['mobile_phone']?$v['mobile_phone']:'空'; - $xlsData[$k]['link_man'] = $v['link_man']?$v['link_man']:'空'; - $xlsData[$k]['nickname'] = $v['nickname']?$v['nickname']:'空'; - } + foreach($xlsData as $k => $v) { + $xlsData[$k]['last_login_time'] = $v['last_login_time']>0?date('Y-m-d H:i',$v['last_login_time']):'暂无登录'; + $xlsData[$k]['mobile_phone'] = $v['mobile_phone']?$v['mobile_phone']:'空'; + $xlsData[$k]['link_man'] = $v['link_man']?$v['link_man']:'空'; + $xlsData[$k]['nickname'] = $v['nickname']?$v['nickname']:'空'; + } break; case 18: @@ -1705,9 +1781,9 @@ class ExportController extends Controller break; - case 19: + case 19: - $xlsCell = array( + $xlsCell = array( array('developers', "开发者账号"), array('settlement_number', "结算单号"), array('starttime', "周期开始时间",'time_format','*'), @@ -1723,15 +1799,15 @@ class ExportController extends Controller $map['starttime'] = array('egt',$starttime); $map['endtime'] = array('elt',$endtime); }elseif(isset($_REQUEST['timestart'])){ - $starttime = strtotime($_REQUEST['timestart']); - $map['starttime'] = array('egt',$starttime); + $starttime = strtotime($_REQUEST['timestart']); + $map['starttime'] = array('egt',$starttime); }elseif(isset($_REQUEST['timeend'])){ $endtime = strtotime($_REQUEST['timeend'])+24*3600-1; $map['endtime'] = array('elt',$endtime); } - if(isset($_REQUEST['start']) && $_REQUEST['end']!=''){ + if(isset($_REQUEST['start']) && $_REQUEST['end']!=''){ $starttime = strtotime($_REQUEST['start']); $endtime = strtotime($_REQUEST['end'])+24*3600-1; $map['create_time'] = array('BETWEEN',array($starttime,$endtime)); @@ -1739,7 +1815,7 @@ class ExportController extends Controller $starttime = strtotime($_REQUEST['start']); $map['create_time'] = array('BETWEEN',array($starttime,time())); }elseif(isset($_REQUEST['end'])){ - $endtime = strtotime($_REQUEST['end'])+24*3600-1; + $endtime = strtotime($_REQUEST['end'])+24*3600-1; $map['create_time'] = array('LT',$endtime); } @@ -1749,128 +1825,139 @@ class ExportController extends Controller $map['developers'] = array('neq',0); } $data = M('TotalSettlement','tab_')->where($map)->select(); - foreach ($data as $key => $value){ - $data[$key]['developers'] = get_developers_account($data[$key]['developers'],'account'); - } + foreach ($data as $key => $value){ + $data[$key]['developers'] = get_developers_account($data[$key]['developers'],'account'); + } $xlsData = $data; break; - case 20: - - $xlsCell = array( - array('settlement_number', '提现单号'), - array('sum_money', '提现金额'), - array('developers', '开发者账号'), - array('create_time', '申请时间', 'time_format', '*'), - array('status', '提现状态', 'get_info_status', '*', 19), - array('end_time', '审核时间', 'time_format', '*'), - ); - if(isset($_REQUEST['settlement_number'])){ - $map['settlement_number']=array('like','%'.$_REQUEST['settlement_number'].'%'); - } - if(isset($_REQUEST['status'])){ - $map['status']=$_REQUEST['status']; - } - if(isset($_REQUEST['developers'])){ - if($_REQUEST['developers']=='全部'){ - unset($_REQUEST['developers']); - }else{ - $map['developers'] = $_REQUEST['developers']; - } - }else{ - $map['developers'] = array('neq',0); - - } - if(isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])){ - $starttime = strtotime($_REQUEST['timestart']); - $endtime = strtotime($_REQUEST['timeend'])+24*3600-1; - $map['audit_time'] = array('BETWEEN',array($starttime,$endtime)); - unset($_REQUEST['timestart']);unset($_REQUEST['timeend']); - }elseif(isset($_REQUEST['timestart'])){ - $map['audit_time'] = ['GT',strtotime(I('timestart'))]; - unset($_REQUEST['timestart']); - }elseif(isset($_REQUEST['timeend'])){ - $map['audit_time'] = ['LT',strtotime(I('timeend'))+86399]; - unset($_REQUEST['timeend']); - } + case 20: - if($_REQUEST['create_time']==2){ - $order='create_time desc'; - }elseif($_REQUEST['create_time']==1){ - $order='create_time asc'; + $xlsCell = array( + array('settlement_number', '提现单号'), + array('sum_money', '提现金额'), + array('developers', '开发者账号'), + array('create_time', '申请时间', 'time_format', '*'), + array('status', '提现状态', 'get_info_status', '*', 19), + array('end_time', '审核时间', 'time_format', '*'), + ); + if(isset($_REQUEST['settlement_number'])){ + $map['settlement_number']=array('like','%'.$_REQUEST['settlement_number'].'%'); + } + if(isset($_REQUEST['status'])){ + $map['status']=$_REQUEST['status']; + } + if(isset($_REQUEST['developers'])){ + if($_REQUEST['developers']=='全部'){ + unset($_REQUEST['developers']); }else{ - $order='create_time desc'; - } - if($_REQUEST['data_order']==3){ - $order='sum_money desc'; - }elseif($_REQUEST['data_order']==4){ - $order='sum_money asc'; + $map['developers'] = $_REQUEST['developers']; } - $xlsData = D('withdraw') - ->where($map) - ->order($order) - ->select(); - foreach ($xlsData as $key => $value){ - $xlsData[$key]['developers'] = get_developers_account($value['developers'],'account'); - } - break; - case 21: - $xlsCell = array( - array('extend', 'CP订单号'), - array('create_time', '充值时间'), - array('user_account', '玩家账号'), - array('game_name', '游戏名称'), - array('server_name', '游戏区服'), - array('promote_account', '所属推广员'), - array('game_player_id', '角色ID'), - array('game_player_name', '角色名称'), - array('price', '订单金额'), - ); - $params = I('get.'); + }else{ + $map['developers'] = array('neq',0); - $map = []; - if (isset($params['user_account'])) { - $map['user_account'] = $params['user_account']; - } - if (isset($params['extend'])) { - $map['extend'] = $params['extend']; - } - if (isset($params['game_name'])) { - $game_id = ['in', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')]; - $map['game_id'] = $game_id; - } - if (isset($params['server_name'])) { - $map['server_name'] = $params['server_name']; - } - if (isset($params['user_nickname'])) { - $map['user_nickname'] = $params['user_nickname']; - } - if (isset($params['game_player_id'])) { - $map['game_player_id'] = $params['game_player_id']; - } + } + if(isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])){ + $starttime = strtotime($_REQUEST['timestart']); + $endtime = strtotime($_REQUEST['timeend'])+24*3600-1; + $map['audit_time'] = array('BETWEEN',array($starttime,$endtime)); + unset($_REQUEST['timestart']);unset($_REQUEST['timeend']); + }elseif(isset($_REQUEST['timestart'])){ + $map['audit_time'] = ['GT',strtotime(I('timestart'))]; + unset($_REQUEST['timestart']); + }elseif(isset($_REQUEST['timeend'])){ + $map['audit_time'] = ['LT',strtotime(I('timeend'))+86399]; + unset($_REQUEST['timeend']); + } - $startDate = empty($params['timestart']) ? date('Y-m-d', strtotime('-6 day', time())) : $params['timestart']; - $endDate = empty($params['timeend']) ? date('Y-m-d') : $params['timeend']; - $startTime = strtotime($startDate); - $endTime = strtotime($endDate) + 86399; - $map['create_time'] = array('BETWEEN', [$startTime, $endTime]); - if ($promoteId = I('promote_id')) { - if ($promoteId == 0) { - $map['promote_id'] = 0; - } else { - $promoteMap['chain'] = ['like', "%/$promoteId/%"]; - $promoteIds = M('Promote', 'tab_')->where($promoteMap)->getField('id', true); - $promoteIds[] = $promoteId; - $map['promote_id'] = ['in', $promoteIds]; - } - } - $xlsData = M('pay_info', 'tab_')->where($map)->order('id DESC')->select(); - foreach($xlsData as $k => $v) { - $xlsData[$k]['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + if($_REQUEST['create_time']==2){ + $order='create_time desc'; + }elseif($_REQUEST['create_time']==1){ + $order='create_time asc'; + }else{ + $order='create_time desc'; + } + if($_REQUEST['data_order']==3){ + $order='sum_money desc'; + }elseif($_REQUEST['data_order']==4){ + $order='sum_money asc'; + } + $xlsData = D('withdraw') + ->where($map) + ->order($order) + ->select(); + foreach ($xlsData as $key => $value){ + $xlsData[$key]['developers'] = get_developers_account($value['developers'],'account'); + } + break; + case 21: + $xlsCell = array( + array('extend', 'CP订单号'), + array('create_time', '充值时间'), + array('user_account', '玩家账号'), + array('game_name', '游戏名称'), + array('server_name', '游戏区服'), + array('promote_account', '所属推广员'), + array('game_player_id', '角色ID'), + array('game_player_name', '角色名称'), + array('price', '订单金额'), + ); + $params = I('get.'); + + $map = []; + if (isset($params['user_account'])) { + $map['user_account'] = $params['user_account']; + } + if (isset($params['extend'])) { + $map['extend'] = $params['extend']; + } + if (isset($params['game_name'])) { + $game_id = ['in', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')]; + $map['game_id'] = $game_id; + } + if (isset($params['server_name'])) { + $map['server_name'] = $params['server_name']; + } + if (isset($params['user_nickname'])) { + $map['user_nickname'] = $params['user_nickname']; + } + if (isset($params['game_player_id'])) { + $map['game_player_id'] = $params['game_player_id']; + } + + $startDate = empty($params['timestart']) ? date('Y-m-d', strtotime('-6 day', time())) : $params['timestart']; + $endDate = empty($params['timeend']) ? date('Y-m-d') : $params['timeend']; + $startTime = strtotime($startDate); + $endTime = strtotime($endDate) + 86399; + $map['create_time'] = array('BETWEEN', [$startTime, $endTime]); + +// $promoteRoot = getPowerPromoteIds(); +// $data_empower_type = session('user_auth')['data_empower_type']; +// +// if ($promoteRoot) { +// $map['promote_id'] =array('in',$promoteRoot); +// } else if(!$promoteRoot&&$data_empower_type!=1){ +// $map['id'] = array('lt',1); +// } + setPowerPromoteIds($map,'promote_id'); + + if ($promoteId = I('promote_id')) { + if ($promoteId == 0) { + $map['promote_id'] = 0; + } else { + $promoteMap['chain'] = ['like', "%/$promoteId/%"]; + $promoteIds = M('Promote', 'tab_')->where($promoteMap)->getField('id', true); + $promoteIds[] = $promoteId; + $map['promote_id'] = ['in', $promoteIds]; } - break; + } + $xlsData = M('pay_info', 'tab_')->where($map)->order('id DESC')->select(); + foreach($xlsData as $k => $v) { + $xlsData[$k]['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + } + break; default: - $xlsName = $xlsCell = $xlsData = []; + $xlsName = $xlsCell = $xlsData = []; } @@ -1897,11 +1984,11 @@ class ExportController extends Controller $request=$_REQUEST; $dataKey = array('time','register_num','act_user','keep_num','spend','spend_people','new_pop','spend_rate','ARPU','ARPPU','pop_num'); if(!empty($request['game_id'])){ - array_splice($dataKey,1,0,"game_id"); + array_splice($dataKey,1,0,"game_id"); } if(!empty($request['promote_id'])){ - $key = empty($request['game_id'])?1:2; - array_splice($dataKey,$key,0,"promote_id"); + $key = empty($request['game_id'])?1:2; + array_splice($dataKey,$key,0,"promote_id"); } $xlsName = $_REQUEST['xlsname']?$_REQUEST['xlsname']:"ARPU分析"; foreach ($dataKey as $key => $value) { @@ -2109,6 +2196,8 @@ class ExportController extends Controller $today=total(1); $week=total(2); $mounth=total(3); + //为数据权限添加 + setPowerPromoteIds($map); $data=$user ->field('fgame_name,fgame_id,date_format(FROM_UNIXTIME( register_time),"%Y-%m-%d") AS time, count(id) as count, count(IF(register_time '.$today.',1,null)) as today, @@ -2187,6 +2276,8 @@ class ExportController extends Controller $today=total(1); $week=total(2); $mounth=total(3); + //为数据权限添加 + setPowerPromoteIds($map); $data=$spend ->field('game_name,game_id,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, @@ -2263,6 +2354,8 @@ class ExportController extends Controller $today=total(1); $week=total(2); $mounth=total(3); + //为数据权限添加 + setPowerPromoteIds($map); $data=$user ->field('register_way,date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(id) as count, count(IF(register_time '.$today.',1,null)) as today, @@ -2335,6 +2428,8 @@ class ExportController extends Controller $today=total(1); $week=total(2); $mounth=total(3); + //为数据权限添加 + setPowerPromoteIds($map); $data=$spend ->field('pay_way,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, @@ -2449,7 +2544,8 @@ class ExportController extends Controller } else { $map['tp1.chain'] = '/'; } - + //为数据权限添加 + setPowerPromoteIds($map); $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, @@ -2543,10 +2639,7 @@ class ExportController extends Controller } private function promotepay_statistics_export($p=0){ - $page = intval($p); - $page = $page ? $page : 1; //默认显示第一页数据 - $arraypage=$page; - $row = 10; + $map1['promote_id'] = $map['promote_id'] = array('egt', 0); $spend=M('Spend','tab_'); if(isset($_REQUEST['timestart'])&&isset($_REQUEST['timeend'])){ @@ -2584,9 +2677,12 @@ class ExportController extends Controller if (isset($_REQUEST['promote_id'])) { $promote_map = "`chain` = '%/{$_REQUEST['promote_id']}/%' OR id = {$_REQUEST['promote_id']}"; } - - $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']; + //为数据权限添加 + setPowerPromoteIds($map); + $promote_map2 = array(); + setPowerPromoteIds($promote_map2, 'id'); + $promote = M("promote","tab_")->field("id,account")->where($promote_map)->where($promote_map2)->select(); + $pcount = M("promote","tab_")->field("count(*) acount")->where($promote_map)->where($promote_map2)->find()['acount']; // var_dump( $promote); $data =array(); @@ -2746,11 +2842,11 @@ class ExportController extends Controller $xlsName = $_REQUEST['xlsname']?$_REQUEST['xlsname']:'留存分析'; $dataKey = array('time','register_num','1','2','3','4','5','6','7','15','30'); if(!empty($request['game_id'])){ - array_splice($dataKey,1,0,"game_id"); + array_splice($dataKey,1,0,"game_id"); } if(!empty($request['promote_id'])){ - $key = empty($request['game_id'])?1:2; - array_splice($dataKey,$key,0,"promote_id"); + $key = empty($request['game_id'])?1:2; + array_splice($dataKey,$key,0,"promote_id"); } foreach ($dataKey as $key => $value) { @@ -2877,6 +2973,22 @@ class ExportController extends Controller empty(I('pay_status')) || $map['pay_status'] = I('pay_status'); empty(I("account")) || $map['user_account'] = ["like","%".I("account")."%"]; empty(I("time_start")) || $map['create_time'] = ["between",[strtotime(I("time_start")),empty(I("time_end"))?time():strtotime(I("time_end"))+86400-1]]; + +// $promoteRoot = getPowerPromoteIds(); +// if ($promoteRoot) { +// $map['promote_id'] =array('in',$promoteRoot); +// } + +// $promoteRoot = getPowerPromoteIds(); +// $data_empower_type = session('user_auth')['data_empower_type']; +// +// if ($promoteRoot) { +// $map['promote_id'] =array('in',$promoteRoot); +// } else if(!$promoteRoot&&$data_empower_type!=1){ +// $map['id'] = array('lt',1); +// } + setPowerPromoteIds($map,'promote_id'); + $data = $model->getLists($map,"create_time desc",$p); $xlsCell = array( @@ -2902,855 +3014,855 @@ class ExportController extends Controller $this->exportExcel($xlsName, $xlsCell, $xlsData); } - /** - * 用户分析 - * @author 鹿文学 - */ - public function user($p=1) { - - $xlsName = $_REQUEST['xlsname']; + /** + * 用户分析 + * @author 鹿文学 + */ + public function user($p=1) { + $xlsName = $_REQUEST['xlsname']; - if(is_numeric($_REQUEST['game_id']) && $_REQUEST['game_id']>0) { - $game_id = I('game_id',''); - $gamesource = get_source_from_game($game_id); - } else { - $gamesource = '全部'; - } - if(is_numeric($_REQUEST['promote_id'])) { - $promote_id = I('promote_id',0); - $promoteaccount = get_promote_name($promote_id); - } else { - $promoteaccount = '全部'; - } + if(is_numeric($_REQUEST['game_id']) && $_REQUEST['game_id']>0) { + $game_id = I('game_id',''); + $gamesource = get_source_from_game($game_id); + } else { + $gamesource = '全部'; + } - $xlsCell = array( - array('time','日期'), - array('source','来源游戏'), - array('promote','推广员'), - array('news','新增用户'), - array('old','老用户'), - array('dau','DAU'), - array('wau','WAU'), - array('mau','MAU'), - ); + if(is_numeric($_REQUEST['promote_id'])) { + $promote_id = I('promote_id',0); + $promoteaccount = get_promote_name($promote_id); + } else { + $promoteaccount = '全部'; + } - if (is_file(dirname(__FILE__).'/access_data_user.txt')) { + $xlsCell = array( + array('time','日期'), + array('source','来源游戏'), + array('promote','推广员'), + array('news','新增用户'), + array('old','老用户'), + array('dau','DAU'), + array('wau','WAU'), + array('mau','MAU'), + ); - $filetxt = file_get_contents(dirname(__FILE__).'/access_data_user.txt'); + if (is_file(dirname(__FILE__).'/access_data_user.txt')) { - $data = json_decode($filetxt,true); + $filetxt = file_get_contents(dirname(__FILE__).'/access_data_user.txt'); - } else { - $page = intval($p); - $page = $page ? $page : 1; //默认显示第一页数据 - if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}//10; + $data = json_decode($filetxt,true); - $start = I('start',date('Y-m-d',strtotime('-7 day'))); + } else { + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}//10; - $end = I('end',date('Y-m-d',strtotime('-1 day'))); + $start = I('start',date('Y-m-d',strtotime('-7 day'))); - $end = strtotime($end)>=strtotime(date('Y-m-d'))?date('Y-m-d',strtotime('-1 day')):$end; + $end = I('end',date('Y-m-d',strtotime('-1 day'))); - $data = D('user')->user(strtotime($start),strtotime($end),$promote_id,$game_id); + $end = strtotime($end)>=strtotime(date('Y-m-d'))?date('Y-m-d',strtotime('-1 day')):$end; - $count = count($list); + $data = D('user')->user(strtotime($start),strtotime($end),$promote_id,$game_id); - $data = array_slice($list,($page-1)*$row,$row,true); + $count = count($list); - } + $data = array_slice($list,($page-1)*$row,$row,true); - foreach ($data as $v) { - $v['source'] = $gamesource; - $v['promote'] = $promoteaccount; + } - $xlsData[] = $v; - } + foreach ($data as $v) { + $v['source'] = $gamesource; + $v['promote'] = $promoteaccount; - $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + $xlsData[] = $v; + } - /** - * ltv统计 - * @author 鹿文学 - */ - public function ltv($p=1) { + $this->exportExcel($xlsName, $xlsCell, $xlsData); + } - $xlsName = $_REQUEST['xlsname']; + /** + * ltv统计 + * @author 鹿文学 + */ + public function ltv($p=1) { - $xlsCell = array( - array('time','日期'), - array('amount','充值金额'), - array('active','活跃用户'), - array('ltv1','LTV1'), - array('ltv2','LTV2'), - array('ltv3','LTV3'), - array('ltv4','LTV4'), - array('ltv5','LTV5'), - array('ltv6','LTV6'), - array('ltv7','LTV7'), - array('ltv14','LTV14'), - array('ltv30','LTV30'), - ); + $xlsName = $_REQUEST['xlsname']; - if (is_file(dirname(__FILE__).'/access_data_ltv.txt')) { + $xlsCell = array( + array('time','日期'), + array('amount','充值金额'), + array('active','活跃用户'), + array('ltv1','LTV1'), + array('ltv2','LTV2'), + array('ltv3','LTV3'), + array('ltv4','LTV4'), + array('ltv5','LTV5'), + array('ltv6','LTV6'), + array('ltv7','LTV7'), + array('ltv14','LTV14'), + array('ltv30','LTV30'), + ); - $filetxt = file_get_contents(dirname(__FILE__).'/access_data_ltv.txt'); + if (is_file(dirname(__FILE__).'/access_data_ltv.txt')) { - $data = json_decode($filetxt,true); + $filetxt = file_get_contents(dirname(__FILE__).'/access_data_ltv.txt'); - } else { - $page = intval($p); - $page = $page ? $page : 1; //默认显示第一页数据 - if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}//10; + $data = json_decode($filetxt,true); - $start = I('start',date('Y-m-d',strtotime('-30 day'))); + } else { + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}//10; - $end = I('end',date('Y-m-d',strtotime('-1 day'))); + $start = I('start',date('Y-m-d',strtotime('-30 day'))); - $end = strtotime($end)>=strtotime(date('Y-m-d'))?date('Y-m-d',strtotime('-1 day')):$end; + $end = I('end',date('Y-m-d',strtotime('-1 day'))); - $data = D('user')->ltv(strtotime($start),strtotime($end)); + $end = strtotime($end)>=strtotime(date('Y-m-d'))?date('Y-m-d',strtotime('-1 day')):$end; + $data = D('user')->ltv(strtotime($start),strtotime($end)); - } - foreach ($data as $v) { - $xlsData[] = $v; - } + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + foreach ($data as $v) { + $xlsData[] = $v; + } + $this->exportExcel($xlsName, $xlsCell, $xlsData); + } - /** - * 统计总揽数据 - * @author 鹿文学 - */ - public function overview() { - $xlsName = $_REQUEST['xlsname'].'_'.$_REQUEST['name']; + /** + * 统计总揽数据 + * @author 鹿文学 + */ + public function overview() { - $xlsCell = array( - array('time','日期'), - array('count',$_REQUEST['name']), - ); + $xlsName = $_REQUEST['xlsname'].'_'.$_REQUEST['name']; - $num = I('num',2); - $key = $_REQUEST['key']; + $xlsCell = array( + array('time','日期'), + array('count',$_REQUEST['name']), + ); - if (is_file(dirname(__FILE__).'/access_data_foldline.txt')) { + $num = I('num',2); + $key = $_REQUEST['key']; - $filetxt = file_get_contents(dirname(__FILE__).'/access_data_foldline.txt'); + if (is_file(dirname(__FILE__).'/access_data_foldline.txt')) { - $data = json_decode($filetxt,true); + $filetxt = file_get_contents(dirname(__FILE__).'/access_data_foldline.txt'); - $xlsData = $data[$key]; - $xlsSummary[] = $data['sum'][$key]; + $data = json_decode($filetxt,true); - } else { + $xlsData = $data[$key]; + $xlsSummary[] = $data['sum'][$key]; - $start = I('start',date('Y-m-d',strtotime('-1 day'))); + } else { - $end = I('end',date('Y-m-d',strtotime('-1 day'))); + $start = I('start',date('Y-m-d',strtotime('-1 day'))); - $starttime = strtotime($start); - $endtime = strtotime($end)+86399; + $end = I('end',date('Y-m-d',strtotime('-1 day'))); - $user = D('User'); - $spend = D('Spend'); + $starttime = strtotime($start); + $endtime = strtotime($end)+86399; - $flag = 1; + $user = D('User'); + $spend = D('Spend'); - if ($start == $end) { + $flag = 1; - $hours = ['00~01','02~03','04~05','06~07','08~09','10~11','12~13','14~15','16~17','18~19','20~21','22~23']; + if ($start == $end) { - foreach($hours as $v) { - if ($key == 'news'){ - $data['news'][$v] = 0;} - if ($key == 'active'){ - $data['active'][$v] = 0;} - if ($key == 'player'){ - $data['player'][$v] = 0;} - } + $hours = ['00~01','02~03','04~05','06~07','08~09','10~11','12~13','14~15','16~17','18~19','20~21','22~23']; - // 新增用户 -if ($key == 'news'){ - $hoursnews = $user->newsAdd(['register_time'=>['between',[$starttime,$endtime]]],'news','time',5); -} -if ($key == 'active'){ - // 活跃用户 - $hoursactive = $user->totalPlayerByGroup(['tab_user_login_record.login_time'=>['between',[$starttime,$endtime]]],'active','time',true,5); -}if ($key == 'player'){ - // 付费用户 - $hoursplayer = $spend->totalPlayerByGroup(['pay_time'=>['between',[$starttime,$endtime]]],'player','time',5); -} + foreach($hours as $v) { + if ($key == 'news'){ + $data['news'][$v] = 0;} + if ($key == 'active'){ + $data['active'][$v] = 0;} + if ($key == 'player'){ + $data['player'][$v] = 0;} + } - foreach($hours as $v) { - foreach($hoursnews as $h) { - $time = explode(' ',$h['time']); - if (strpos($v,$time[1]) !== false) { - $data['news'][$v] = (integer)$h['news'];break; - } - } - - foreach($hoursactive as $h) { - $time = explode(' ',$h['time']); - if (strpos($v,$time[1]) !== false) { - $data['active'][$v] = (integer)$h['active'];break; - } - } - - foreach($hoursplayer as $h) { - $time = explode(' ',$h['time']); - if (strpos($v,$time[1]) !== false) { - $data['player'][$v] = (integer)$h['player'];break; - } - } - - - } - } else { - - $datelist = get_date_list($starttime,$endtime,$num==7?2:1); - - $flag = 0; - - foreach($datelist as $k => $v) { - if ($key == 'news'){ - $data['news'][$v] = 0;} - if ($key == 'active'){ - $data['active'][$v] = 0;} - if ($key == 'player'){ - $data['player'][$v] = 0;} - - } -if ($key == 'news'){ - // 新增用户 - $news = $user->newsAdd(['register_time'=>['between',[$starttime,$endtime]]],'news','time',$num==7?2:1); -} -if ($key == 'active'){ - // 活跃用户 - $active = $user->totalPlayerByGroup(['tab_user_login_record.login_time'=>['between',[$starttime,$endtime]]],'active','time',true,$num==7?2:1); -} -if ($key == 'player'){ - // 付费用户 - $player = $spend->totalPlayerByGroup(['pay_time'=>['between',[$starttime,$endtime]]],'player','time',$num==7?2:1); -} - foreach($datelist as $v) { - foreach($news as $h) { - if ($v == $h['time']) { - $data['news'][$v] = (integer)$h['news'];break; - } - } - - foreach($active as $h) { - if ($v == $h['time']) { - $data['active'][$v] = (integer)$h['active'];break; - } - } - - foreach($player as $h) { - if ($v == $h['time']) { - $data['player'][$v] = (integer)$h['player'];break; - } - } - - } - - } - - foreach ($data as $k => $v) { - $sum = 0;$tempexport=[]; - foreach($v as $t => $s){ - $sum += $s; - if($flag==1){ - $tempexport[]=['time'=>((integer)substr($t,0,2)).':00','count'=>$s]; - }else{ - $tempexport[]=['time'=>$t,'count'=>$s]; - } - } - $export[$k]=$tempexport; - $export['sum'][$k]=$sum; - } - - $xlsData = $export[$key]; - $xlsSummary[] = $export['sum'][$key]; - } - - - $this->exportExcel($xlsName, $xlsCell, $xlsData); - - } - - - /** - * 小号列表 - * @author 鹿文学 - */ - public function small_list() { - - $xlsName = $_REQUEST['xlsname']; - - $xlsCell = array( - array('account','小号'), - array('fgame_name','游戏名称'), - array('day','创建天数'), - array('cumulative','累计充值'), - array('register_time','创建时间'), - array('lock_status','状态'), - ); - - $pid = intval($_GET['id']); - $xlsData = []; - if(is_numeric($pid) && $pid>0) { - - $map['u.puid'] = $pid; - - if($_REQUEST['small']) {$map['u.account']=array('like','%'.$_REQUEST['small'].'%');} - - $data = M('User', 'tab_')->alias('u') - ->field('u.account,u.register_time,u.cumulative,fgame_id,fgame_name,u.lock_status,DATEDIFF(curdate(),FROM_UNIXTIME(u.register_time,"%Y-%m-%d")) as day') - ->join('tab_merchandise as m on ((m.status = 3 or m.status=0 or m.status = 4) and m.small_id = u.id) ') - // 查询条件 - ->where($map) - /* 默认通过id逆序排列 */ - ->order('u.register_time desc') - /* 执行查询 */ - ->select(); - foreach($data as $k=>$v) { - $data[$k]['register_time'] = date('Y-m-d H:i:s',$v['register_time']); - $data[$k]['lock_status'] = '已锁定'; - } - - $xlsData = $data; - } - - $this->exportExcel($xlsName, $xlsCell, $xlsData); - - } - - /** - * 商品列表 - * @author 鹿文学 - */ - public function merchandise() { - $xlsName = $_REQUEST['xlsname']; - - $xlsCell = array( - array('id','商品ID'), - array('title','商品信息'), - array('user_account','卖家账号'), - array('day','创建天数'), - array('accumulation','累计充值'), - array('price','售价'), - array('status','状态'), - array('create_time','发布时间'), - ); - - if(!empty($_REQUEST['account'])) {$extend['user_account']=array('like','%'.$_REQUEST['account'].'%');} - if(!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {$extend['create_time'] = array('between',[strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+86399]);} - elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {$extend['create_time'] = array('between',[strtotime($_REQUEST['timestart']),time()]);} - elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {$extend['create_time'] = array('egt',strtotime($_REQUEST['timeend'])+86399);} - if(is_numeric($_REQUEST['game_id']) && $_REQUEST['game_id']>0) {$extend['game_id']=$_REQUEST['game_id'];} - if(is_numeric($_REQUEST['status'])) {$extend['status']=$_REQUEST['status'];} - if(!empty($_REQUEST['keyword'])) {$extend['game_name|title|server_name|small_account']=array('like','%'.$_REQUEST['keyword'].'%');} + // 新增用户 + if ($key == 'news'){ + $hoursnews = $user->newsAdd(['register_time'=>['between',[$starttime,$endtime]]],'news','time',5); + } + if ($key == 'active'){ + // 活跃用户 + $hoursactive = $user->totalPlayerByGroup(['tab_user_login_record.login_time'=>['between',[$starttime,$endtime]]],'active','time',true,5); + }if ($key == 'player'){ + // 付费用户 + $hoursplayer = $spend->totalPlayerByGroup(['pay_time'=>['between',[$starttime,$endtime]]],'player','time',5); + } + + foreach($hours as $v) { + foreach($hoursnews as $h) { + $time = explode(' ',$h['time']); + if (strpos($v,$time[1]) !== false) { + $data['news'][$v] = (integer)$h['news'];break; + } + } + + foreach($hoursactive as $h) { + $time = explode(' ',$h['time']); + if (strpos($v,$time[1]) !== false) { + $data['active'][$v] = (integer)$h['active'];break; + } + } + + foreach($hoursplayer as $h) { + $time = explode(' ',$h['time']); + if (strpos($v,$time[1]) !== false) { + $data['player'][$v] = (integer)$h['player'];break; + } + } + + + } + } else { + + $datelist = get_date_list($starttime,$endtime,$num==7?2:1); + + $flag = 0; + + foreach($datelist as $k => $v) { + if ($key == 'news'){ + $data['news'][$v] = 0;} + if ($key == 'active'){ + $data['active'][$v] = 0;} + if ($key == 'player'){ + $data['player'][$v] = 0;} + + } + if ($key == 'news'){ + // 新增用户 + $news = $user->newsAdd(['register_time'=>['between',[$starttime,$endtime]]],'news','time',$num==7?2:1); + } + if ($key == 'active'){ + // 活跃用户 + $active = $user->totalPlayerByGroup(['tab_user_login_record.login_time'=>['between',[$starttime,$endtime]]],'active','time',true,$num==7?2:1); + } + if ($key == 'player'){ + // 付费用户 + $player = $spend->totalPlayerByGroup(['pay_time'=>['between',[$starttime,$endtime]]],'player','time',$num==7?2:1); + } + foreach($datelist as $v) { + foreach($news as $h) { + if ($v == $h['time']) { + $data['news'][$v] = (integer)$h['news'];break; + } + } + + foreach($active as $h) { + if ($v == $h['time']) { + $data['active'][$v] = (integer)$h['active'];break; + } + } + + foreach($player as $h) { + if ($v == $h['time']) { + $data['player'][$v] = (integer)$h['player'];break; + } + } + + } + + } + + foreach ($data as $k => $v) { + $sum = 0;$tempexport=[]; + foreach($v as $t => $s){ + $sum += $s; + if($flag==1){ + $tempexport[]=['time'=>((integer)substr($t,0,2)).':00','count'=>$s]; + }else{ + $tempexport[]=['time'=>$t,'count'=>$s]; + } + } + $export[$k]=$tempexport; + $export['sum'][$k]=$sum; + } + + $xlsData = $export[$key]; + $xlsSummary[] = $export['sum'][$key]; + } - if(!empty($_REQUEST['id'])) {$extend['id'] = $_REQUEST['id'];} - - $merchandise = M('Merchandise','tab_'); - - $data = $merchandise->field('id,title,game_name,server_name,small_account,user_account,day,accumulation,price,status,create_time') - ->where($extend) - ->order('id desc')->select(); - - foreach($data as $k=>$v) { - $data[$k]['create_time'] = date('Y-m-d H:i:s',$v['create_time']); - $data[$k]['status'] = get_info_status($v['status'],41); - } - $xlsData = $data; + $this->exportExcel($xlsName, $xlsCell, $xlsData); + } + + + /** + * 小号列表 + * @author 鹿文学 + */ + public function small_list() { + + $xlsName = $_REQUEST['xlsname']; + + $xlsCell = array( + array('account','小号'), + array('fgame_name','游戏名称'), + array('day','创建天数'), + array('cumulative','累计充值'), + array('register_time','创建时间'), + array('lock_status','状态'), + ); - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $pid = intval($_GET['id']); + $xlsData = []; + if(is_numeric($pid) && $pid>0) { - } + $map['u.puid'] = $pid; + + if($_REQUEST['small']) {$map['u.account']=array('like','%'.$_REQUEST['small'].'%');} + + $data = M('User', 'tab_')->alias('u') + ->field('u.account,u.register_time,u.cumulative,fgame_id,fgame_name,u.lock_status,DATEDIFF(curdate(),FROM_UNIXTIME(u.register_time,"%Y-%m-%d")) as day') + ->join('tab_merchandise as m on ((m.status = 3 or m.status=0 or m.status = 4) and m.small_id = u.id) ') + // 查询条件 + ->where($map) + /* 默认通过id逆序排列 */ + ->order('u.register_time desc') + /* 执行查询 */ + ->select(); + foreach($data as $k=>$v) { + $data[$k]['register_time'] = date('Y-m-d H:i:s',$v['register_time']); + $data[$k]['lock_status'] = '已锁定'; + } + + $xlsData = $data; + } + + $this->exportExcel($xlsName, $xlsCell, $xlsData); + + } + + /** + * 商品列表 + * @author 鹿文学 + */ + public function merchandise() { + $xlsName = $_REQUEST['xlsname']; + + $xlsCell = array( + array('id','商品ID'), + array('title','商品信息'), + array('user_account','卖家账号'), + array('day','创建天数'), + array('accumulation','累计充值'), + array('price','售价'), + array('status','状态'), + array('create_time','发布时间'), + ); - /** - * 订单列表 - * @author 鹿文学 - */ - public function order_list() { - - $xlsName = $_REQUEST['xlsname']; - - $xlsCell = array( + if(!empty($_REQUEST['account'])) {$extend['user_account']=array('like','%'.$_REQUEST['account'].'%');} + if(!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {$extend['create_time'] = array('between',[strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+86399]);} + elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {$extend['create_time'] = array('between',[strtotime($_REQUEST['timestart']),time()]);} + elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {$extend['create_time'] = array('egt',strtotime($_REQUEST['timeend'])+86399);} + if(is_numeric($_REQUEST['game_id']) && $_REQUEST['game_id']>0) {$extend['game_id']=$_REQUEST['game_id'];} + if(is_numeric($_REQUEST['status'])) {$extend['status']=$_REQUEST['status'];} + if(!empty($_REQUEST['keyword'])) {$extend['game_name|title|server_name|small_account']=array('like','%'.$_REQUEST['keyword'].'%');} + + if(!empty($_REQUEST['id'])) {$extend['id'] = $_REQUEST['id'];} + + $merchandise = M('Merchandise','tab_'); + + $data = $merchandise->field('id,title,game_name,server_name,small_account,user_account,day,accumulation,price,status,create_time') + ->where($extend) + ->order('id desc')->select(); + + foreach($data as $k=>$v) { + $data[$k]['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + $data[$k]['status'] = get_info_status($v['status'],41); + } + + $xlsData = $data; + + + $this->exportExcel($xlsName, $xlsCell, $xlsData); + + } + + /** + * 订单列表 + * @author 鹿文学 + */ + public function order_list() { + + $xlsName = $_REQUEST['xlsname']; + + $xlsCell = array( // array('id','编号'), - array('order_number','订单号'), - array('title','商品信息'), + array('order_number','订单号'), + array('title','商品信息'), // array('game_name','游戏名称'), // array('server_name','区服名称'), // array('small_account','小号账户'), // array('seller_account','卖家账号'), - //// array('phone','卖家手机号'), - array('buyer_account','交易用户'), - array('order_price','售价'), - array('poundage','手续费'), - array('pay_status','状态'), - array('order_time','下单时间'), + //// array('phone','卖家手机号'), + array('buyer_account','交易用户'), + array('order_price','售价'), + array('poundage','手续费'), + array('pay_status','状态'), + array('order_time','下单时间'), // array('pay_time','付款时间'), // array('send_time','发货时间'), - ); - - if(!empty($_REQUEST['order_number'])) {$extend['order_number']=array('like','%'.$_REQUEST['order_number'].'%');} - if(!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {$extend['order_time'] = array('between',[strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+86399]);} - elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {$extend['order_time'] = array('between',[strtotime($_REQUEST['timestart']),time()]);} - elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {$extend['order_time'] = array('egt',strtotime($_REQUEST['timeend'])+86399);} - if(is_numeric($_REQUEST['game_id']) && $_REQUEST['game_id']>0) {$extend['game_id']=$_REQUEST['game_id'];} - if(is_numeric($_REQUEST['pay_status'])) {$extend['pay_status']=$_REQUEST['pay_status'];} - if(!empty($_REQUEST['keyword'])) {$extend['game_name|title|server_name|small_account']=array('like','%'.$_REQUEST['keyword'].'%');} + ); - $data = M('Order','tab_')->alias('o')->field('o.id,o.order_number,o.seller_account,o.buyer_account,o.order_price,o.poundage,o.pay_status,o.order_time,o.pay_time,o.send_time,m.game_name,m.server_name,m.small_account,m.title,m.phone') - ->join('tab_merchandise as m on (m.id = o.merchandise_id)') - ->where($extend)->order('id desc')->select(); + if(!empty($_REQUEST['order_number'])) {$extend['order_number']=array('like','%'.$_REQUEST['order_number'].'%');} + if(!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {$extend['order_time'] = array('between',[strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+86399]);} + elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {$extend['order_time'] = array('between',[strtotime($_REQUEST['timestart']),time()]);} + elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {$extend['order_time'] = array('egt',strtotime($_REQUEST['timeend'])+86399);} + if(is_numeric($_REQUEST['game_id']) && $_REQUEST['game_id']>0) {$extend['game_id']=$_REQUEST['game_id'];} + if(is_numeric($_REQUEST['pay_status'])) {$extend['pay_status']=$_REQUEST['pay_status'];} + if(!empty($_REQUEST['keyword'])) {$extend['game_name|title|server_name|small_account']=array('like','%'.$_REQUEST['keyword'].'%');} - foreach($data as $k=>$v) { - $data[$k]['order_time'] = $v['order_time']?date('Y-m-d H:i:s',$v['order_time']):''; - $data[$k]['pay_time'] = $v['pay_time']?date('Y-m-d H:i:s',$v['pay_time']):''; - $data[$k]['send_time'] = $v['send_time']?date('Y-m-d H:i:s',$v['send_time']):''; - $data[$k]['pay_status'] = get_info_status($v['pay_status'],38); - } + $data = M('Order','tab_')->alias('o')->field('o.id,o.order_number,o.seller_account,o.buyer_account,o.order_price,o.poundage,o.pay_status,o.order_time,o.pay_time,o.send_time,m.game_name,m.server_name,m.small_account,m.title,m.phone') + ->join('tab_merchandise as m on (m.id = o.merchandise_id)') + ->where($extend)->order('id desc')->select(); - $xlsData = $data; + foreach($data as $k=>$v) { + $data[$k]['order_time'] = $v['order_time']?date('Y-m-d H:i:s',$v['order_time']):''; + $data[$k]['pay_time'] = $v['pay_time']?date('Y-m-d H:i:s',$v['pay_time']):''; + $data[$k]['send_time'] = $v['send_time']?date('Y-m-d H:i:s',$v['send_time']):''; + $data[$k]['pay_status'] = get_info_status($v['pay_status'],38); + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $xlsData = $data; - } + $this->exportExcel($xlsName, $xlsCell, $xlsData); - /** - * 用户金币提现记录列表 - * @author 鹿文学 - */ - public function user_withdraw() { + } - $xlsName = $_REQUEST['xlsname']; + /** + * 用户金币提现记录列表 + * @author 鹿文学 + */ + public function user_withdraw() { - $xlsCell = array( - array('id','编号'), - array('order_number','提现单号'), - array('user_account','账号'), - array('coin','提现金币'), - array('poundage','手续费'), - array('money','实际到账'), - array('gold_coin_balance','金币余额'), - array('alipay','提现支付宝'), - array('create_time','提现时间'), - array('status','提现状态'), - ); + $xlsName = $_REQUEST['xlsname']; - if(!empty($_REQUEST['order_number'])) {$extend['order_number']=array('like','%'.$_REQUEST['order_number'].'%');} - if(!empty($_REQUEST['account'])) {$extend['user_account']=array('like','%'.$_REQUEST['account'].'%');} - if(!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {$extend['create_time'] = array('between',[strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+86399]);} - elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {$extend['create_time'] = array('between',[strtotime($_REQUEST['timestart']),time()]);} - elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {$extend['create_time'] = array('egt',strtotime($_REQUEST['timeend'])+86399);} - if(!empty($_REQUEST['alipay'])) {$extend['alipay']=array('like','%'.$_REQUEST['alipay'].'%');} - if(is_numeric($_REQUEST['status'])) {$extend['status']=$_REQUEST['status'];} + $xlsCell = array( + array('id','编号'), + array('order_number','提现单号'), + array('user_account','账号'), + array('coin','提现金币'), + array('poundage','手续费'), + array('money','实际到账'), + array('gold_coin_balance','金币余额'), + array('alipay','提现支付宝'), + array('create_time','提现时间'), + array('status','提现状态'), + ); - $wgc = M('WithdrawGoldCoin','tab_'); + if(!empty($_REQUEST['order_number'])) {$extend['order_number']=array('like','%'.$_REQUEST['order_number'].'%');} + if(!empty($_REQUEST['account'])) {$extend['user_account']=array('like','%'.$_REQUEST['account'].'%');} + if(!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {$extend['create_time'] = array('between',[strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+86399]);} + elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {$extend['create_time'] = array('between',[strtotime($_REQUEST['timestart']),time()]);} + elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {$extend['create_time'] = array('egt',strtotime($_REQUEST['timeend'])+86399);} + if(!empty($_REQUEST['alipay'])) {$extend['alipay']=array('like','%'.$_REQUEST['alipay'].'%');} + if(is_numeric($_REQUEST['status'])) {$extend['status']=$_REQUEST['status'];} - $data = $wgc->field('id,order_number,user_account,coin,poundage,money,gold_coin_balance,status,alipay,create_time') - ->where($extend) - ->order('id desc')->select(); + $wgc = M('WithdrawGoldCoin','tab_'); - foreach($data as $k=>$v) { - $data[$k]['create_time'] = date('Y-m-d H:i:s',$v['create_time']); - $data[$k]['status'] = get_info_status($v['status'],39); - } + $data = $wgc->field('id,order_number,user_account,coin,poundage,money,gold_coin_balance,status,alipay,create_time') + ->where($extend) + ->order('id desc')->select(); + foreach($data as $k=>$v) { + $data[$k]['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + $data[$k]['status'] = get_info_status($v['status'],39); + } - $xlsData = $data; - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $xlsData = $data; - } + $this->exportExcel($xlsName, $xlsCell, $xlsData); + } - /** - * 应用概况 - * @author 鹿文学 - */ - public function device_survey() { - $xlsName = $_REQUEST['xlsname'].'_'.$_REQUEST['name']; + /** + * 应用概况 + * @author 鹿文学 + */ + public function device_survey() { - $num = I('num',2); - $key = $_REQUEST['key']; + $xlsName = $_REQUEST['xlsname'].'_'.$_REQUEST['name']; - if($key=='model') { - $xlsCell = array( - array('model',$_REQUEST['name']), - array('version','系统版本'), - array('count','数量'), - ); - } else { - $xlsCell = array( - array('time','日期'), - array('version','系统版本'), - array('count',$_REQUEST['name']), - ); - } + $num = I('num',2); + $key = $_REQUEST['key']; - if (is_file(dirname(__FILE__).'/device_data_foldline.txt')) { + if($key=='model') { + $xlsCell = array( + array('model',$_REQUEST['name']), + array('version','系统版本'), + array('count','数量'), + ); + } else { + $xlsCell = array( + array('time','日期'), + array('version','系统版本'), + array('count',$_REQUEST['name']), + ); + } - $filetxt = file_get_contents(dirname(__FILE__).'/device_data_foldline.txt'); + if (is_file(dirname(__FILE__).'/device_data_foldline.txt')) { - $data = json_decode($filetxt,true); + $filetxt = file_get_contents(dirname(__FILE__).'/device_data_foldline.txt'); - $xlsData = $data[$key]; + $data = json_decode($filetxt,true); - $xlsSummary[] = $data['sum'][$key]; + $xlsData = $data[$key]; - } else { + $xlsSummary[] = $data['sum'][$key]; - $start = I('start',date('Y-m-d',strtotime('-1 day'))); + } else { - $end = I('end',date('Y-m-d',strtotime('-1 day'))); + $start = I('start',date('Y-m-d',strtotime('-1 day'))); - $starttime = strtotime($start); - $endtime = strtotime($end)+86399; + $end = I('end',date('Y-m-d',strtotime('-1 day'))); - $device = D('DeviceRecord'); + $starttime = strtotime($start); + $endtime = strtotime($end)+86399; - $flag = 1; + $device = D('DeviceRecord'); - if ($start == $end) { + $flag = 1; - $hours = ['00~01','02~03','04~05','06~07','08~09','10~11','12~13','14~15','16~17','18~19','20~21','22~23']; + if ($start == $end) { - foreach($hours as $v) { - if ($key == 'news'){ - $data['news']['ios'][$v] = 0; - $data['news']['and'][$v] = 0; - } - if ($key == 'active'){ - $data['active']['ios'][$v] = 0; - $data['active']['and'][$v] = 0; - } - } + $hours = ['00~01','02~03','04~05','06~07','08~09','10~11','12~13','14~15','16~17','18~19','20~21','22~23']; - // 新增设备 -if ($key == 'news'){ - $hoursnews = $device->news_on_time(['create_time'=>['between',[$starttime,$endtime]]],'news',5,'time,version'); + foreach($hours as $v) { + if ($key == 'news'){ + $data['news']['ios'][$v] = 0; + $data['news']['and'][$v] = 0; + } + if ($key == 'active'){ + $data['active']['ios'][$v] = 0; + $data['active']['and'][$v] = 0; + } + } - foreach($hours as $v) { - foreach($hoursnews as $h) { - $time = explode(' ',$h['time']); - if (strpos($v,$time[1]) !== false) { - $data['news'][$h['version']==1?'and':'ios'][$v] += (integer)$h['news']; - } - } - } + // 新增设备 + if ($key == 'news'){ + $hoursnews = $device->news_on_time(['create_time'=>['between',[$starttime,$endtime]]],'news',5,'time,version'); -} -if ($key == 'active'){ - // 活跃设备 - $hoursactive = $device->active_on_time(['create_time'=>['between',[$starttime,$endtime]]],'active',5,'time,version'); - foreach($hours as $v) { - foreach($hoursactive as $h) { - $time = explode(' ',$h['time']); - if (strpos($v,$time[1]) !== false) { - $data['active'][$h['version']==1?'and':'ios'][$v] += (integer)$h['active']; - } - } - } -} -if ($key == 'model'){ - // 启动机型 - $hoursmodel = $device->model(['create_time'=>['between',[$starttime,$endtime]]]); + foreach($hours as $v) { + foreach($hoursnews as $h) { + $time = explode(' ',$h['time']); + if (strpos($v,$time[1]) !== false) { + $data['news'][$h['version']==1?'and':'ios'][$v] += (integer)$h['news']; + } + } + } + + } + if ($key == 'active'){ + // 活跃设备 + $hoursactive = $device->active_on_time(['create_time'=>['between',[$starttime,$endtime]]],'active',5,'time,version'); + foreach($hours as $v) { + foreach($hoursactive as $h) { + $time = explode(' ',$h['time']); + if (strpos($v,$time[1]) !== false) { + $data['active'][$h['version']==1?'and':'ios'][$v] += (integer)$h['active']; + } + } + } + } + if ($key == 'model'){ + // 启动机型 + $hoursmodel = $device->model(['create_time'=>['between',[$starttime,$endtime]]]); - foreach($hoursmodel as $k=>$h) { - $data['model'][$h['version']==1?'and':'ios'][$h['model']] = (integer)$h['count']; - } + foreach($hoursmodel as $k=>$h) { + $data['model'][$h['version']==1?'and':'ios'][$h['model']] = (integer)$h['count']; + } -} + } - } else { + } else { - $datelist = get_date_list($starttime,$endtime,$num==7?2:1); + $datelist = get_date_list($starttime,$endtime,$num==7?2:1); - $flag = 0; + $flag = 0; - foreach($datelist as $k => $v) { - if ($key == 'news'){ - $data['news']['ios'][$v] = 0; - $data['news']['and'][$v] = 0; - } - if ($key == 'active'){ - $data['active']['ios'][$v] = 0; - $data['active']['and'][$v] = 0; - } + foreach($datelist as $k => $v) { + if ($key == 'news'){ + $data['news']['ios'][$v] = 0; + $data['news']['and'][$v] = 0; + } + if ($key == 'active'){ + $data['active']['ios'][$v] = 0; + $data['active']['and'][$v] = 0; + } - } -if ($key == 'news'){ - // 新增设备 - $news = $device->news_on_time(['create_time'=>['between',[$starttime,$endtime]]],'news',$num==7?2:1,'time,version'); - foreach($datelist as $v) { - foreach($news as $h) { - if ($v == $h['time']) { - $data['news'][$h['version']==1?'and':'ios'][$v] += (integer)$h['news']; - } - } - } -} -if ($key == 'active'){ - // 活跃设备 - $active = $device->active_on_time(['create_time'=>['between',[$starttime,$endtime]]],'active',$num==7?2:1,'time,version'); - foreach($datelist as $v) { - foreach($active as $h) { - if ($v == $h['time']) { - $data['active'][$h['version']==1?'and':'ios'][$v] += (integer)$h['active']; - } - } - - } -} -if ($key == 'model'){ - // 启动机型 - $model = $device->model(['create_time'=>['between',[$starttime,$endtime]]]); + } + if ($key == 'news'){ + // 新增设备 + $news = $device->news_on_time(['create_time'=>['between',[$starttime,$endtime]]],'news',$num==7?2:1,'time,version'); + foreach($datelist as $v) { + foreach($news as $h) { + if ($v == $h['time']) { + $data['news'][$h['version']==1?'and':'ios'][$v] += (integer)$h['news']; + } + } + } + } + if ($key == 'active'){ + // 活跃设备 + $active = $device->active_on_time(['create_time'=>['between',[$starttime,$endtime]]],'active',$num==7?2:1,'time,version'); + foreach($datelist as $v) { + foreach($active as $h) { + if ($v == $h['time']) { + $data['active'][$h['version']==1?'and':'ios'][$v] += (integer)$h['active']; + } + } - foreach($model as $k=>$h) { - $data['model'][$h['version']==1?'and':'ios'][$h['model']] = (integer)$h['count']; - } + } + } + if ($key == 'model'){ + // 启动机型 + $model = $device->model(['create_time'=>['between',[$starttime,$endtime]]]); -} + foreach($model as $k=>$h) { + $data['model'][$h['version']==1?'and':'ios'][$h['model']] = (integer)$h['count']; + } + } - } - foreach ($data as $k => $v) { - $sum = 0;$tempexport=[]; - if($k == 'model') { - foreach($v['ios'] as $t => $s){ - $tempexport[] = ['model'=>$t,'count'=>$s,'version'=>'ios']; - } - foreach($v['and'] as $t => $s){ - $tempexport[] = ['model'=>$t,'count'=>$s,'version'=>'android']; - } - } else { - foreach($v['ios'] as $t => $s){ - $sum += $s; - if($flag==1){ - $tempexport[]=['time'=>$start.' '.(substr($t,0,2)).':00','count'=>$s,'version'=>'ios']; - }else{ - $tempexport[]=['time'=>$t,'count'=>$s,'version'=>'ios']; - } - } + } - foreach($v['and'] as $t => $s){ - $sum += $s; - if($flag==1){ - $tempexport[]=['time'=>$start.' '.(substr($t,0,2)).':00','count'=>$s,'version'=>'android']; - }else{ - $tempexport[]=['time'=>$t,'count'=>$s,'version'=>'android']; - } - } - } - $export[$k]=$tempexport; - $export['sum'][$k]=$sum; - } + foreach ($data as $k => $v) { + $sum = 0;$tempexport=[]; + if($k == 'model') { + foreach($v['ios'] as $t => $s){ + $tempexport[] = ['model'=>$t,'count'=>$s,'version'=>'ios']; + } + foreach($v['and'] as $t => $s){ + $tempexport[] = ['model'=>$t,'count'=>$s,'version'=>'android']; + } + } else { + foreach($v['ios'] as $t => $s){ + $sum += $s; + if($flag==1){ + $tempexport[]=['time'=>$start.' '.(substr($t,0,2)).':00','count'=>$s,'version'=>'ios']; + }else{ + $tempexport[]=['time'=>$t,'count'=>$s,'version'=>'ios']; + } + } + + foreach($v['and'] as $t => $s){ + $sum += $s; + if($flag==1){ + $tempexport[]=['time'=>$start.' '.(substr($t,0,2)).':00','count'=>$s,'version'=>'android']; + }else{ + $tempexport[]=['time'=>$t,'count'=>$s,'version'=>'android']; + } + } + } + $export[$k]=$tempexport; + $export['sum'][$k]=$sum; + } - $xlsData = $export[$key]; - $xlsSummary[] = $export['sum'][$key]; - } + $xlsData = $export[$key]; + $xlsSummary[] = $export['sum'][$key]; + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 投放平台 - * @author 鹿文学 - */ - public function platform() { + /** + * 投放平台 + * @author 鹿文学 + */ + public function platform() { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - $map['status'] = 1; + $map['status'] = 1; - if($_REQUEST['group']==1) { + if($_REQUEST['group']==1) { - $xlsCell = array( - array('id','编号'), - array('name','名称'), - array('promote_account','渠道'), - array('create_time','创建时间'), - array('update_time','最后更新时间'), - ); + $xlsCell = array( + array('id','编号'), + array('name','名称'), + array('promote_account','渠道'), + array('create_time','创建时间'), + array('update_time','最后更新时间'), + ); - $map['mark'] = 1; - } else { + $map['mark'] = 1; + } else { - $xlsCell = array( - array('id','编号'), - array('name','名称'), - array('create_time','创建时间'), - array('update_time','最后更新时间'), - ); + $xlsCell = array( + array('id','编号'), + array('name','名称'), + array('create_time','创建时间'), + array('update_time','最后更新时间'), + ); - $map['mark'] = 0; - } + $map['mark'] = 0; + } - if(!empty($_REQUEST['name'])) {$map['name']=array('like','%'.$_REQUEST['name'].'%');} - if(!empty($_REQUEST['promote_id'])) {$map['promote_id']=$_REQUEST['promote_id'];} + if(!empty($_REQUEST['name'])) {$map['name']=array('like','%'.$_REQUEST['name'].'%');} + if(!empty($_REQUEST['promote_id'])) {$map['promote_id']=$_REQUEST['promote_id'];} - $platform = D('LaunchPlatform'); + $platform = D('LaunchPlatform'); - $data = $platform->all_lists($map); + $data = $platform->all_lists($map); - foreach($data as $k => $v) { - $data[$k]['create_time'] = date('Y-m-d H:i:s',$v['create_time']); - $data[$k]['update_time'] = date('Y-m-d H:i:s',$v['update_time']); - } + foreach($data as $k => $v) { + $data[$k]['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + $data[$k]['update_time'] = date('Y-m-d H:i:s',$v['update_time']); + } - $xlsData = $data; + $xlsData = $data; - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 投放数据统计 - * @author 鹿文学 - */ - public function launch_data($p=1) { + /** + * 投放数据统计 + * @author 鹿文学 + */ + public function launch_data($p=1) { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - $xlsCell = array( - array('duration','日期'), - array('platform_name','投放平台'), - array('game_name','游戏名称'), - array('new','新增用户数'), - array('new_device','新增设备'), - array('new_pay','新增付费数'), - array('new_rate','新增付费率'), - array('new_money','新增付费金额'), - array('active','活跃用户数'), - array('active_pay','活跃付费人数'), - array('active_money','活跃付费金额'), - array('active_rate','活跃付费率'), - array('active_arpu','活跃ARPU'), - array('pay_arpu','付费ARPU'), - ); + $xlsCell = array( + array('duration','日期'), + array('platform_name','投放平台'), + array('game_name','游戏名称'), + array('new','新增用户数'), + array('new_device','新增设备'), + array('new_pay','新增付费数'), + array('new_rate','新增付费率'), + array('new_money','新增付费金额'), + array('active','活跃用户数'), + array('active_pay','活跃付费人数'), + array('active_money','活跃付费金额'), + array('active_rate','活跃付费率'), + array('active_arpu','活跃ARPU'), + array('pay_arpu','付费ARPU'), + ); - if (is_file(dirname(__FILE__).'/access_data_launch.txt')) { + if (is_file(dirname(__FILE__).'/access_data_launch.txt')) { - $filetxt = file_get_contents(dirname(__FILE__).'/access_data_launch.txt'); + $filetxt = file_get_contents(dirname(__FILE__).'/access_data_launch.txt'); - $data = json_decode($filetxt,true); + $data = json_decode($filetxt,true); - } else { - $page = intval($p); - $page = $page ? $page : 1; //默认显示第一页数据 - if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}//10; + } else { + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}//10; - $currentdate = mktime(0,0,0,date('m'),date('d'),date('Y')); + $currentdate = mktime(0,0,0,date('m'),date('d'),date('Y')); - $map = array(); - if(is_numeric($_REQUEST['game_id']) && $_REQUEST['game_id']>0) {$map['game_id']=$_REQUEST['game_id'];} - if(is_numeric($_REQUEST['promote_id']) && $_REQUEST['promote_id']>0) {$map['promote_id']=$_REQUEST['promote_id'];} - if(is_numeric($_REQUEST['platform_id']) && $_REQUEST['platform_id']>0) {$map['platform_id']=$_REQUEST['platform_id'];} + $map = array(); + if(is_numeric($_REQUEST['game_id']) && $_REQUEST['game_id']>0) {$map['game_id']=$_REQUEST['game_id'];} + if(is_numeric($_REQUEST['promote_id']) && $_REQUEST['promote_id']>0) {$map['promote_id']=$_REQUEST['promote_id'];} + if(is_numeric($_REQUEST['platform_id']) && $_REQUEST['platform_id']>0) {$map['platform_id']=$_REQUEST['platform_id'];} - $launchrecord = D('LaunchRecord'); + $launchrecord = D('LaunchRecord'); - if(!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { - $start = strtotime($_REQUEST['timestart']); - $end = strtotime($_REQUEST['timeend']); - if($start<=$end){ - if($end>=$currentdate) { + if(!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { + $start = strtotime($_REQUEST['timestart']); + $end = strtotime($_REQUEST['timeend']); + if($start<=$end){ + if($end>=$currentdate) { - $data = $launchrecord->lists($p,$map,$start,$currentdate+86399); + $data = $launchrecord->lists($p,$map,$start,$currentdate+86399); - } else { + } else { - $data = $launchrecord->data($p,$map,array('duration'=>['between',[$start,$end+86399]])); + $data = $launchrecord->data($p,$map,array('duration'=>['between',[$start,$end+86399]])); - } - } - } elseif(!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) { - $start = strtotime($_REQUEST['timestart']); + } + } + } elseif(!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) { + $start = strtotime($_REQUEST['timestart']); - $data = $launchrecord->lists($p,$map,$start,$currentdate+86399); + $data = $launchrecord->lists($p,$map,$start,$currentdate+86399); - } elseif(empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { - $end = strtotime($_REQUEST['timeend']); - if($end>=$currentdate) { + } elseif(empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { + $end = strtotime($_REQUEST['timeend']); + if($end>=$currentdate) { - $data = $launchrecord->lists($p,$map,'',$currentdate+86399); + $data = $launchrecord->lists($p,$map,'',$currentdate+86399); - } else { + } else { - $data = $launchrecord->data($p,$map,array('duration'=>['lt',$end+86399])); + $data = $launchrecord->data($p,$map,array('duration'=>['lt',$end+86399])); - } - } else { + } + } else { - $data = $launchrecord->data($p,$map,array('duration'=>['lt',$currentdate])); + $data = $launchrecord->data($p,$map,array('duration'=>['lt',$currentdate])); - } + } - $current = $data['current']; - $total = $data['total']; - $current['duration'] = '当页汇总'; - $total['duration'] = '全部汇总'; - $data = $data['data']; + $current = $data['current']; + $total = $data['total']; + $current['duration'] = '当页汇总'; + $total['duration'] = '全部汇总'; + $data = $data['data']; - if($map['game_id']) {$total['game_id']=$current['game_id']=$map['game_id'];} - if($map['platform_id']) {$total['platform_id']=$current['platform_id']=$map['platform_id'];} + if($map['game_id']) {$total['game_id']=$current['game_id']=$map['game_id'];} + if($map['platform_id']) {$total['platform_id']=$current['platform_id']=$map['platform_id'];} - $data[] = $current; - $data[] = $total; + $data[] = $current; + $data[] = $total; - } + } - foreach ($data as $v) { - if(is_numeric($v['duration'])) { - $v['platform_name'] = get_launch_platform_name($v['platform_id'],'全部'); - $v['game_name'] = get_game_name_by_id($v['game_id'],'全部'); - $v['duration'] = date('Y-m-d',$v['duration']); - } else { - $v['platform_name'] = get_launch_platform_name($v['platform_id'],'--'); - $v['game_name'] = get_game_name_by_id($v['game_id'],'--'); - } + foreach ($data as $v) { + if(is_numeric($v['duration'])) { + $v['platform_name'] = get_launch_platform_name($v['platform_id'],'全部'); + $v['game_name'] = get_game_name_by_id($v['game_id'],'全部'); + $v['duration'] = date('Y-m-d',$v['duration']); + } else { + $v['platform_name'] = get_launch_platform_name($v['platform_id'],'--'); + $v['game_name'] = get_game_name_by_id($v['game_id'],'--'); + } - $xlsData[] = $v; - } + $xlsData[] = $v; + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + $this->exportExcel($xlsName, $xlsCell, $xlsData); + } - /** - * 登录记录 - * @author 鹿文学 - */ + /** + * 登录记录 + * @author 鹿文学 + */ public function login_record() { $xlsName = $_REQUEST['xlsname']; @@ -3804,6 +3916,16 @@ if ($key == 'model'){ $map['user_account'] = array('like', '%' . trim($_REQUEST['account']) . '%'); } +// $promoteRoot = getPowerPromoteIds(); +// $data_empower_type = session('user_auth')['data_empower_type']; +// +// if ($promoteRoot) { +// $map['promote_id'] =array('in',$promoteRoot); +// } else if(!$promoteRoot&&$data_empower_type!=1){ +// $map['id'] = array('lt',1); +// } + setPowerPromoteIds($map,'promote_id'); + if (isset($_REQUEST['promote_id'])) { $map['promote_id'] = $_REQUEST['promote_id']; } @@ -3878,1049 +4000,1075 @@ if ($key == 'model'){ } - /** - * 账户修改记录 - * @author 鹿文学 - */ - public function account_updatelist() { - - $xlsName = $_REQUEST['xlsname']; - - $xlsCell = array( - array('user_account','玩家账号'), - array('game_name','游戏名称'), - array('type','货币类型'), - array('prev_amount','修改前余额'), - array('amount','修改后余额'), - array('create_time','修改时间'), - array('op_account','操作人员'), - ); - - if (isset($_REQUEST['login_ip'])) { - $map['login_ip'] = $_REQUEST['login_ip']; - } - if (isset($_REQUEST['game_id'])) { - $map['game_id'] = $_REQUEST['game_id']; - } - if (isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])) { - $map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 24 * 60 * 60 - 1)); - }elseif(isset($_REQUEST['timestart'])){ - $map['create_time'] = array('GT',strtotime($_REQUEST['timestart'])); - }elseif(isset($_REQUEST['timeend'])){ - $map['create_time'] = array('lt',(strtotime($_REQUEST['timeend'])+ 24 * 60 * 60 - 1)); - } - if (isset($_REQUEST['account'])) { - $map['user_account'] = array('like', '%' . trim($_REQUEST['account']) . '%'); - } - if(isset($_REQUEST['huobi'])){ - $map['type'] = $_REQUEST['huobi']; - } - if(!empty($_REQUEST['op_account'])){ - $map['op_account'] = trim($_REQUEST['op_account']); - } - - $page = intval($_REQUEST['p']); - - $page = $page?$page:1; - - $row = $_REQUEST['row']?$_REQUEST['row']:10; - - $data=M('balance_edit','tab_') + /** + * 账户修改记录 + * @author 鹿文学 + */ + public function account_updatelist() { + + $xlsName = $_REQUEST['xlsname']; + + $xlsCell = array( + array('user_account','玩家账号'), + array('game_name','游戏名称'), + array('type','货币类型'), + array('prev_amount','修改前余额'), + array('amount','修改后余额'), + array('create_time','修改时间'), + array('op_account','操作人员'), + ); + + if (isset($_REQUEST['login_ip'])) { + $map['login_ip'] = $_REQUEST['login_ip']; + } + if (isset($_REQUEST['game_id'])) { + $map['game_id'] = $_REQUEST['game_id']; + } + if (isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])) { + $map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 24 * 60 * 60 - 1)); + }elseif(isset($_REQUEST['timestart'])){ + $map['create_time'] = array('GT',strtotime($_REQUEST['timestart'])); + }elseif(isset($_REQUEST['timeend'])){ + $map['create_time'] = array('lt',(strtotime($_REQUEST['timeend'])+ 24 * 60 * 60 - 1)); + } + if (isset($_REQUEST['account'])) { + $map['user_account'] = array('like', '%' . trim($_REQUEST['account']) . '%'); + } + if(isset($_REQUEST['huobi'])){ + $map['type'] = $_REQUEST['huobi']; + } + if(!empty($_REQUEST['op_account'])){ + $map['op_account'] = trim($_REQUEST['op_account']); + } + + $page = intval($_REQUEST['p']); + + $page = $page?$page:1; + + $row = $_REQUEST['row']?$_REQUEST['row']:10; + + $data=M('balance_edit','tab_') ->where($map) ->order('create_time desc') ->select(); - $xlsData = []; + $xlsData = []; - foreach($data as $k => $v) { + foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); - $v['game_name'] = empty($v['game_name'])?'空':$v['game_name']; - $v['op_account'] = empty($v['op_account'])?'空':$v['op_account']; + $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + $v['game_name'] = empty($v['game_name'])?'空':$v['game_name']; + $v['op_account'] = empty($v['op_account'])?'空':$v['op_account']; - $v['type']=trim(get_info_status($v['type'],17)); + $v['type']=trim(get_info_status($v['type'],17)); - $xlsData[] = $v; + $xlsData[] = $v; - } + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 管理员列表 - * @author 鹿文学 - */ - public function manager_list() { + /** + * 管理员列表 + * @author 鹿文学 + */ + public function manager_list() { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - $xlsCell = array( - array('uid','账号ID'), - array('nickname','管理员账号'), - array('group_name','角色类型'), - array('login','登录次数'), - array('last_login_time','最后登录时间'), - array('last_login_ip','最后登录IP'), - array('status','状态'), - ); - $nickname = I('nickname'); - if(is_numeric($nickname)){ - $map['uid|nickname']= array(intval($nickname),array('like','%'.$nickname.'%'),'_multi'=>true); - }else{ - $map['nickname'] = array('like', '%'.(string)$nickname.'%'); - } - if(isset($_REQUEST['status'])){ - $map['status'] = $_REQUEST['status']; - } + $xlsCell = array( + array('uid','账号ID'), + array('nickname','管理员账号'), + array('group_name','角色类型'), + array('login','登录次数'), + array('last_login_time','最后登录时间'), + array('last_login_ip','最后登录IP'), + array('status','状态'), + ); + $nickname = I('nickname'); + if(is_numeric($nickname)){ + $map['uid|nickname']= array(intval($nickname),array('like','%'.$nickname.'%'),'_multi'=>true); + }else{ + $map['nickname'] = array('like', '%'.(string)$nickname.'%'); + } + if(isset($_REQUEST['status'])){ + $map['status'] = $_REQUEST['status']; + } - $page = intval($_REQUEST['p']); + $page = intval($_REQUEST['p']); - $page = $page?$page:1; + $page = $page?$page:1; - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $data=M('Member') + $data=M('Member') ->where($map) ->order('uid desc') ->select(); - $xlsData = []; + $xlsData = []; - foreach($data as $k => $v) { + foreach($data as $k => $v) { - $v['last_login_time'] = empty($v['last_login_time'])?'暂无登录':date('Y-m-d H:i:s',$v['last_login_time']); + $v['last_login_time'] = empty($v['last_login_time'])?'暂无登录':date('Y-m-d H:i:s',$v['last_login_time']); - $v['group_name']=trim(get_auth_group_name($v['uid'])); - $v['last_login_ip']=trim(long2ip($v['last_login_ip'])); - $v['status']=trim(get_status_title($v['status'])); + $v['group_name']=trim(get_auth_group_name($v['uid'])); + $v['last_login_ip']=trim(long2ip($v['last_login_ip'])); + $v['status']=trim(get_status_title($v['status'])); - $xlsData[] = $v; + $xlsData[] = $v; - } + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 系统检查 - * @author 鹿文学 - */ - public function check_lists() { + /** + * 系统检查 + * @author 鹿文学 + */ + public function check_lists() { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - $xlsCell = array( - array('id','序号'), - array('info','异常简介'), - array('url','异常简介'), - array('type','异常类型'), - array('create_time','异常时间'), - array('status','异常状态'), - ); + $xlsCell = array( + array('id','序号'), + array('info','异常简介'), + array('url','异常简介'), + array('type','异常类型'), + array('create_time','异常时间'), + array('status','异常状态'), + ); - if(!empty($_REQUEST['start']) && !empty($_REQUEST['end'])){ + if(!empty($_REQUEST['start']) && !empty($_REQUEST['end'])){ - $map['create_time'] = array('BETWEEN',array(strtotime(I('start')),strtotime(I('end'))+24*60*60-1)); + $map['create_time'] = array('BETWEEN',array(strtotime(I('start')),strtotime(I('end'))+24*60*60-1)); - }elseif(!empty($_REQUEST['start'])){ + }elseif(!empty($_REQUEST['start'])){ - $map['create_time'] =array('egt',strtotime(I('start'))); + $map['create_time'] =array('egt',strtotime(I('start'))); - }elseif(!empty($_REQUEST['end'])){ + }elseif(!empty($_REQUEST['end'])){ - $map['create_time'] = array('elt',strtotime(I('end'))+24*60*60-1); + $map['create_time'] = array('elt',strtotime(I('end'))+24*60*60-1); - } + } - if(isset($_REQUEST['type'])){ - $map['type'] = $_REQUEST['type']; - } - if(is_numeric($_REQUEST['status']) && $_REQUEST['status']>=0 && $_REQUEST['status']<3) {$map['status'] = $_REQUEST['status'];} - else {$map['status']=array('egt',0);} + if(isset($_REQUEST['type'])){ + $map['type'] = $_REQUEST['type']; + } + if(is_numeric($_REQUEST['status']) && $_REQUEST['status']>=0 && $_REQUEST['status']<3) {$map['status'] = $_REQUEST['status'];} + else {$map['status']=array('egt',0);} - if(is_numeric($_REQUEST['t']) && $_REQUEST['t']>0 && $_REQUEST['t']<5) { $map['type'] = array('like',$_REQUEST['t'].'%'); } + if(is_numeric($_REQUEST['t']) && $_REQUEST['t']>0 && $_REQUEST['t']<5) { $map['type'] = array('like',$_REQUEST['t'].'%'); } - $page = intval($_REQUEST['p']); + $page = intval($_REQUEST['p']); - $page = $page?$page:1; + $page = $page?$page:1; - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $data=M('Check','tab_') + $data=M('Check','tab_') ->where($map) ->order('id desc') ->select(); - $xlsData = []; + $xlsData = []; - foreach($data as $k => $v) { + foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); - $v['status']=trim(get_info_status($v['status'],40)); - $v['type']=trim(get_bug_name_by_id($v['type'])); + $v['status']=trim(get_info_status($v['status'],40)); + $v['type']=trim(get_bug_name_by_id($v['type'])); - $v['url']=!empty(trim($v['url']))?($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].trim($v['url'])):''; + $v['url']=!empty(trim($v['url']))?($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].trim($v['url'])):''; - $xlsData[] = $v; + $xlsData[] = $v; - } + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 商务专员列表 - * @author 鹿文学 - */ - public function business_affairs_list() { + /** + * 商务专员列表 + * @author 鹿文学 + */ + public function business_affairs_list() { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - $xlsCell = array( - array('id','编号'), - array('account','商务专员账号'), - array('sw_name','姓名'), - array('phone','联系电话'), - array('qq','QQ号'), - array('inferiors','旗下推广员数'), - array('create_time','创建时间'), - array('status','状态'), - ); + $xlsCell = array( + array('id','编号'), + array('account','商务专员账号'), + array('sw_name','姓名'), + array('phone','联系电话'), + array('qq','QQ号'), + array('inferiors','旗下推广员数'), + array('create_time','创建时间'), + array('status','状态'), + ); - if (isset($_REQUEST['account'])) { - $map['account'] = $_REQUEST['account']; - unset($_REQUEST['account']); - } - if (isset($_REQUEST['status'])) { - $map['status'] = $_REQUEST['status']; - unset($_REQUEST['status']); - } + if (isset($_REQUEST['account'])) { + $map['account'] = $_REQUEST['account']; + unset($_REQUEST['account']); + } + if (isset($_REQUEST['status'])) { + $map['status'] = $_REQUEST['status']; + unset($_REQUEST['status']); + } - $page = intval($_REQUEST['p']); + $page = intval($_REQUEST['p']); - $page = $page?$page:1; + $page = $page?$page:1; - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $data=M('business_affairs','tab_') + $data=M('business_affairs','tab_') ->where($map) ->order('id desc') ->select(); - $xlsData = []; + $xlsData = []; - foreach($data as $k => $v) { + foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); - $v['status']=trim(get_info_status($v['status'],30)); + $v['status']=trim(get_info_status($v['status'],30)); - $xlsData[] = $v; + $xlsData[] = $v; - } + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 平台币发放 - * @author 鹿文学 - */ - public function promote_coin_send_list() { + /** + * 平台币发放 + * @author 鹿文学 + */ + public function promote_coin_send_list() { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - $xlsCell = array( - array('promote_account','推广员账号'), - array('promote_type','推广员等级'), - array('banlan_type','发放类型'), - array('num','发放数量'), - array('create_time','发放时间'), - array('op_account','发放人员'), - ); + $xlsCell = array( + array('promote_account','推广员账号'), + array('promote_type','推广员等级'), + array('banlan_type','发放类型'), + array('num','发放数量'), + array('create_time','发放时间'), + array('op_account','发放人员'), + ); - if(empty($_REQUEST['promote_id']&&$_REQUEST['promote_type'])){ - $map['type'] = 1; - $map['source_id'] = 0; - }else{ - $map['promote_id'] = $_REQUEST['promote_id']; - $map['promote_type'] = $_REQUEST['promote_type']; +// $promoteRoot = getPowerPromoteIds(); +// $data_empower_type = session('user_auth')['data_empower_type']; +// +// if ($promoteRoot) { +// $map['promote_id'] =array('in',$promoteRoot); +// } else if(!$promoteRoot&&$data_empower_type!=1){ +// $map['id'] = array('lt',1); +// } + setPowerPromoteIds($extend,'promote_id'); - } + if(empty($_REQUEST['promote_id']&&$_REQUEST['promote_type'])){ + $map['type'] = 1; + $map['source_id'] = 0; + }else{ + $map['promote_id'] = $_REQUEST['promote_id']; + $map['promote_type'] = $_REQUEST['promote_type']; - $page = intval($_REQUEST['p']); + } - $page = $page?$page:1; + $page = intval($_REQUEST['p']); - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $page = $page?$page:1; - $promotecoin = M('PromoteCoin','tab_'); + $row = $_REQUEST['row']?$_REQUEST['row']:10; + + $promotecoin = M('PromoteCoin','tab_'); - $data=$promotecoin + $data=$promotecoin ->where($map) ->order('id desc') ->select(); - $xlsData = []; + $xlsData = []; + + if(is_array($data)){ + foreach($data as $k => $v) { + + $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); - if(is_array($data)){ - foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + $v['promote_account']=trim(get_promote_account($v['promote_id'])); + $v['promote_type']=trim(get_info_status($v['promote_type'],20)); + $v['banlan_type']=trim(get_banlan_type($v['banlan_type'])); + $v['op_account']=trim(get_nickname($v['op_id'])); - $v['promote_account']=trim(get_promote_account($v['promote_id'])); - $v['promote_type']=trim(get_info_status($v['promote_type'],20)); - $v['banlan_type']=trim(get_banlan_type($v['banlan_type'])); - $v['op_account']=trim(get_nickname($v['op_id'])); + $xlsData[] = $v; + } - $xlsData[] = $v; - } + } - } + $this->exportExcel($xlsName, $xlsCell, $xlsData); + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + /** + * 平台币收回 + * @author 鹿文学 + */ + public function deduct_list() { + $xlsName = $_REQUEST['xlsname']; - /** - * 平台币收回 - * @author 鹿文学 - */ - public function deduct_list() { - $xlsName = $_REQUEST['xlsname']; + if($_REQUEST['type']==2) { + $xlsCell = array( + array('promote_account','所属推广员'), + array('promote_type','推广员等级'), + array('num','收回数量'), + array('create_time','收回时间'), + array('op_account','收回人员'), + ); + $map['type'] = 2; + $map['source_id'] = 0; + $extend['op_id'] = session('user_auth')['uid']; +// $promoteRoot = getPowerPromoteIds(); +// $data_empower_type = session('user_auth')['data_empower_type']; +// +// if ($promoteRoot) { +// $map['promote_id'] =array('in',$promoteRoot); +// } else if(!$promoteRoot&&$data_empower_type!=1){ +// $map['id'] = array('lt',1); +// } + setPowerPromoteIds($map,'promote_id'); - if($_REQUEST['type']==2) { - $xlsCell = array( - array('promote_account','所属推广员'), - array('promote_type','推广员等级'), - array('num','收回数量'), - array('create_time','收回时间'), - array('op_account','收回人员'), - ); - $map['type'] = 2; - $map['source_id'] = 0; - if(isset($_REQUEST['promote_id'])) { - $map['promote_id'] = $_REQUEST['promote_id']; - } - if(isset($_REQUEST['promote_type'])) { - $map['promote_type'] = $_REQUEST['promote_type']; - } + if(isset($_REQUEST['promote_id'])) { + $map['promote_id'] = $_REQUEST['promote_id']; + } + if(isset($_REQUEST['promote_type'])) { + $map['promote_type'] = $_REQUEST['promote_type']; + } - $model = M('PromoteCoin','tab_'); - }else { - $xlsCell = array( - array('user_account','玩家账号'), - array('coin_type','收回类型'), - array('num','收回数量'), - array('create_time','收回时间'), - array('op_account','收回人员'), - ); - $model = M('user_coin','tab_'); - if(isset($_GET['account'])){ - $map['user_account']= array('like','%'.I('account').'%') ; + $model = M('PromoteCoin','tab_'); + }else { + $xlsCell = array( + array('user_account','玩家账号'), + array('coin_type','收回类型'), + array('num','收回数量'), + array('create_time','收回时间'), + array('op_account','收回人员'), + ); + $extend['op_id'] = session('user_auth')['uid']; + $model = M('user_coin','tab_'); + if(isset($_GET['account'])){ + $map['user_account']= array('like','%'.I('account').'%') ; - } - } + } + } - $page = intval($_REQUEST['p']); + $page = intval($_REQUEST['p']); - $page = $page?$page:1; + $page = $page?$page:1; - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $data=$model + $data=$model ->where($map) ->order('id desc') ->select(); - $xlsData = []; + $xlsData = []; - if(is_array($data)){ - if($_REQUEST['type']==2) { - foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d H:i',$v['create_time']); - $v['op_account']=trim(get_nickname($v['op_id'])); - $v['promote_account']=trim(get_promote_account($v['promote_id'])); - $v['promote_type']=trim(get_info_status($v['promote_type'],20)); + if(is_array($data)){ + if($_REQUEST['type']==2) { + foreach($data as $k => $v) { + $v['create_time'] = date('Y-m-d H:i',$v['create_time']); + $v['op_account']=trim(get_nickname($v['op_id'])); + $v['promote_account']=trim(get_promote_account($v['promote_id'])); + $v['promote_type']=trim(get_info_status($v['promote_type'],20)); - $xlsData[] = $v; + $xlsData[] = $v; - } - } else { - foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d H:i',$v['create_time']); - $v['op_account']=trim(get_nickname($v['op_id'])); - $v['coin_type'] = '平台币'; + } + } else { + foreach($data as $k => $v) { + $v['create_time'] = date('Y-m-d H:i',$v['create_time']); + $v['op_account']=trim(get_nickname($v['op_id'])); + $v['coin_type'] = '平台币'; - $xlsData[] = $v; + $xlsData[] = $v; - } + } + + } - } + } - } + $this->exportExcel($xlsName, $xlsCell, $xlsData); - $this->exportExcel($xlsName, $xlsCell, $xlsData); + } - } + /** + * 绑币收回 + * @author 鹿文学 + */ + public function deduct_bind_list() { - /** - * 绑币收回 - * @author 鹿文学 - */ - public function deduct_bind_list() { + $xlsName = $_REQUEST['xlsname']; - $xlsName = $_REQUEST['xlsname']; + $xlsCell = array( + array('user_account','玩家账号'), + array('game_name','游戏名称'), + array('coin_type','收回类型'), + array('quantity','收回数量'), + array('create_time','收回时间'), + array('execute_account','收回人员'), + ); - $xlsCell = array( - array('user_account','玩家账号'), - array('game_name','游戏名称'), - array('coin_type','收回类型'), - array('quantity','收回数量'), - array('create_time','收回时间'), - array('execute_account','收回人员'), - ); + $model = M('DeductBindRecord','tab_'); - $model = M('DeductBindRecord','tab_'); + if(isset($_GET['account'])){ + $map['user_account']= array('like','%'.I('account').'%') ; - if(isset($_GET['account'])){ - $map['user_account']= array('like','%'.I('account').'%') ; + } - } + $extend['execute_id'] = session('user_auth')['uid']; + $map['execute_id'] = session('user_auth')['uid']; - $page = intval($_REQUEST['p']); + $page = intval($_REQUEST['p']); - $page = $page?$page:1; + $page = $page?$page:1; - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $data=$model + $data=$model ->where($map) ->order('id desc') ->select(); - $xlsData = []; + $xlsData = []; - if(is_array($data)){ + if(is_array($data)){ - foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d H:i',$v['create_time']); + foreach($data as $k => $v) { + $v['create_time'] = date('Y-m-d H:i',$v['create_time']); - $v['coin_type'] = '绑定平台币'; + $v['coin_type'] = '绑定平台币'; - $xlsData[] = $v; + $xlsData[] = $v; - } + } - } + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 返利设置 - * @author 鹿文学 - */ - public function rebate_set_list() { + /** + * 返利设置 + * @author 鹿文学 + */ + public function rebate_set_list() { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - $xlsCell = array( - array('promote_account','返利对象'), - array('game_name','游戏名称'), - array('status','金额限制状态'), - array('money','金额限制'), - array('ratio','返利比例'), - array('time','返利周期'), - array('create_time','添加时间'), - ); + $xlsCell = array( + array('promote_account','返利对象'), + array('game_name','游戏名称'), + array('status','金额限制状态'), + array('money','金额限制'), + array('ratio','返利比例'), + array('time','返利周期'), + array('create_time','添加时间'), + ); - $model = M('rebate','tab_'); + $model = M('rebate','tab_'); - if(isset($_REQUEST['game_name'])){ - if($_REQUEST['game_name']=='全部'){ - }else{ - $map['game_name'] = $_REQUEST['game_name']; - } - } - if(isset($_REQUEST['status'])){ - if($_REQUEST['status']=='全部'){ - }else{ - $map['status'] = $_REQUEST['status']; - } - } + if(isset($_REQUEST['game_name'])){ + if($_REQUEST['game_name']=='全部'){ + }else{ + $map['game_name'] = $_REQUEST['game_name']; + } + } + if(isset($_REQUEST['status'])){ + if($_REQUEST['status']=='全部'){ + }else{ + $map['status'] = $_REQUEST['status']; + } + } - $page = intval($_REQUEST['p']); + $page = intval($_REQUEST['p']); - $page = $page?$page:1; + $page = $page?$page:1; - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $data=$model + $data=$model ->where($map) ->order('id desc') ->select(); - $xlsData = []; + $xlsData = []; - if(is_array($data)){ + if(is_array($data)){ - foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d H:i',$v['create_time']); + foreach($data as $k => $v) { + $v['create_time'] = date('Y-m-d H:i',$v['create_time']); - $v['promote_account'] = ($v['promote_id']==1)?'推广渠道':(($v['promote_id']==0)?'官方渠道':'全站玩家'); + $v['promote_account'] = ($v['promote_id']==1)?'推广渠道':(($v['promote_id']==0)?'官方渠道':'全站玩家'); - $v['status'] = get_info_status($v['status']); - $v['ratio'] = ratio_stytl($v['ratio']); + $v['status'] = get_info_status($v['status']); + $v['ratio'] = ratio_stytl($v['ratio']); - $v['time'] = set_show_time($v['starttime'],'','forever') .'至'.set_show_time($v['endtime'],'','forever'); + $v['time'] = set_show_time($v['starttime'],'','forever') .'至'.set_show_time($v['endtime'],'','forever'); - $xlsData[] = $v; + $xlsData[] = $v; - } + } - } + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 折扣设置 - * @author 鹿文学 - */ - public function promote_welfare_list() { + /** + * 折扣设置 + * @author 鹿文学 + */ + public function promote_welfare_list() { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - $model = M('PromoteWelfare','tab_'); + $model = M('PromoteWelfare','tab_'); - if(isset($_REQUEST['game_id']) ){ - $map['game_id'] = $_REQUEST['game_id']; - } - if(isset($_REQUEST['promote_id']) ){ - $map['promote_id'] = $_REQUEST['promote_id']; - } + if(isset($_REQUEST['game_id']) ){ + $map['game_id'] = $_REQUEST['game_id']; + } + if(isset($_REQUEST['promote_id']) ){ + $map['promote_id'] = $_REQUEST['promote_id']; + } - if($_REQUEST['type']==2) { + if($_REQUEST['type']==2) { - $xlsCell = array( - array('discount_obj_name','折扣对象'), - array('game_name','游戏名称'), - array('first_discount','首充折扣'), - array('continue_discount','续充折扣'), - array('create_time','设置时间'), - array('op_account','设置人员'), - array('promote_status','首充状态'), - array('cont_status','续充状态'), - ); + $xlsCell = array( + array('discount_obj_name','折扣对象'), + array('game_name','游戏名称'), + array('first_discount','首充折扣'), + array('continue_discount','续充折扣'), + array('create_time','设置时间'), + array('op_account','设置人员'), + array('promote_status','首充状态'), + array('cont_status','续充状态'), + ); - $map['status'] = 2; - $show_status = 1; - if(isset($_REQUEST['promote_status']) ){ - $map['promote_status'] = $_REQUEST['promote_status']; - } - if(isset($_REQUEST['cont_status']) ){ - $map['cont_status'] = $_REQUEST['cont_status']; - } - } else { + $map['status'] = 2; + $show_status = 1; + if(isset($_REQUEST['promote_status']) ){ + $map['promote_status'] = $_REQUEST['promote_status']; + } + if(isset($_REQUEST['cont_status']) ){ + $map['cont_status'] = $_REQUEST['cont_status']; + } + } else { - $xlsCell = array( - array('promote_account','推广员账号'), - array('game_name','游戏名称'), - array('game_discount','统一折扣'), - array('promote_discount','推广员折扣'), - array('create_time','设置时间'), - array('op_account','设置人员'), - array('recharge_status','折扣状态'), - ); + $xlsCell = array( + array('promote_account','推广员账号'), + array('game_name','游戏名称'), + array('game_discount','统一折扣'), + array('promote_discount','推广员折扣'), + array('create_time','设置时间'), + array('op_account','设置人员'), + array('recharge_status','折扣状态'), + ); - $map['status'] = 1; - if(isset($_REQUEST['recharge_status']) ){ - $map['recharge_status'] = $_REQUEST['recharge_status']; - } + $map['status'] = 1; + if(isset($_REQUEST['recharge_status']) ){ + $map['recharge_status'] = $_REQUEST['recharge_status']; + } - } + } - $page = intval($_REQUEST['p']); + $page = intval($_REQUEST['p']); - $page = $page?$page:1; + $page = $page?$page:1; - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $data=$model + $data=$model ->where($map) ->order('id desc') ->select(); - $xlsData = []; + $xlsData = []; - if(is_array($data)){ - if($_REQUEST['type']==2) { - foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + if(is_array($data)){ + if($_REQUEST['type']==2) { + foreach($data as $k => $v) { + $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); - $v['promote_status'] = get_info_status($v['promote_status']); - $v['cont_status'] = get_info_status($v['cont_status']); - $v['discount_obj_name'] = get_discount_obj_name($v['promote_id']); - $v['op_account'] = get_admin_name($v['op_id']); + $v['promote_status'] = get_info_status($v['promote_status']); + $v['cont_status'] = get_info_status($v['cont_status']); + $v['discount_obj_name'] = get_discount_obj_name($v['promote_id']); + $v['op_account'] = get_admin_name($v['op_id']); - $xlsData[] = $v; + $xlsData[] = $v; - } - } else { - foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + } + } else { + foreach($data as $k => $v) { + $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); - $v['recharge_status'] = get_info_status($v['recharge_status']); + $v['recharge_status'] = get_info_status($v['recharge_status']); - $v['promote_account'] = get_promote_name($v['promote_id']); - $v['op_account'] = get_admin_name($v['op_id']); + $v['promote_account'] = get_promote_name($v['promote_id']); + $v['op_account'] = get_admin_name($v['op_id']); - $xlsData[] = $v; + $xlsData[] = $v; - } - } + } + } - } + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 游戏列表 - * @author 鹿文学 - */ - public function game_list() { + /** + * 游戏列表 + * @author 鹿文学 + */ + public function game_list() { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - $model = M('game','tab_'); + $model = M('game','tab_'); - if(isset($_REQUEST['game_name'])){ - $extend['game_name'] = ['like', "{$_REQUEST['game_name']}%"]; - } - if(isset($_REQUEST['sdk_version1'])){ - $map['sdk_version']=$_REQUEST['sdk_version1']; - } - if(isset($_REQUEST['recommend_status'])){ - $map['recommend_status']=$_REQUEST['recommend_status']; - } - if(isset($_REQUEST['game_status'])){ - $map['game_status']=$_REQUEST['game_status']; - } - if(isset($_REQUEST['apply_status'])){ - $map['apply_status']=$_REQUEST['apply_status']; - } - if(isset($_REQUEST['online_status'])){ - $map['online_status']=$_REQUEST['online_status']; - } + if(isset($_REQUEST['game_name'])){ + $extend['game_name'] = ['like', "{$_REQUEST['game_name']}%"]; + } + if(isset($_REQUEST['sdk_version1'])){ + $map['sdk_version']=$_REQUEST['sdk_version1']; + } + if(isset($_REQUEST['recommend_status'])){ + $map['recommend_status']=$_REQUEST['recommend_status']; + } + if(isset($_REQUEST['game_status'])){ + $map['game_status']=$_REQUEST['game_status']; + } + if(isset($_REQUEST['apply_status'])){ + $map['apply_status']=$_REQUEST['apply_status']; + } + if(isset($_REQUEST['online_status'])){ + $map['online_status']=$_REQUEST['online_status']; + } - if($_REQUEST['type']==2) { + if($_REQUEST['type']==2) { - $xlsCell = array( - array('id','游戏ID'), - array('game_name','游戏名称'), - array('sdk_version','运营平台'), - array('game_type','游戏类型'), - array('developers','游戏来源'), - array('sort','排序'), - array('apply_status','审核状态'), - array('game_status','显示状态'), - array('online_status','上线状态'), - array('create_time','添加时间'), - ); + $xlsCell = array( + array('id','游戏ID'), + array('game_name','游戏名称'), + array('sdk_version','运营平台'), + array('game_type','游戏类型'), + array('developers','游戏来源'), + array('sort','排序'), + array('apply_status','审核状态'), + array('game_status','显示状态'), + array('online_status','上线状态'), + array('create_time','添加时间'), + ); - $map['developers'] = array('GT',0); + $map['developers'] = array('GT',0); - } else { + } else { - $xlsCell = array( - array('id','游戏ID'), - array('game_name','游戏名称'), - array('sdk_version','运营平台'), - array('game_type','游戏类型'), - array('game_appid','游戏Appid'), - array('recommend_status','推荐状态'), - array('game_status','显示状态'), - array('dow_num','下载次数'), - array('sort','排序'), - array('relation_game','关联'), - /* array('relation_game_id','关联游戏编号'), */ - ); + $xlsCell = array( + array('id','游戏ID'), + array('game_name','游戏名称'), + array('sdk_version','运营平台'), + array('game_type','游戏类型'), + array('game_appid','游戏Appid'), + array('recommend_status','推荐状态'), + array('game_status','显示状态'), + array('dow_num','下载次数'), + array('sort','排序'), + array('relation_game','关联'), + /* array('relation_game_id','关联游戏编号'), */ + ); - $map['developers'] = array('EQ',0); + $map['developers'] = array('EQ',0); - } + } - $page = intval($_REQUEST['p']); + $page = intval($_REQUEST['p']); - $page = $page?$page:1; + $page = $page?$page:1; - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $data=$model + $data=$model ->where($map) ->order('sort desc, id desc') ->select(); - $xlsData = []; + $xlsData = []; + + if(is_array($data)){ + if($_REQUEST['type']==2) { + foreach($data as $k => $v) { + $v['create_time'] = date('Y-m-d',$v['create_time']); + $v['sdk_version'] = get_systems_name($v['sdk_version']); + $v['game_type'] = get_game_type_name($v['game_type_id']); + $v['developers'] = get_developer_name($v['developers']); + $v['apply_status'] = get_info_status($v['apply_status'],5); + if($v['apply_status'] > 0) { + $v['online_status'] = empty($v['online_status'])?'已下线':'上线'; + $v['game_status'] = empty($v['game_status'])?'已关闭':'已开启'; + } else { + $v['online_status']='--'; + $v['game_status']='--'; + } - if(is_array($data)){ - if($_REQUEST['type']==2) { - foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d',$v['create_time']); - $v['sdk_version'] = get_systems_name($v['sdk_version']); - $v['game_type'] = get_game_type_name($v['game_type_id']); - $v['developers'] = get_developer_name($v['developers']); - $v['apply_status'] = get_info_status($v['apply_status'],5); - if($v['apply_status'] > 0) { - $v['online_status'] = empty($v['online_status'])?'已下线':'上线'; - $v['game_status'] = empty($v['game_status'])?'已关闭':'已开启'; - } else { - $v['online_status']='--'; - $v['game_status']='--'; - } + $xlsData[] = $v; - $xlsData[] = $v; + } + } else { + foreach($data as $k => $v) { - } - } else { - foreach($data as $k => $v) { + $v['sdk_version'] = get_systems_name($v['sdk_version']); - $v['sdk_version'] = get_systems_name($v['sdk_version']); + $v['game_type'] = get_game_type_name($v['game_type_id']); + $v['recommend_status'] = get_info_status($v['recommend_status'],1); + $v['game_status'] = empty($v['game_status'])?'已关闭':'已开启'; - $v['game_type'] = get_game_type_name($v['game_type_id']); - $v['recommend_status'] = get_info_status($v['recommend_status'],1); - $v['game_status'] = empty($v['game_status'])?'已关闭':'已开启'; + $v['relation_game'] = get_relation_game($v['id'],$v['relation_game_id'])?'已关联':'未关联'; + /* $v['relation_game_id'] = $v['relation_game_id']>0?$v['relation_game_id']:'--'; */ - $v['relation_game'] = get_relation_game($v['id'],$v['relation_game_id'])?'已关联':'未关联'; - /* $v['relation_game_id'] = $v['relation_game_id']>0?$v['relation_game_id']:'--'; */ + $xlsData[] = $v; - $xlsData[] = $v; + } + } - } - } + } - } + $this->exportExcel($xlsName, $xlsCell, $xlsData); - $this->exportExcel($xlsName, $xlsCell, $xlsData); + } - } + /** + * 游戏类型 + * @author 鹿文学 + */ + public function game_type_list() { - /** - * 游戏类型 - * @author 鹿文学 - */ - public function game_type_list() { + $xlsName = $_REQUEST['xlsname']; - $xlsName = $_REQUEST['xlsname']; + if($_REQUEST['type']==2) { - if($_REQUEST['type']==2) { + $xlsCell = array( + array('open_name','类型名称'), + array('status','显示状态'), + array('op_nickname','添加人员'), + array('create_time','添加时间'), + ); - $xlsCell = array( - array('open_name','类型名称'), - array('status','显示状态'), - array('op_nickname','添加人员'), - array('create_time','添加时间'), - ); + $model = M('Opentype','tab_'); - $model = M('Opentype','tab_'); + if(isset($_REQUEST['status_show'])){ + if($_REQUEST['status_show']!='all'){ + $map['status'] = $_REQUEST['status_show']; + } + } - if(isset($_REQUEST['status_show'])){ - if($_REQUEST['status_show']!='all'){ - $map['status'] = $_REQUEST['status_show']; - } - } + } else { - } else { + $xlsCell = array( + array('type_name','游戏类型'), + array('status_show','显示状态'), + array('op_nickname','添加人员'), + array('create_time','添加时间'), + ); - $xlsCell = array( - array('type_name','游戏类型'), - array('status_show','显示状态'), - array('op_nickname','添加人员'), - array('create_time','添加时间'), - ); + $model = M('GameType','tab_'); - $model = M('GameType','tab_'); + if(isset($_REQUEST['status_show'])){ + if($_REQUEST['status_show']!='all'){ + $map['status_show'] = $_REQUEST['status_show']; + } + } - if(isset($_REQUEST['status_show'])){ - if($_REQUEST['status_show']!='all'){ - $map['status_show'] = $_REQUEST['status_show']; - } } - } - - $page = intval($_REQUEST['p']); + $page = intval($_REQUEST['p']); - $page = $page?$page:1; + $page = $page?$page:1; - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $data=$model + $data=$model ->where($map) ->order('id desc') ->select(); - $xlsData = []; + $xlsData = []; - if(is_array($data)){ - if($_REQUEST['type']==2) { - foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d H:i',$v['create_time']); + if(is_array($data)){ + if($_REQUEST['type']==2) { + foreach($data as $k => $v) { + $v['create_time'] = date('Y-m-d H:i',$v['create_time']); - $v['status'] = '已' . get_info_status($v['status']); + $v['status'] = '已' . get_info_status($v['status']); - $xlsData[] = $v; + $xlsData[] = $v; - } - } else { - foreach($data as $k => $v) { + } + } else { + foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d H:i',$v['create_time']); + $v['create_time'] = date('Y-m-d H:i',$v['create_time']); - $v['status_show'] = '已' . get_info_status($v['status_show']); + $v['status_show'] = '已' . get_info_status($v['status_show']); - $xlsData[] = $v; + $xlsData[] = $v; - } - } + } + } - } + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 游戏原包 - * @author 鹿文学 - */ - public function game_source_list() { + /** + * 游戏原包 + * @author 鹿文学 + */ + public function game_source_list() { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - if(isset($_REQUEST['game_name'])){ - $map['game_name']=array('like','%'.$_REQUEST['game_name'].'%'); - } - if(isset($_REQUEST['sdk_version1'])){ - $map['file_type']=$_REQUEST['sdk_version1']; - } + if(isset($_REQUEST['game_name'])){ + $map['game_name']=array('like','%'.$_REQUEST['game_name'].'%'); + } + if(isset($_REQUEST['sdk_version1'])){ + $map['file_type']=$_REQUEST['sdk_version1']; + } - $model = M('GameSource','tab_'); + $model = M('GameSource','tab_'); - if($_REQUEST['type']==2) { + if($_REQUEST['type']==2) { - $xlsCell = array( - array('developer_account','开发者账号'), - array('game_name','游戏名称'), - array('file_type','运营平台'), - array('file_name','游戏包名'), - array('version','游戏版本'), - array('file_size','原包大小'), - array('pay_notify_url','支付通知地址'), - array('create_time','上传时间'), - ); + $xlsCell = array( + array('developer_account','开发者账号'), + array('game_name','游戏名称'), + array('file_type','运营平台'), + array('file_name','游戏包名'), + array('version','游戏版本'), + array('file_size','原包大小'), + array('pay_notify_url','支付通知地址'), + array('create_time','上传时间'), + ); - $map['develop_id'] = array('NEQ',0); + $map['develop_id'] = array('NEQ',0); - } else { + } else { - $xlsCell = array( - array('game_name','游戏名称'), - array('file_name','原包名称'), - array('file_type','运营平台'), - array('file_size','原包大小'), - array('file_url','原包路径'), - array('version','原包版本'), - array('op_account','操作人员'), - array('create_time','操作时间'), - ); + $xlsCell = array( + array('game_name','游戏名称'), + array('file_name','原包名称'), + array('file_type','运营平台'), + array('file_size','原包大小'), + array('file_url','原包路径'), + array('version','原包版本'), + array('op_account','操作人员'), + array('create_time','操作时间'), + ); - $map['develop_id'] = 0; + $map['develop_id'] = 0; - } + } - $page = intval($_REQUEST['p']); + $page = intval($_REQUEST['p']); - $page = $page?$page:1; + $page = $page?$page:1; - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $data=$model + $data=$model ->where($map) ->order('id desc') ->select(); - $xlsData = []; + $xlsData = []; - if(is_array($data)){ - if($_REQUEST['type']==2) { - foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + if(is_array($data)){ + if($_REQUEST['type']==2) { + foreach($data as $k => $v) { + $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); - $v['file_type'] = get_systems_name($v['file_type']); - $v['developer_account'] = get_developer_account($v['develop_id']); - $v['pay_notify_url'] = get_game_set_field($v['game_id'],'pay_notify_url'); + $v['file_type'] = get_systems_name($v['file_type']); + $v['developer_account'] = get_developer_account($v['develop_id']); + $v['pay_notify_url'] = get_game_set_field($v['game_id'],'pay_notify_url'); - $xlsData[] = $v; + $xlsData[] = $v; - } - } else { - foreach($data as $k => $v) { + } + } else { + foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); - $v['file_type'] = get_systems_name($v['file_type']); + $v['file_type'] = get_systems_name($v['file_type']); - $xlsData[] = $v; + $xlsData[] = $v; - } - } + } + } - } + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 自建官网 - * @author 鹿文学 - */ - public function selfbuilt_list() { + /** + * 自建官网 + * @author 鹿文学 + */ + public function selfbuilt_list() { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - $model = M('Selfbuilt'); + $model = M('Selfbuilt'); - $xlsCell = array( - array('id','编号'), - array('game_name','游戏名称'), - array('webname','官网名称'), - array('template','模板名称'), - array('weburl','域名'), - ); + $xlsCell = array( + array('id','编号'), + array('game_name','游戏名称'), + array('webname','官网名称'), + array('template','模板名称'), + array('weburl','域名'), + ); - $page = intval($_REQUEST['p']); + $page = intval($_REQUEST['p']); - $page = $page?$page:1; + $page = $page?$page:1; - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $data=$model + $data=$model ->order('id desc') ->select(); - $xlsData = []; + $xlsData = []; - if(is_array($data)){ + if(is_array($data)){ - foreach($data as $k => $v) { + foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d H:i',$v['create_time']); + $v['create_time'] = date('Y-m-d H:i',$v['create_time']); - $v['game_name'] = get_gamename($v['gameid']); - $v['template'] = get_tepname($v['templateid']); + $v['game_name'] = get_gamename($v['gameid']); + $v['template'] = get_tepname($v['templateid']); - $xlsData[] = $v; + $xlsData[] = $v; - } + } - } + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 区服列表 - * @author 鹿文学 - */ - public function server_list() { + /** + * 区服列表 + * @author 鹿文学 + */ + public function server_list() { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - if(isset($_REQUEST['show_status'])){ + if(isset($_REQUEST['show_status'])){ $map['show_status']=$_REQUEST['show_status']; } if(isset($_REQUEST['server_version'])){ @@ -4938,8 +5086,8 @@ if ($key == 'model'){ if($_REQUEST['game_name']=='全部'){ unset($_REQUEST['game_name']); }else{ - $map['server_version']=$_REQUEST['server_version']; - $map['game_name']=['like', "{$_REQUEST['game_name']}%"]; + $map['server_version']=$_REQUEST['server_version']; + $map['game_name']=['like', "{$_REQUEST['game_name']}%"]; unset($_REQUEST['game_name']); } } @@ -4948,95 +5096,95 @@ if ($key == 'model'){ $map['server_name']=$_REQUEST['server_name']; unset($_REQUEST['server_name']); } - $model = M('Server','tab_'); + $model = M('Server','tab_'); - if($_REQUEST['type']==2) { + if($_REQUEST['type']==2) { - $xlsCell = array( - array('developer_account','开发者账号'), - array('game_name','游戏名称'), - array('server_name','区服名称'), - array('server_version','运营平台'), - array('show_status','显示状态'), - array('start_time','开服时间'), - ); + $xlsCell = array( + array('developer_account','开发者账号'), + array('game_name','游戏名称'), + array('server_name','区服名称'), + array('server_version','运营平台'), + array('show_status','显示状态'), + array('start_time','开服时间'), + ); - $map['developers'] = array('NEQ',0); + $map['developers'] = array('NEQ',0); - } else { + } else { - $xlsCell = array( - array('game_name','游戏名称'), - array('server_name','区服名称'), - array('server_version','运营平台'), - array('show_status','显示状态'), - array('start_time','开服时间'), - ); + $xlsCell = array( + array('game_name','游戏名称'), + array('server_name','区服名称'), + array('server_version','运营平台'), + array('show_status','显示状态'), + array('start_time','开服时间'), + ); - $map['developers'] = 0; + $map['developers'] = 0; - } + } - $page = intval($_REQUEST['p']); + $page = intval($_REQUEST['p']); - $page = $page?$page:1; + $page = $page?$page:1; - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $data=$model + $data=$model ->where($map) ->order('id desc') ->select(); - $xlsData = []; + $xlsData = []; - if(is_array($data)){ - if($_REQUEST['type']==2) { - foreach($data as $k => $v) { - $v['start_time'] = date('Y-m-d H:i:s',$v['start_time']); + if(is_array($data)){ + if($_REQUEST['type']==2) { + foreach($data as $k => $v) { + $v['start_time'] = date('Y-m-d H:i:s',$v['start_time']); - $v['show_status'] = $v['show_status']==1?'已开启':'已关闭'; - $v['developer_account'] = get_developer_account($v['developers']); - $v['server_version'] = get_systems_name($v['server_version']); + $v['show_status'] = $v['show_status']==1?'已开启':'已关闭'; + $v['developer_account'] = get_developer_account($v['developers']); + $v['server_version'] = get_systems_name($v['server_version']); - $xlsData[] = $v; + $xlsData[] = $v; - } - } else { - foreach($data as $k => $v) { + } + } else { + foreach($data as $k => $v) { - $v['start_time'] = date('Y-m-d H:i:s',$v['start_time']); + $v['start_time'] = date('Y-m-d H:i:s',$v['start_time']); - $v['show_status'] = $v['show_status']==1?'已开启':'已关闭'; - $v['server_version'] = get_systems_name($v['server_version']); + $v['show_status'] = $v['show_status']==1?'已开启':'已关闭'; + $v['server_version'] = get_systems_name($v['server_version']); - $xlsData[] = $v; + $xlsData[] = $v; - } - } + } + } - } + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 礼包列表 - * @author 鹿文学 - */ - public function giftbag_list() { + /** + * 礼包列表 + * @author 鹿文学 + */ + public function giftbag_list() { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - if(isset($_REQUEST['timestart'])&&isset($_REQUEST['timeend'])){ + if(isset($_REQUEST['timestart'])&&isset($_REQUEST['timeend'])){ $map['create_time'] =array('BETWEEN',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+24*60*60-1)); }elseif(isset($_REQUEST['timestart'])){ $map['create_time']=array('egt',strtotime($_REQUEST['timestart'])); @@ -5069,549 +5217,552 @@ if ($key == 'model'){ } - $model = M('Giftbag','tab_'); + $model = M('Giftbag','tab_'); - if($_REQUEST['type']==2) { + if($_REQUEST['type']==2) { - $xlsCell = array( - array('developer_account','开发者账号'), - array('game_name','游戏名称'), - array('giftbag_name','礼包名称'), - array('giftbag_version','运营平台'), - array('novice_num','礼包总数'), - array('surplus','剩余数量'), - array('status','显示状态'), - array('create_time','更新时间'), - array('time','有效时间'), - ); + $xlsCell = array( + array('developer_account','开发者账号'), + array('game_name','游戏名称'), + array('giftbag_name','礼包名称'), + array('giftbag_version','运营平台'), + array('novice_num','礼包总数'), + array('surplus','剩余数量'), + array('status','显示状态'), + array('create_time','更新时间'), + array('time','有效时间'), + ); - $map['developers'] = array('NEQ',0); + $map['developers'] = array('NEQ',0); - } else { + } else { - $xlsCell = array( - array('game_name','游戏名称'), - array('giftbag_name','礼包名称'), - array('giftbag_version','运营平台'), - array('novice_num','礼包总数'), - array('surplus','剩余数量'), - array('status','显示状态'), - array('create_time','更新时间'), - array('time','有效时间'), - ); + $xlsCell = array( + array('game_name','游戏名称'), + array('giftbag_name','礼包名称'), + array('giftbag_version','运营平台'), + array('novice_num','礼包总数'), + array('surplus','剩余数量'), + array('status','显示状态'), + array('create_time','更新时间'), + array('time','有效时间'), + ); - $map['developers'] = 0; + $map['developers'] = 0; - } + } - $page = intval($_REQUEST['p']); + $page = intval($_REQUEST['p']); - $page = $page?$page:1; + $page = $page?$page:1; - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $data=$model + $data=$model ->where($map) ->order('create_time desc') ->select(); - $xlsData = []; + $xlsData = []; - if(is_array($data)){ - if($_REQUEST['type']==2) { - foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + if(is_array($data)){ + if($_REQUEST['type']==2) { + foreach($data as $k => $v) { + $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); - $v['status'] = $v['status']==1?'已开启':'已关闭'; - $v['developer_account'] = get_developer_account($v['developers']); - $v['giftbag_version'] = get_systems_name($v['giftbag_version']); + $v['status'] = $v['status']==1?'已开启':'已关闭'; + $v['developer_account'] = get_developer_account($v['developers']); + $v['giftbag_version'] = get_systems_name($v['giftbag_version']); - $v['time'] = set_show_time($v['start_time'],'date') .'至'.set_show_time($v['end_time'],'date','forever'); - $v['surplus'] = arr_count($v['novice']); + $v['time'] = set_show_time($v['start_time'],'date') .'至'.set_show_time($v['end_time'],'date','forever'); + $v['surplus'] = arr_count($v['novice']); - $xlsData[] = $v; + $xlsData[] = $v; - } - } else { - foreach($data as $k => $v) { + } + } else { + foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); - $v['status'] = $v['status']==1?'已开启':'已关闭'; - $v['giftbag_version'] = get_systems_name($v['giftbag_version']); - $v['time'] = set_show_time($v['start_time'],'date') .'至'.set_show_time($v['end_time'],'date','forever'); - $v['surplus'] = arr_count($v['novice']); + $v['status'] = $v['status']==1?'已开启':'已关闭'; + $v['giftbag_version'] = get_systems_name($v['giftbag_version']); + $v['time'] = set_show_time($v['start_time'],'date') .'至'.set_show_time($v['end_time'],'date','forever'); + $v['surplus'] = arr_count($v['novice']); - $xlsData[] = $v; + $xlsData[] = $v; - } - } + } + } - } + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 推广员列表 - * @author 鹿文学 - */ - public function promote_list() { + /** + * 推广员列表 + * @author 鹿文学 + */ + public function promote_list() { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - if($_REQUEST['type']==2) { + if($_REQUEST['type']==2) { - $xlsCell = array( - array('id','编号'), - array('promote_account','推广员账号'), - array('url_type','站点来源'), - array('site_url','站点链接'), - array('status','审核状态'), - array('create_time','创建时间'), - ); + $xlsCell = array( + array('id','编号'), + array('promote_account','推广员账号'), + array('url_type','站点来源'), + array('site_url','站点链接'), + array('status','审核状态'), + array('create_time','创建时间'), + ); - $model = M('SiteApply','tab_'); + $model = M('SiteApply','tab_'); - if(isset($_REQUEST['promote_id'])){ - $map['promote_id']=$_REQUEST['promote_id']; - } - if(isset($_REQUEST['url_type'])){ - $map['url_type']=$_REQUEST['url_type']; - } - if(isset($_REQUEST['status'])){ - $map['status']=$_REQUEST['status']; - } - - } else { - - $xlsCell = array( - array('id','推广员ID'), - array('account','推广员账号'), - array('mobile_phone','手机号码'), - array('balance_coin','平台币余额'), - array('total_money','总流水'), - array('create_time','注册时间'), - array('last_login_time','最后登录时间'), - array('promote_levels','渠道类型'), - array('grand_account','所属会长'), - array('business_affairs','商务专员'), - array('status','状态'), - array('ver_status','身份认证'), - array('oa_associated','OA关联') - ); - - $model = M('Promote','tab_'); - - if(isset($_REQUEST['promote_id'])){ - $map['tab_promote.id']=$_REQUEST['promote_id']; - } - if(isset($_REQUEST['admin_id'])){ - if($_REQUEST['admin_id']=="全部"){ - }else{ - $map['ba_id']=$_REQUEST['admin_id']; + if(isset($_REQUEST['promote_id'])){ + $map['promote_id']=$_REQUEST['promote_id']; } - } - if (isset($_REQUEST['parent_id'])) { - if ($_REQUEST['parent_id']=='全部') { - unset($_REQUEST['parent_id']); + if(isset($_REQUEST['url_type'])){ + $map['url_type']=$_REQUEST['url_type']; } - $zid=get_zi_promote_id($_REQUEST['parent_id']); - if($zid){ - $zid=$zid.','.$_REQUEST['parent_id']; - }else{ - $zid=$_REQUEST['parent_id']; + if(isset($_REQUEST['status'])){ + $map['status']=$_REQUEST['status']; } - $map['tab_promote.id']=array('in',$zid); - } - if (I("promote_level")) { - $map['level'] = I("promote_level"); - } - if(I('oa_associated',-1) != -1) { - $map['oa_associated'] = I('oa_associated'); - } + //为数据权限添加 + setPowerPromoteIds($map); + } else { - if (I("ver_status")) { - $map['ver_status'] = I("ver_status"); - } + $xlsCell = array( + array('id','推广员ID'), + array('account','推广员账号'), + array('mobile_phone','手机号码'), + array('balance_coin','平台币余额'), + array('total_money','总流水'), + array('create_time','注册时间'), + array('last_login_time','最后登录时间'), + array('promote_levels','渠道类型'), + array('grand_account','所属会长'), + array('business_affairs','商务专员'), + array('status','状态'), + array('ver_status','身份认证'), + array('oa_associated','OA关联') + ); - if (I("ver_status")) { - $map['tab_promote.ver_status'] = I("ver_status"); - } + $model = M('Promote','tab_'); - if (I('status')) { - $map['tab_promote.status'] = I('status'); + if(isset($_REQUEST['promote_id'])){ + $map['tab_promote.id']=$_REQUEST['promote_id']; + } + if(isset($_REQUEST['admin_id'])){ + if($_REQUEST['admin_id']=="全部"){ + }else{ + $map['ba_id']=$_REQUEST['admin_id']; + } + } + if (isset($_REQUEST['parent_id'])) { + if ($_REQUEST['parent_id']=='全部') { + unset($_REQUEST['parent_id']); } + $zid=get_zi_promote_id($_REQUEST['parent_id']); + if($zid){ + $zid=$zid.','.$_REQUEST['parent_id']; + }else{ + $zid=$_REQUEST['parent_id']; + } + $map['tab_promote.id']=array('in',$zid); + } + if (I("promote_level")) { + $map['level'] = I("promote_level"); + } + if(I('oa_associated',-1) != -1) { + $map['oa_associated'] = I('oa_associated'); + } + + if (I("ver_status")) { + $map['ver_status'] = I("ver_status"); + } + if (I("ver_status")) { + $map['tab_promote.ver_status'] = I("ver_status"); + } + if (I('status')) { + $map['tab_promote.status'] = I('status'); } + //为数据权限添加 + setPowerPromoteIds($map, 'tab_promote.id'); + + } - $page = intval($_REQUEST['p']); + $page = intval($_REQUEST['p']); - $page = $page?$page:1; + $page = $page?$page:1; - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $xlsData = []; + $xlsData = []; // if(is_array($data)){ - if($_REQUEST['type']==2) { - $data=$model - ->where($map) - ->order('create_time desc') - ->select(); - foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d H:i',$v['create_time']); + if($_REQUEST['type']==2) { + $data=$model + ->where($map) + ->order('create_time desc') + ->select(); + foreach($data as $k => $v) { + $v['create_time'] = date('Y-m-d H:i',$v['create_time']); - $v['status'] = $v['status']==1?'已审核':'未审核'; - $v['url_type'] = get_info_status($v['url_type'],24); - $v['promote_account'] = get_promote_account($v['promote_id']); + $v['status'] = $v['status']==1?'已审核':'未审核'; + $v['url_type'] = get_info_status($v['url_type'],24); + $v['promote_account'] = get_promote_account($v['promote_id']); - $xlsData[] = $v; + $xlsData[] = $v; - } - } else { + } + } else { // sum_promote_total_money() - $xlsData = $model - ->field("tab_promote.id,tab_promote.account,mobile_phone,balance_coin,total_money,tab_promote.create_time + $xlsData = $model + ->field("tab_promote.id,tab_promote.account,mobile_phone,balance_coin,total_money,tab_promote.create_time ,tab_promote.last_login_time,tab_business_affairs.account as business_affairs,tab_promote.status, REPLACE(substring_index(tab_promote.chain, '/', 2),'/','') as top_promote,sum(pay_amount) as pay_amount,tab_promote.level as promote_levels,tab_promote.ver_status,tab_promote.oa_associated") - ->join("left join tab_business_affairs on ba_id = tab_business_affairs.id") - ->join("left join tab_spend on tab_promote.id = tab_spend.promote_id and pay_status=1") - ->where($map) - ->order('create_time desc') - ->group("tab_promote.id") - ->select(false); + ->join("left join tab_business_affairs on ba_id = tab_business_affairs.id") + ->join("left join tab_spend on tab_promote.id = tab_spend.promote_id and pay_status=1") + ->where($map) + ->order('create_time desc') + ->group("tab_promote.id") + ->select(false); - $xlsData = M()->table("({$xlsData}) as a") - ->field("a.id,a.account,a.mobile_phone,a.balance_coin,a.create_time,a.last_login_time, + $xlsData = M()->table("({$xlsData}) as a") + ->field("a.id,a.account,a.mobile_phone,a.balance_coin,a.create_time,a.last_login_time, a.promote_levels,tab_promote.account as grand_account,a.business_affairs,a.status,pay_amount as total_money,a.ver_status,a.oa_associated") - ->join("left join tab_promote on tab_promote.id = a.top_promote") - ->order('a.id desc') - ->select(); + ->join("left join tab_promote on tab_promote.id = a.top_promote") + ->order('a.id desc') + ->select(); - foreach($xlsData as $k => &$v) { + foreach($xlsData as $k => &$v) { - $v['create_time'] = $v['create_time']?date('Y-m-d H:i',$v['create_time']):''; - $v['last_login_time'] = $v['last_login_time']?date('Y-m-d H:i',$v['last_login_time']):'暂无登录'; - if (!$v['business_affairs']) { - $v['business_affairs'] = "暂无"; - } - if (!$v['grand_account']) { - $v['grand_account'] = $v['account']; - } - $v['status'] = get_info_status($v['status'],3); + $v['create_time'] = $v['create_time']?date('Y-m-d H:i',$v['create_time']):''; + $v['last_login_time'] = $v['last_login_time']?date('Y-m-d H:i',$v['last_login_time']):'暂无登录'; + if (!$v['business_affairs']) { + $v['business_affairs'] = "暂无"; + } + if (!$v['grand_account']) { + $v['grand_account'] = $v['account']; + } + $v['status'] = get_info_status($v['status'],3); // $v['business_affairs'] = get_business_affairs_account($v['ba_id']); // $v['grand_account'] = getTopPromote($v['id'])['id']; // $v['promote_levels'] = get_promote_levels($v['id']); - switch ($v['ver_status']) { - case '1': - $v['ver_status'] = "成功"; - break; - case '2': - $v['ver_status'] = "拒绝"; - break; - case '3': - $v['ver_status'] = "正在审核"; - break; - case '4': - $v['ver_status'] = "修改审核中"; - break; - - default: - $v['ver_status'] = '未认证'; - } - - switch ($v['promote_levels']) { - case '1': - $v['promote_levels'] = "会长"; - break; - case '2': - $v['promote_levels'] = "部门长"; - break; - case '3': - $v['promote_levels'] = "组长"; - break; - case '4': - $v['promote_levels'] = "组员"; - break; - - default: - $v['promote_levels'] = ''; - } + switch ($v['ver_status']) { + case '1': + $v['ver_status'] = "成功"; + break; + case '2': + $v['ver_status'] = "拒绝"; + break; + case '3': + $v['ver_status'] = "正在审核"; + break; + case '4': + $v['ver_status'] = "修改审核中"; + break; + + default: + $v['ver_status'] = '未认证'; + } - if ($v['oa_associated']==1) { - $v['oa_associated'] = "关联"; - } else { - $v['oa_associated'] = "未关联"; - } + switch ($v['promote_levels']) { + case '1': + $v['promote_levels'] = "会长"; + break; + case '2': + $v['promote_levels'] = "部门长"; + break; + case '3': + $v['promote_levels'] = "组长"; + break; + case '4': + $v['promote_levels'] = "组员"; + break; + + default: + $v['promote_levels'] = ''; + } - } + if ($v['oa_associated']==1) { + $v['oa_associated'] = "关联"; + } else { + $v['oa_associated'] = "未关联"; } + } + } + // } - $this->exportExcel($xlsName, $xlsCell, $xlsData); - - } - - - /** - * 游戏分包列表 - * @author 鹿文学 - */ - public function game_subpackage_list() { - - $xlsName = $_REQUEST['xlsname']; - - if(isset($_REQUEST['game_name'])){ - if($_REQUEST['game_name']=='全部'){ - unset($_REQUEST['game_name']); - }else{ - $map['game_id']=get_game_id($_REQUEST['game_name']); - unset($_REQUEST['game_name']); - } - } - if (is_numeric($_REQUEST['game_id']) && $_REQUEST['game_id']>0) { - $map['game_id'] = $_REQUEST['game_id']; - unset($_REQUEST['game_id']); - } - if (is_numeric($_REQUEST['promote_id']) && $_REQUEST['promote_id']>0) { - $map['tab_apply.promote_id'] = $_REQUEST['promote_id']; - unset($_REQUEST['promote_id']); - } - if(isset($_REQUEST['promote_account'])){ - $map['account']=get_promote_id($_REQUEST['promote_account']); - unset($_REQUEST['promote_account']); - } - if(isset($_REQUEST['status'])){ - if($_REQUEST['status']=='全部'){ - unset($_REQUEST['status']); - }else{ - $map['status']=$_REQUEST['status']; - unset($_REQUEST['status']); - } - } - if(isset($_REQUEST['enable_status'])){ - if($_REQUEST['enable_status']=='全部'){ - unset($_REQUEST['enable_status']); - }elseif($_REQUEST['enable_status']==0){ - //$map['dow_url'] = ''; - $map['enable_status'] = $_REQUEST['enable_status']; - unset($_REQUEST['enable_status']); - }else{ - //$map['dow_url']=array('neq',''); - $map['enable_status'] = $_REQUEST['enable_status']; - unset($_REQUEST['enable_status']); - } - } - if(isset($_REQUEST['dow_status'])){ - if($_REQUEST['dow_status']=='全部'){ - unset($_REQUEST['dow_status']); - }else{ - $map['tab_apply.dow_status']=$_REQUEST['dow_status']; - unset($_REQUEST['dow_status']); - } - } + $this->exportExcel($xlsName, $xlsCell, $xlsData); + + } + + + /** + * 游戏分包列表 + * @author 鹿文学 + */ + public function game_subpackage_list() { + + $xlsName = $_REQUEST['xlsname']; - $model = M('Apply','tab_'); + if(isset($_REQUEST['game_name'])){ + if($_REQUEST['game_name']=='全部'){ + unset($_REQUEST['game_name']); + }else{ + $map['game_id']=get_game_id($_REQUEST['game_name']); + unset($_REQUEST['game_name']); + } + } + if (is_numeric($_REQUEST['game_id']) && $_REQUEST['game_id']>0) { + $map['game_id'] = $_REQUEST['game_id']; + unset($_REQUEST['game_id']); + } + if (is_numeric($_REQUEST['promote_id']) && $_REQUEST['promote_id']>0) { + $map['tab_apply.promote_id'] = $_REQUEST['promote_id']; + unset($_REQUEST['promote_id']); + } + if(isset($_REQUEST['promote_account'])){ + $map['account']=get_promote_id($_REQUEST['promote_account']); + unset($_REQUEST['promote_account']); + } + if(isset($_REQUEST['status'])){ + if($_REQUEST['status']=='全部'){ + unset($_REQUEST['status']); + }else{ + $map['status']=$_REQUEST['status']; + unset($_REQUEST['status']); + } + } + if(isset($_REQUEST['enable_status'])){ + if($_REQUEST['enable_status']=='全部'){ + unset($_REQUEST['enable_status']); + }elseif($_REQUEST['enable_status']==0){ + //$map['dow_url'] = ''; + $map['enable_status'] = $_REQUEST['enable_status']; + unset($_REQUEST['enable_status']); + }else{ + //$map['dow_url']=array('neq',''); + $map['enable_status'] = $_REQUEST['enable_status']; + unset($_REQUEST['enable_status']); + } + } + if(isset($_REQUEST['dow_status'])){ + if($_REQUEST['dow_status']=='全部'){ + unset($_REQUEST['dow_status']); + }else{ + $map['tab_apply.dow_status']=$_REQUEST['dow_status']; + unset($_REQUEST['dow_status']); + } + } - $xlsCell = array( - array('promote_account','推广员账号'), - array('game_name','游戏名称'), - array('launch_count','投放平台'), - array('apply_time','申请时间'), - array('status','审核状态'), - array('enable_status','打包状态'), - array('dispose_time','审核时间'), - array('dow_status','下载状态'), - array('ratio','分成比例'), - array('money','注册单价'), - ); + $model = M('Apply','tab_'); - if($_REQUEST['type']==2) { + $xlsCell = array( + array('promote_account','推广员账号'), + array('game_name','游戏名称'), + array('launch_count','投放平台'), + array('apply_time','申请时间'), + array('status','审核状态'), + array('enable_status','打包状态'), + array('dispose_time','审核时间'), + array('dow_status','下载状态'), + array('ratio','分成比例'), + array('money','注册单价'), + ); - $map['tab_apply.sdk_version']= 2; + if($_REQUEST['type']==2) { - } else { + $map['tab_apply.sdk_version']= 2; - $map['tab_apply.sdk_version']= 1; + } else { - } + $map['tab_apply.sdk_version']= 1; - $type = $_REQUEST['type'] || 1; + } - $page = intval($_REQUEST['p']); + $type = $_REQUEST['type'] || 1; - $page = $page?$page:1; + $page = intval($_REQUEST['p']); - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $page = $page?$page:1; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $data=$model - ->field('tab_apply.*,tab_game.ratio as game_ratio,tab_game.money as game_money') - ->join('LEFT JOIN tab_game ON tab_apply.game_id = tab_game.id') - ->where($map) - ->order('id desc') - ->select(); + //为数据权限添加 + setPowerPromoteIds($map); + $data=$model + ->field('tab_apply.*,tab_game.ratio as game_ratio,tab_game.money as game_money') + ->join('LEFT JOIN tab_game ON tab_apply.game_id = tab_game.id') + ->where($map) + ->order('id desc') + ->select(); - $xlsData = []; + $xlsData = []; - if(is_array($data)){ - $launchmodel = M('apply_launch','tab_'); + if(is_array($data)){ + $launchmodel = M('apply_launch','tab_'); - foreach($data as $k => $v) { + foreach($data as $k => $v) { - $v['apply_time'] = date('Y-m-d H:i',$v['apply_time']); - $v['dispose_time'] = $v['dispose_time']>0?date('Y-m-d H:i:s',$v['dispose_time']):'--'; + $v['apply_time'] = date('Y-m-d H:i',$v['apply_time']); + $v['dispose_time'] = $v['dispose_time']>0?date('Y-m-d H:i:s',$v['dispose_time']):'--'; - $v['status'] = get_info_status($v['status'],5); - $v['promote_account'] = get_promote_name($v['promote_id']); - $v['game_name'] = get_game_name($v['game_id']); + $v['status'] = get_info_status($v['status'],5); + $v['promote_account'] = get_promote_name($v['promote_id']); + $v['game_name'] = get_game_name($v['game_id']); - $ratio = is_null($v['promote_ratio'])?$v['game_ratio']:$v['promote_ratio']; - $ratio || $ratio = 0; + $ratio = is_null($v['promote_ratio'])?$v['game_ratio']:$v['promote_ratio']; + $ratio || $ratio = 0; - $money = is_null($v['promote_money'])?$v['game_money']:$v['promote_money']; - $money || $money = 0; + $money = is_null($v['promote_money'])?$v['game_money']:$v['promote_money']; + $money || $money = 0; - $v['ratio']=$ratio; - $v['money']=$money; + $v['ratio']=$ratio; + $v['money']=$money; - if($type==2) { - $v['dow_status'] = $v['dow_status']==1?'已开启':'已关闭'; - }else{ - $v['dow_status'] = empty($v['pack_url'])?'已关闭':($v['dow_status']==1?'已开启':'已关闭'); - } + if($type==2) { + $v['dow_status'] = $v['dow_status']==1?'已开启':'已关闭'; + }else{ + $v['dow_status'] = empty($v['pack_url'])?'已关闭':($v['dow_status']==1?'已开启':'已关闭'); + } - $v['enable_status'] = $v['enable_status']==1?'打包成功':($v['enable_status']==2?'准备打包':($v['enable_status']==3?'打包中':($v['enable_status']==-1?'打包失败':'未打包'))); + $v['enable_status'] = $v['enable_status']==1?'打包成功':($v['enable_status']==2?'准备打包':($v['enable_status']==3?'打包中':($v['enable_status']==-1?'打包失败':'未打包'))); - $v['launch_count']=0; + $v['launch_count']=0; - $v['launch_count'] = $launchmodel->where(['apply_id'=>$v['id']])->count(); + $v['launch_count'] = $launchmodel->where(['apply_id'=>$v['id']])->count(); - $xlsData[] = $v; + $xlsData[] = $v; - } + } - } + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 游戏盒子分包列表 - * @author 鹿文学 - */ - public function app_subpackage_list() { + /** + * 游戏盒子分包列表 + * @author 鹿文学 + */ + public function app_subpackage_list() { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - "" == I('status') || $map['status'] = I('status'); - "" == I('promote_id') || $map['promote_id'] = I('promote_id'); - "" == I('enable_status') || $map['enable_status'] = I('enable_status'); + "" == I('status') || $map['status'] = I('status'); + "" == I('promote_id') || $map['promote_id'] = I('promote_id'); + "" == I('enable_status') || $map['enable_status'] = I('enable_status'); - $model = M('app_apply','tab_'); + $model = M('app_apply','tab_'); - $xlsCell = array( - array('promote_account','推广员账号'), - array('app_name','APP名称'), - array('apply_time','申请时间'), - array('status','审核状态'), - array('enable_status','打包状态'), - array('dispose_account','审核人员'), - array('dispose_time','审核时间'), - ); + $xlsCell = array( + array('promote_account','推广员账号'), + array('app_name','APP名称'), + array('apply_time','申请时间'), + array('status','审核状态'), + array('enable_status','打包状态'), + array('dispose_account','审核人员'), + array('dispose_time','审核时间'), + ); - if($_REQUEST['type']==2) { + if($_REQUEST['type']==2) { - $map['app_version'] = 2; + $map['app_version'] = 2; - } else { + } else { - $map['app_version'] = 1; + $map['app_version'] = 1; - } + } - $type = $_REQUEST['type'] || 1; + $type = $_REQUEST['type'] || 1; - $page = intval($_REQUEST['p']); + $page = intval($_REQUEST['p']); - $page = $page?$page:1; + $page = $page?$page:1; - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $data=$model - ->where($map) - ->order('apply_time desc') - ->select(); + $data=$model + ->where($map) + ->order('apply_time desc') + ->select(); - $xlsData = []; + $xlsData = []; - if(is_array($data)){ - $launchmodel = M('apply_launch','tab_'); + if(is_array($data)){ + $launchmodel = M('apply_launch','tab_'); - foreach($data as $k => $v) { + foreach($data as $k => $v) { - $v['apply_time'] = date('Y-m-d H:i',$v['apply_time']); - $v['dispose_time'] = $v['dispose_time']>0?date('Y-m-d H:i:s',$v['dispose_time']):'--'; + $v['apply_time'] = date('Y-m-d H:i',$v['apply_time']); + $v['dispose_time'] = $v['dispose_time']>0?date('Y-m-d H:i:s',$v['dispose_time']):'--'; - $v['status'] = get_info_status($v['status'],5); - $v['promote_account'] = get_promote_name($v['promote_id']); - $v['dispose_account'] = $v['dispose_id']>0?get_admin_nickname($v['dispose_id']):'--'; - $v['app_name'] = $v['app_version']==1?$v['app_name'].'(安卓)':$v['app_name'].'(IOS)'; + $v['status'] = get_info_status($v['status'],5); + $v['promote_account'] = get_promote_name($v['promote_id']); + $v['dispose_account'] = $v['dispose_id']>0?get_admin_nickname($v['dispose_id']):'--'; + $v['app_name'] = $v['app_version']==1?$v['app_name'].'(安卓)':$v['app_name'].'(IOS)'; - $v['enable_status'] = $v['enable_status']==1?'已打包':($v['enable_status']==2?'准备打包':($v['enable_status']==3?'打包中':($v['enable_status']==-1?'打包失败':'未打包'))); + $v['enable_status'] = $v['enable_status']==1?'已打包':($v['enable_status']==2?'准备打包':($v['enable_status']==3?'打包中':($v['enable_status']==-1?'打包失败':'未打包'))); - $xlsData[] = $v; + $xlsData[] = $v; - } + } - } + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 推广补链 - * @author 鹿文学 - */ - public function mend_list() { + /** + * 推广补链 + * @author 鹿文学 + */ + public function mend_list() { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - $model = M('user','tab_'); + $model = M('user','tab_'); // $xlsCell = array( // array('account','玩家账号'), @@ -5622,83 +5773,84 @@ if ($key == 'model'){ // array('login_time','上次登录'), // array('top_promote','所属推广员'), // ); - $xlsCell = array( - '玩家账号','注册时间','最后登录时间','注册来源','注册IP','上次登录','所属推广员', - ); + $xlsCell = array( + '玩家账号','注册时间','最后登录时间','注册来源','注册IP','上次登录','所属推广员', + ); - if(isset($_REQUEST['account'])){ - if ($_REQUEST['account']=='全部') { - unset($_REQUEST['account']); - } - $map['tab_user.account']=array('like','%'.$_REQUEST['account'].'%'); - unset($_REQUEST['account']); - } - $map['register_type'] = array('in','(0,1,2,3,4,5,6,7)'); - $csvFileName = $xlsName.'.csv'; - //设置好告诉浏览器要下载excel文件的headers - header('Content-Description: File Transfer'); - header('Content-Type: application/vnd.ms-excel'); - header('Content-Disposition: attachment; filename="'. $csvFileName .'"'); - header('Expires: 0'); - header('Cache-Control: must-revalidate'); - header('Pragma: public'); - $fp = fopen('php://output', 'a');//打开output流 - mb_convert_variables('GBK', 'UTF-8', $xlsCell); - fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中 - - $accessNum=$model - ->join("left join tab_promote on tab_promote.id=tab_user.promote_id") - ->field("tab_user.id,tab_user.account,tab_user.register_time,tab_user.login_time,tab_user.register_type + if(isset($_REQUEST['account'])){ + if ($_REQUEST['account']=='全部') { + unset($_REQUEST['account']); + } + $map['tab_user.account']=array('like','%'.$_REQUEST['account'].'%'); + unset($_REQUEST['account']); + } + $map['register_type'] = array('in','(0,1,2,3,4,5,6,7)'); + $csvFileName = $xlsName.'.csv'; + //设置好告诉浏览器要下载excel文件的headers + header('Content-Description: File Transfer'); + header('Content-Type: application/vnd.ms-excel'); + header('Content-Disposition: attachment; filename="'. $csvFileName .'"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + $fp = fopen('php://output', 'a');//打开output流 + mb_convert_variables('GBK', 'UTF-8', $xlsCell); + fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中 + //为数据权限添加 + setPowerPromoteIds($map); + $accessNum=$model + ->join("left join tab_promote on tab_promote.id=tab_user.promote_id") + ->field("tab_user.id,tab_user.account,tab_user.register_time,tab_user.login_time,tab_user.register_type ,tab_user.register_ip, tab_promote.parent_name as parent_name, tab_promote.account as promote_account") - ->where($map) - ->order('tab_user.id desc') - ->count(); + ->where($map) + ->order('tab_user.id desc') + ->count(); - $perSize = 5000;//每次查询的条数 - $pages = ceil($accessNum / $perSize); - $lastId = 0; + $perSize = 5000;//每次查询的条数 + $pages = ceil($accessNum / $perSize); + $lastId = 0; - for($i = 1; $i <= $pages; $i++) { - // REPLACE(substring_index(tab_promote.chain, '/', 2),'/','') - $xlsData=$model - ->join("left join tab_promote on tab_promote.id=tab_user.promote_id") - ->field("tab_user.id,tab_user.account,tab_user.register_time,tab_user.login_time,tab_user.register_type + for($i = 1; $i <= $pages; $i++) { + // REPLACE(substring_index(tab_promote.chain, '/', 2),'/','') + $xlsData=$model + ->join("left join tab_promote on tab_promote.id=tab_user.promote_id") + ->field("tab_user.id,tab_user.account,tab_user.register_time,tab_user.login_time,tab_user.register_type ,tab_user.register_ip,tab_user.login_time as last_login_time, tab_promote.parent_name as parent_name, tab_promote.account as promote_account,tab_user.id as top_promote") - ->where($map) - ->limit(($i-1)*$perSize ,$perSize) + ->where($map) + ->limit(($i-1)*$perSize ,$perSize) ->order('tab_user.id desc') ->select(); - foreach($xlsData as $key => $value) { - unset($value['id']); - $value['register_time'] = date('Y-m-d H:i:s',$value['register_time']); - $value['login_time'] = $value['login_time']>0?date('Y-m-d H:i:s',$value['login_time']):'暂无登录'; - $value['last_login_time'] = $value['last_login_time']>0?date('Y-m-d H:i:s',$value['last_login_time']):'暂无登录'; - $value['register_type'] = get_registertype($value['register_type']); - $value['top_promote'] = $value['parent_name']?$value['promote_account'].'['.$value['parent_name'].']':$value['promote_account']; - if (!$value['promote_account']) { - $value['top_promote'] = "官方渠道"; - } - if($value['parent_name'] == "官方渠道") { - $value['top_promote'] = $value['promote_account']; - } - unset($value['promote_account']); - unset($value['parent_name']); - mb_convert_variables('GBK', 'UTF-8', $value); - fputcsv($fp, $value); - + foreach($xlsData as $key => $value) { + unset($value['id']); + $value['register_time'] = date('Y-m-d H:i:s',$value['register_time']); + $value['login_time'] = $value['login_time']>0?date('Y-m-d H:i:s',$value['login_time']):'暂无登录'; + $value['last_login_time'] = $value['last_login_time']>0?date('Y-m-d H:i:s',$value['last_login_time']):'暂无登录'; + $value['register_type'] = get_registertype($value['register_type']); + $value['top_promote'] = $value['parent_name']?$value['promote_account'].'['.$value['parent_name'].']':$value['promote_account']; + if (!$value['promote_account']) { + $value['top_promote'] = "官方渠道"; + } + if($value['parent_name'] == "官方渠道") { + $value['top_promote'] = $value['promote_account']; } - unset($xlsData);//释放变量的内存 - //刷新输出缓冲到浏览器 - ob_flush(); - flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。 + unset($value['promote_account']); + unset($value['parent_name']); + mb_convert_variables('GBK', 'UTF-8', $value); + fputcsv($fp, $value); + } - fclose($fp); - exit(); + unset($xlsData);//释放变量的内存 + //刷新输出缓冲到浏览器 + ob_flush(); + flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。 + } + fclose($fp); + exit(); // $data = M()->table("({$data}) as a") // ->field("a.account,a.register_time,a.login_time,a.register_type,a.register_ip,a.top_promote,a.promote_account") @@ -5731,302 +5883,302 @@ if ($key == 'model'){ // } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 补链记录 - * @author 鹿文学 - */ - public function mend_record_list() { + /** + * 补链记录 + * @author 鹿文学 + */ + public function mend_record_list() { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - $model = M('Mend','tab_'); + $model = M('Mend','tab_'); - $xlsCell = array( - array('user_account','玩家账号'), - array('promote_account','补链前渠道'), - array('promote_account_to','补链后渠道'), - array('remark','备注'), - array('create_time','补链时间'), - array('op_account','操作人员'), - ); + $xlsCell = array( + array('user_account','玩家账号'), + array('promote_account','补链前渠道'), + array('promote_account_to','补链后渠道'), + array('remark','备注'), + array('create_time','补链时间'), + array('op_account','操作人员'), + ); - if(isset($_REQUEST['account'])){ - if ($_REQUEST['account']=='全部') { - unset($_REQUEST['account']); - } - $map['user_account']=array('like','%'.$_REQUEST['account'].'%'); + if(isset($_REQUEST['account'])){ + if ($_REQUEST['account']=='全部') { + unset($_REQUEST['account']); + } + $map['user_account']=array('like','%'.$_REQUEST['account'].'%'); - } + } - $page = intval($_REQUEST['p']); + $page = intval($_REQUEST['p']); - $page = $page?$page:1; + $page = $page?$page:1; - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $data=$model - ->where($map) + $data=$model + ->where($map) ->order('id desc') ->select(); - $xlsData = []; - - if(is_array($data)){ + $xlsData = []; - foreach($data as $k => $v) { + if(is_array($data)){ - $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + foreach($data as $k => $v) { - $v['promote_account'] = get_promote_name($v['promote_id']); - $v['promote_account_to'] = get_promote_name($v['promote_id_to']); + $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); - $xlsData[] = $v; + $v['promote_account'] = get_promote_name($v['promote_id']); + $v['promote_account_to'] = get_promote_name($v['promote_id_to']); - } + $xlsData[] = $v; + } - } + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + $this->exportExcel($xlsName, $xlsCell, $xlsData); + } - /** - * 平台币转移记录 - * @author 鹿文学 - */ - public function promote_coin_transfer_record_list() { - $xlsName = $_REQUEST['xlsname']; + /** + * 平台币转移记录 + * @author 鹿文学 + */ + public function promote_coin_transfer_record_list() { + $xlsName = $_REQUEST['xlsname']; - $model = M('PromoteCoin','tab_'); - $xlsCell = array( - array('promote_account','一级推广员'), - array('sub_promote_account','二级推广员'), - array('num','转移数量'), - array('create_time','转移时间'), - ); + $model = M('PromoteCoin','tab_'); - $map['type'] = 2; - $map['source_id'] = ['neq',0]; + $xlsCell = array( + array('promote_account','一级推广员'), + array('sub_promote_account','二级推广员'), + array('num','转移数量'), + array('create_time','转移时间'), + ); - if(isset($_REQUEST['source_id'])) {$map['source_id'] = $_REQUEST['source_id'];} - if(isset($_REQUEST['promote_id'])) {$map['promote_id'] = $_REQUEST['promote_id'];} + $map['type'] = 2; + $map['source_id'] = ['neq',0]; - $page = intval($_REQUEST['p']); + if(isset($_REQUEST['source_id'])) {$map['source_id'] = $_REQUEST['source_id'];} + if(isset($_REQUEST['promote_id'])) {$map['promote_id'] = $_REQUEST['promote_id'];} - $page = $page?$page:1; + $page = intval($_REQUEST['p']); - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $page = $page?$page:1; + $row = $_REQUEST['row']?$_REQUEST['row']:10; + //为数据权限添加 + setPowerPromoteIds($map); - $data=$model - ->where($map) + $data = $model->where($map) ->order('id desc') ->select(); - $xlsData = []; + $xlsData = []; - if(is_array($data)){ + if(is_array($data)){ - foreach($data as $k => $v) { + foreach($data as $k => $v) { - $v['create_time'] = date('Y-m-d H:i',$v['create_time']); + $v['create_time'] = date('Y-m-d H:i',$v['create_time']); - $v['promote_account'] = get_promote_name($v['promote_id']); - $v['sub_promote_account'] = get_promote_name($v['source_id']); + $v['promote_account'] = get_promote_name($v['promote_id']); + $v['sub_promote_account'] = get_promote_name($v['source_id']); - $xlsData[] = $v; + $xlsData[] = $v; - } + } - } + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 角色权限 - * @author 鹿文学 - */ - public function auth_manager() { + /** + * 角色权限 + * @author 鹿文学 + */ + public function auth_manager() { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - $model = M('AuthGroup'); + $model = M('AuthGroup'); - $xlsCell = array( - array('title','用户组'), - array('description','详情'), - array('status','状态'), - ); + $xlsCell = array( + array('title','用户组'), + array('description','详情'), + array('status','状态'), + ); - $map['module'] = 'admin'; + $map['module'] = 'admin'; - $page = intval($_REQUEST['p']); + $page = intval($_REQUEST['p']); - $page = $page?$page:1; + $page = $page?$page:1; - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $data=$model - ->where($map) + $data=$model + ->where($map) ->order('id asc') ->select(); - $xlsData = []; + $xlsData = []; - if(is_array($data)){ + if(is_array($data)){ - foreach($data as $k => $v) { + foreach($data as $k => $v) { - $v['description'] = $v['description']?mb_strimwidth($v['description'],0,60,"...","utf-8"):'空'; + $v['description'] = $v['description']?mb_strimwidth($v['description'],0,60,"...","utf-8"):'空'; - $v['status']= get_status_title($v['status']); + $v['status']= get_status_title($v['status']); - $xlsData[] = $v; + $xlsData[] = $v; - } + } - } + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 行为日志 - * @author 鹿文学 - */ - public function actionlog() { + /** + * 行为日志 + * @author 鹿文学 + */ + public function actionlog() { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - $model = M('ActionLog'); + $model = M('ActionLog'); - $xlsCell = array( - array('id','编号'), - array('remark','行为'), - array('nickname','管理员账号'), - array('create_time','行为时间'), - array('action_ip','行为IP'), - ); + $xlsCell = array( + array('id','编号'), + array('remark','行为'), + array('nickname','管理员账号'), + array('create_time','行为时间'), + array('action_ip','行为IP'), + ); - $map['status'] = array('gt', -1); + $map['status'] = array('gt', -1); - $page = intval($_REQUEST['p']); + $page = intval($_REQUEST['p']); - $page = $page?$page:1; + $page = $page?$page:1; - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $data=$model - ->where($map) + $data=$model + ->where($map) ->order('id desc') ->select(); - int_to_string($data); + int_to_string($data); - $xlsData = []; + $xlsData = []; - foreach ($data as $k=>$v){ - $model_id = get_document_field($v['model'],"name","id"); - $v['model_id'] = $model_id ? $model_id : 0; - $v['nickname'] = get_nickname($v['user_id']); - $v['create_time'] = time_format($v['create_time']); - $v['action_ip'] = long2ip($v['action_ip']); + foreach ($data as $k=>$v){ + $model_id = get_document_field($v['model'],"name","id"); + $v['model_id'] = $model_id ? $model_id : 0; + $v['nickname'] = get_nickname($v['user_id']); + $v['create_time'] = time_format($v['create_time']); + $v['action_ip'] = long2ip($v['action_ip']); - $xlsData[] = $v; - } + $xlsData[] = $v; + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } - /** - * 站内通知 - * @author 鹿文学 - */ - public function msg_lists() { + /** + * 站内通知 + * @author 鹿文学 + */ + public function msg_lists() { - $xlsName = $_REQUEST['xlsname']; + $xlsName = $_REQUEST['xlsname']; - $model = M('Msg','tab_'); + $model = M('Msg','tab_'); - $xlsCell = array( - array('id','ID'), - array('content','通知内容'), - array('create_time','通知时间'), - array('status','状态'), - ); + $xlsCell = array( + array('id','ID'), + array('content','通知内容'), + array('create_time','通知时间'), + array('status','状态'), + ); - $map['user_id'] = session('user_auth.uid'); - $map['status'] = array('neq','-1'); + $map['user_id'] = session('user_auth.uid'); + $map['status'] = array('neq','-1'); - if(isset($_REQUEST['status'])){ - if($_REQUEST['status']=='未读'){ - $map['status']=2; - }elseif($_REQUEST['status']=='已读'){ - $map['status']=1; - } - } + if(isset($_REQUEST['status'])){ + if($_REQUEST['status']=='未读'){ + $map['status']=2; + }elseif($_REQUEST['status']=='已读'){ + $map['status']=1; + } + } - $page = intval($_REQUEST['p']); + $page = intval($_REQUEST['p']); - $page = $page?$page:1; + $page = $page?$page:1; - $row = $_REQUEST['row']?$_REQUEST['row']:10; + $row = $_REQUEST['row']?$_REQUEST['row']:10; - $data=$model - ->where($map) + $data=$model + ->where($map) ->order('status desc,id') ->select(); - int_to_string($data); + int_to_string($data); - $xlsData = []; + $xlsData = []; - foreach ($data as $k=>$v){ - $v['status'] = get_info_status($v['status'],13); - $v['create_time'] = set_show_time($v['create_time']); + foreach ($data as $k=>$v){ + $v['status'] = get_info_status($v['status'],13); + $v['create_time'] = set_show_time($v['create_time']); - $xlsData[] = $v; - } + $xlsData[] = $v; + } - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $this->exportExcel($xlsName, $xlsCell, $xlsData); - } + } public function spend_list() @@ -6197,6 +6349,9 @@ if ($key == 'model'){ $map['tab_spend.promote_id'] = $map['promote_id']; unset($map['promote_id']); + //为数据权限添加 + setPowerPromoteIds($map, 'tab_spend.promote_id'); + $csvFileName = $xlsName . '.csv'; //设置好告诉浏览器要下载excel文件的headers header('Content-Description: File Transfer'); @@ -6286,24 +6441,24 @@ if ($key == 'model'){ } - function exportFinanceIndex() { + function exportFinanceIndex() { - $xlsName = '月结统计导出'; + $xlsName = '月结统计导出'; - $xlsCell = array( - array('count_date','月份'), - array('cash_count','游戏现金流水'), - array('balance_coin_deposit','平台币收入'), - array('inside_cash_count','内冲流水'), - array('bind_coin_count','内充支出'), - array('balance_coin_count','平台币支出'), - array('all_count','总流水'), - ); + $xlsCell = array( + array('count_date','月份'), + array('cash_count','游戏现金流水'), + array('balance_coin_deposit','平台币收入'), + array('inside_cash_count','内冲流水'), + array('bind_coin_count','内充支出'), + array('balance_coin_count','平台币支出'), + array('all_count','总流水'), + ); - $map = []; - if(!empty(I('count_date'))){ - $map['count_date']=I('count_date'); - } + $map = []; + if(!empty(I('count_date'))){ + $map['count_date']=I('count_date'); + } // if (!empty(I('game_id'))) { // $map['game_id']=I('game_id'); @@ -6331,36 +6486,36 @@ if ($key == 'model'){ // $sumBalance = D("spend_count")->sumSpendCountField($map,"balance_coin_count"); // $sumInside = D("spend_count")->sumSpendCountField($map,$InsideField); // $sumAll = D("spend_count")->sumSpendCountField($map,$allField); - $order = "id DESC"; - $xlsData = M('spend_month_count','tab_') - ->field("cash_count,balance_coin_count,inside_cash_count,all_count,count_date,balance_coin_deposit,bind_coin_count") - ->where($map) - ->order($order) - ->select(); + $order = "id DESC"; + $xlsData = M('spend_month_count','tab_') + ->field("cash_count,balance_coin_count,inside_cash_count,all_count,count_date,balance_coin_deposit,bind_coin_count") + ->where($map) + ->order($order) + ->select(); - $sumData = M('spend_month_count','tab_') - ->field("sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,sum(inside_cash_count) as inside_cash_count,sum(all_count) as all_count,count_date,sum(balance_coin_deposit) as balance_coin_deposit,sum(bind_coin_count) as bind_coin_count") - ->where($map) - ->order($order) - ->find(); - - $sumData = [['count_date'=>'总计', - 'cash_count'=>$sumData['cash_count'], - 'balance_coin_deposit'=>$sumData['balance_coin_deposit'], - 'inside_cash_count'=>$sumData['inside_cash_count'], - 'bind_coin_count'=>$sumData['bind_coin_count'], - 'balance_coin_count'=>$sumData['balance_coin_count'], - 'all_count'=>$sumData['all_count']]]; - $xlsData = array_merge($xlsData,$sumData); + $sumData = M('spend_month_count','tab_') + ->field("sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,sum(inside_cash_count) as inside_cash_count,sum(all_count) as all_count,count_date,sum(balance_coin_deposit) as balance_coin_deposit,sum(bind_coin_count) as bind_coin_count") + ->where($map) + ->order($order) + ->find(); - $this->exportExcel($xlsName, $xlsCell, $xlsData); + $sumData = [['count_date'=>'总计', + 'cash_count'=>$sumData['cash_count'], + 'balance_coin_deposit'=>$sumData['balance_coin_deposit'], + 'inside_cash_count'=>$sumData['inside_cash_count'], + 'bind_coin_count'=>$sumData['bind_coin_count'], + 'balance_coin_count'=>$sumData['balance_coin_count'], + 'all_count'=>$sumData['all_count']]]; + $xlsData = array_merge($xlsData,$sumData); - } + $this->exportExcel($xlsName, $xlsCell, $xlsData); + + } function exportGameFinance() { - $month = I("count_date"); + $month = I("count_date"); $xlsName = $month.'月结统计导出'; $xlsCell = array( @@ -6711,7 +6866,7 @@ if ($key == 'model'){ if (!empty(I("root_id"))) { $root_id = I("root_id"); - $parentData = $this->getParentSpendData($root_id,$month,2); + $parentData = $this->getParentSpendData($root_id,$month,2); $map['chain'] =['like','%/'.$root_id.'/%']; $map['level'] = 2; } else if(!empty(I("sign"))){ diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index d6baa0d01..382d775b7 100644 --- a/Application/Admin/Controller/MemberController.class.php +++ b/Application/Admin/Controller/MemberController.class.php @@ -88,6 +88,7 @@ class MemberController extends ThinkController $game_map = " and tab_user_play_info.server_name = '{$_REQUEST['server_name']}' "; } $promoteRoot = getPowerPromoteIds(); + // $data_empower_type = session('user_auth')['data_empower_type']; //// var_dump($promoteRoot);die(); // diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 6877d1e2b..e5c4f2532 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -53,7 +53,8 @@ class PromoteController extends ThinkController if ($_REQUEST['parent_id']=='全部') { unset($_REQUEST['parent_id']); } - $zid=get_zi_promote_id($_REQUEST['parent_id']); + $zid = get_zi_promote_id($_REQUEST['parent_id'], null); +// dd($zid); if ($zid) { $zid=$zid.','.$_REQUEST['parent_id']; } else { @@ -134,11 +135,10 @@ class PromoteController extends ThinkController } } - // dump($map);die(); + //为数据权限添加 setPowerPromoteIds($map, 'id'); $list_data = D(self::model_name)->where($map)->order('id DESC')->page($p, $row)->select(); - $oa_data = []; if (I('oa_associated', -1) == -1) { foreach ($list_data as $k => $v) { @@ -198,13 +198,16 @@ class PromoteController extends ThinkController parent::lists('SiteApply', $p, $map); } - public function add($account=null, $password=null, $second_pwd=null, $real_name=null, $email=null, $mobile_phone=null, $bank_name=null, $bank_card=null, $admin=null, $status=null, $ba_id = null) + public function add($account=null, $password=null, $second_pwd=null, $real_name=null, $email=null, + $mobile_phone=null, $bank_name=null, $bank_card=null, $admin=null, $status=null, $ba_id = null, $company_id = null) { if (IS_POST) { if (C('PROMOTE_AUTO_AUDIT') == 1) { $status = 1; } - $data = array('account'=>$account,'password'=>$password,'second_pwd'=>$second_pwd,'real_name'=>$real_name,'email'=>$email,'mobile_phone'=>$mobile_phone,'bank_name'=>$bank_name,'bank_card'=>$bank_card,'admin_id'=>session('user_auth')['uid'],'status'=>$status,'ba_id'=>$ba_id); + $data = array('account'=>$account,'password'=>$password,'second_pwd'=>$second_pwd,'real_name'=>$real_name, + 'email'=>$email,'mobile_phone'=>$mobile_phone,'bank_name'=>$bank_name,'bank_card'=>$bank_card, + 'admin_id'=>session('user_auth')['uid'],'status'=>$status,'ba_id'=>$ba_id, 'company_id' => $company_id); if (preg_match('/^[a-zA-Z0-9]{6,15}$/', $account)==false) { $this->error('账号只能是6-15位字母或数字'); @@ -217,6 +220,7 @@ class PromoteController extends ThinkController $ba = new \Admin\Model\BusinessAffairsModel(); $ba->add_child($_REQUEST['ba_id'],$res); } */ + session('user_auth_promote_ids', null); $this->success("添加成功", U('lists')); } else { $this->error($res); @@ -224,6 +228,8 @@ class PromoteController extends ThinkController } else { $this->meta_title ='新增渠道信息'; $this->m_title = '推广员列表'; + $companys = M('promote_company', 'tab_')->where(['status' => 1])->select(); + $this->assign('companys', $companys); $this->assign('commonset', M('Kuaijieicon')->where(['url'=>'Promote/lists/type/1','status'=>1])->find()); $this->display(); } @@ -288,6 +294,9 @@ class PromoteController extends ThinkController $ba = new \Admin\Model\BusinessAffairsModel(); $ba->update_child($ba_id['ba_id'], $_REQUEST['ba_id'], $id); } + if (!empty(I('company_id'))) { + $data['company_id'] = I('company_id'); + } $res=M("promote", "tab_")->where(array("id"=>$_POST['id']))->save($data); if ($res !== false) { @@ -337,7 +346,8 @@ class PromoteController extends ThinkController $this->m_title = '推广员列表'; $this->assign('commonset', M('Kuaijieicon')->where(['url'=>'Promote/lists/type/1','status'=>1])->find()); - + $companys = M('promote_company', 'tab_')->where(['status' => 1])->select(); + $this->assign('companys', $companys); $this->display(); } } diff --git a/Application/Admin/Controller/StatisticsCountSetController.class.php b/Application/Admin/Controller/StatisticsCountSetController.class.php index 68aa4cffd..5c147bfb8 100644 --- a/Application/Admin/Controller/StatisticsCountSetController.class.php +++ b/Application/Admin/Controller/StatisticsCountSetController.class.php @@ -185,7 +185,14 @@ class StatisticsCountSetController extends Controller { $value['create_time']=$this->nowdata; $value['active_user_list'] = @json_encode(array_map("intFun",explode(",",$value['active_user_list']))); if(empty($value['promote_account']) && $value['promote_id']){ - $value['promote_account'] = $this->PromoteModel->field("account")->where("id = {$value['promote_id']}")->find()['account']; + if($value['promote_id'] == 0){ + $value['promote_account'] = "官方渠道"; + }else{ + $value['promote_account'] = $this->PromoteModel->field("account")->where("id = {$value['promote_id']}")->find()['account']; + if(!$value['promote_account']){ + $value['promote_account']="未知推广员"; + } + } } $tempdbres = $this->PromoteCountModel->add($value); if($tempdbres === false){ diff --git a/Application/Admin/Model/PromoteModel.class.php b/Application/Admin/Model/PromoteModel.class.php index 5190c4bcc..4256f3f97 100644 --- a/Application/Admin/Model/PromoteModel.class.php +++ b/Application/Admin/Model/PromoteModel.class.php @@ -392,10 +392,18 @@ class PromoteModel extends Model{ $where['level'] = $level; setPowerPromoteIds($where,'id'); + $offcialData = [0=>['id'=>0,'nickname'=>'官方渠道']]; + $result = $this->field("*")->where($where)->select(); foreach ($result as &$item) { $item['nickname'] = $item['account'] . ($item['nickname'] ? "({$item['nickname']})" : ""); } + + if (in_array('0',explode(',',$where['id'][1]))) { + $result = array_merge($offcialData,$result); +// dump($result);die(); + } + return $result; } } \ No newline at end of file diff --git a/Application/Admin/View/Apply/and_lists.html b/Application/Admin/View/Apply/and_lists.html index 4bd2de52d..247d69b8a 100644 --- a/Application/Admin/View/Apply/and_lists.html +++ b/Application/Admin/View/Apply/and_lists.html @@ -66,7 +66,7 @@
diff --git a/Application/Admin/View/AuthManager/dataempower.html b/Application/Admin/View/AuthManager/dataempower.html index 1cf4dc9ad..e5d0efe8b 100644 --- a/Application/Admin/View/AuthManager/dataempower.html +++ b/Application/Admin/View/AuthManager/dataempower.html @@ -120,6 +120,8 @@ if (JSON.parse(data1).data_president) { var data2 = JSON.parse(data1).data_president.split(","); } + // var dataTransfers = transfer.getData('key123'); + // $('#promote_data').val(JSON.stringify(dataTransfers)); //显示搜索框 transfer.render({ elem: '#test4' @@ -134,6 +136,9 @@ $('#promote_data').val(JSON.stringify(dataTransfer)); } }) + + var dataTransfers = transfer.getData('key123'); + $('#promote_data').val(JSON.stringify(dataTransfers)); transfets = transfer; //批量办法定事件 util.event('lay-demoTransferActive', { diff --git a/Application/Admin/View/AuthManager/managergroup.html b/Application/Admin/View/AuthManager/managergroup.html index b06238a2d..7cbac77ff 100644 --- a/Application/Admin/View/AuthManager/managergroup.html +++ b/Application/Admin/View/AuthManager/managergroup.html @@ -64,7 +64,7 @@ - + 返 回
diff --git a/Application/Admin/View/AuthManager/user.html b/Application/Admin/View/AuthManager/user.html index 8ccad67b7..c28bae755 100644 --- a/Application/Admin/View/AuthManager/user.html +++ b/Application/Admin/View/AuthManager/user.html @@ -58,7 +58,7 @@ -
+
@@ -67,9 +67,17 @@ 新增 +
+
+ + 返回 +
+ diff --git a/Application/Admin/View/BehaviorLog/index.html b/Application/Admin/View/BehaviorLog/index.html index ced2a39cd..e97c61afd 100644 --- a/Application/Admin/View/BehaviorLog/index.html +++ b/Application/Admin/View/BehaviorLog/index.html @@ -417,7 +417,9 @@ data:{level:$("#promote_level option:selected").val()}, dataType:'json', success:function(response){ - str = ''; + str = '' + + // '' + + ''; data = response.data; for (var i in data){ str += "" diff --git a/Application/Admin/View/Member/login_record.html b/Application/Admin/View/Member/login_record.html index 77da76991..f5adb2b50 100644 --- a/Application/Admin/View/Member/login_record.html +++ b/Application/Admin/View/Member/login_record.html @@ -306,7 +306,9 @@ data:{level:$("#promote_level option:selected").val()}, dataType:'json', success:function(response){ - str = ''; + str = '' + + // '' + + ''; data = response.data; for (var i in data){ str += "" diff --git a/Application/Admin/View/Member/user_info.html b/Application/Admin/View/Member/user_info.html index 46af4f3f8..e6fdb7bb0 100644 --- a/Application/Admin/View/Member/user_info.html +++ b/Application/Admin/View/Member/user_info.html @@ -456,7 +456,10 @@ $(function(){ data:{level:$("#promote_level option:selected").val()}, dataType:'json', success:function(response){ - str = ''; + str = '' + + // '' + + // '' + + ''; // $.each(response.data, function(index, item){ // console.log(item.id); // str += ''; diff --git a/Application/Admin/View/Promote/agent_list.html b/Application/Admin/View/Promote/agent_list.html index ea7c8541a..cd6182cd6 100644 --- a/Application/Admin/View/Promote/agent_list.html +++ b/Application/Admin/View/Promote/agent_list.html @@ -55,7 +55,7 @@
diff --git a/Application/Admin/View/Promote/ch_reg_list.html b/Application/Admin/View/Promote/ch_reg_list.html index 452be0303..823ced068 100644 --- a/Application/Admin/View/Promote/ch_reg_list.html +++ b/Application/Admin/View/Promote/ch_reg_list.html @@ -68,7 +68,7 @@ background-color: #FF9797;
diff --git a/Application/Admin/View/Promote/edit.html b/Application/Admin/View/Promote/edit.html index 3c39f46fc..3c78cf76d 100644 --- a/Application/Admin/View/Promote/edit.html +++ b/Application/Admin/View/Promote/edit.html @@ -168,6 +168,22 @@ + + + 推广公司: + + + 设置该推广员所属的推广公司 + + + 注册时间: diff --git a/Application/Admin/View/Promote/lists.html b/Application/Admin/View/Promote/lists.html index 7e7b6ca0d..68a5869c1 100644 --- a/Application/Admin/View/Promote/lists.html +++ b/Application/Admin/View/Promote/lists.html @@ -78,7 +78,7 @@
diff --git a/Application/Admin/View/Promote/spend_list.html b/Application/Admin/View/Promote/spend_list.html index 1f3e7e7d2..aefb5e018 100644 --- a/Application/Admin/View/Promote/spend_list.html +++ b/Application/Admin/View/Promote/spend_list.html @@ -96,7 +96,7 @@ background-color: #FF9797;
diff --git a/Application/Admin/View/PromoteCoin/send.html b/Application/Admin/View/PromoteCoin/send.html index 25d81dbef..8f37f009f 100644 --- a/Application/Admin/View/PromoteCoin/send.html +++ b/Application/Admin/View/PromoteCoin/send.html @@ -121,11 +121,7 @@