|
|
<?php
|
|
|
namespace admin\Controller;
|
|
|
|
|
|
use Think\Controller;
|
|
|
|
|
|
class ExportController extends Controller
|
|
|
{
|
|
|
public function exportExcel($expTitle, $expCellName, $expTableData)
|
|
|
{
|
|
|
$xlsTitle = iconv('utf-8', 'gb2312', $expTitle);//文件名称
|
|
|
// $fileName = session('user_auth.username').date('_YmdHis');//or $xlsTitle 文件名称可根据自己情况设定
|
|
|
$fileName = $expTitle;
|
|
|
$cellNum = count($expCellName);
|
|
|
$dataNum = count($expTableData);
|
|
|
Vendor("PHPExcel.PHPExcel");
|
|
|
$objPHPExcel = new \PHPExcel();
|
|
|
$cellName = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ');
|
|
|
$objPHPExcel->getActiveSheet(0)->mergeCells('A1:' . $cellName[$cellNum - 1] . '1');//合并单元格
|
|
|
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', $expTitle);
|
|
|
$objPHPExcel->setActiveSheetIndex(0)->getStyle('A1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
|
|
for ($i = 0; $i < $cellNum; $i++) {
|
|
|
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($cellName[$i] . '2', $expCellName[$i][1]);
|
|
|
}
|
|
|
for ($i = 0; $i < $dataNum; $i++) {
|
|
|
for ($j = 0; $j < $cellNum; $j++) {
|
|
|
$objPHPExcel->getActiveSheet(0)->setCellValue($cellName[$j] . ($i + 3), $expTableData[$i][$expCellName[$j][0]]);
|
|
|
}
|
|
|
}
|
|
|
ob_end_clean();//清除缓冲区,避免乱码
|
|
|
header('pragma:public');
|
|
|
header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $xlsTitle . '.xls"');
|
|
|
header("Content-Disposition:attachment;filename=$fileName.xls");//attachment新窗口打印inline本窗口打印
|
|
|
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
|
|
$objWriter->save('php://output');
|
|
|
exit;
|
|
|
}
|
|
|
|
|
|
//导出Excel
|
|
|
function expUser($id)
|
|
|
{
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
switch ($id) {
|
|
|
case 1:
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('user_account', "玩家账号"),
|
|
|
array('game_name', "游戏名称"),
|
|
|
array('server_name', L('Game_area_clothing')),
|
|
|
array('role_name', "角色名"),
|
|
|
array('role_level', "游戏等级"),
|
|
|
array('play_time', "最后登录时间", 'time_format', '*'),
|
|
|
array('play_ip', "最后登录ip"),
|
|
|
);
|
|
|
if (isset($_REQUEST['game_name'])) {
|
|
|
$map['game_name'] = trim($_REQUEST['game_name']);
|
|
|
unset($_REQUEST['game_name']);
|
|
|
}
|
|
|
if (isset($_REQUEST['user_account'])) {
|
|
|
$map['user_account'] = array('like','%'.trim($_REQUEST['user_account']).'%');
|
|
|
unset($_REQUEST['user_account']);
|
|
|
}
|
|
|
if (isset($_REQUEST['server_name'])) {
|
|
|
$map['server_name'] = array('like','%'.trim($_REQUEST['server_name']).'%');
|
|
|
unset($_REQUEST['server_name']);
|
|
|
}
|
|
|
if (isset($_REQUEST['server_id'])) {
|
|
|
$map['server_id'] = trim($_REQUEST['server_id']);
|
|
|
unset($_REQUEST['server_id']);
|
|
|
}
|
|
|
if (isset($_REQUEST['role_name'])) {
|
|
|
$map['role_name'] = array('like','%'.trim($_REQUEST['role_name']).'%');
|
|
|
unset($_REQUEST['role_name']);
|
|
|
}
|
|
|
$xlsData = M('user_play_info', 'tab_')
|
|
|
->where($map)
|
|
|
->order('id desc')
|
|
|
->select();
|
|
|
break;
|
|
|
case 2:
|
|
|
$xlsName = $xlsName?$xlsName:"渠道注册";
|
|
|
$xlsCell = array(
|
|
|
array('account', "玩家账号"),
|
|
|
array('fgame_name', "注册游戏"),
|
|
|
array('promote_account', L('Subordinate_channel')),
|
|
|
array('register_time', L('Registration_time'), 'time_format', '*'),
|
|
|
array('register_ip', L('Register_iP')),
|
|
|
array('parent_id', "上级推广员"),
|
|
|
array('ba_id', '商务专员', 'get_business_affairs_account', '*'),
|
|
|
);
|
|
|
if (isset($_REQUEST['game_name'])) {
|
|
|
if ($_REQUEST['game_name'] == L('All')) {
|
|
|
unset($_REQUEST['game_name']);
|
|
|
} else {
|
|
|
$map['fgame_name'] = $_REQUEST['game_name'];
|
|
|
unset($_REQUEST['game_name']);
|
|
|
}
|
|
|
}
|
|
|
$map['tab_user.promote_id'] = array("neq", 0);
|
|
|
if (isset($_REQUEST['promote_name'])) {
|
|
|
if ($_REQUEST['promote_name'] == L('All')) {
|
|
|
unset($_REQUEST['promote_name']);
|
|
|
} else if ($_REQUEST['promote_name'] == "官方渠道") {
|
|
|
$map['tab_user.promote_id'] = array("elt", 0);
|
|
|
unset($_REQUEST['promote_name']);
|
|
|
} else {
|
|
|
$map['tab_user.promote_id'] = get_promote_id($_REQUEST['promote_name']);
|
|
|
unset($_REQUEST['promote_name']);
|
|
|
}
|
|
|
}
|
|
|
if (isset($_REQUEST['is_check']) && $_REQUEST['is_check'] != L('All')) {
|
|
|
$map['is_check'] = check_status($_REQUEST['is_check']);
|
|
|
unset($_REQUEST['is_check']);
|
|
|
}
|
|
|
if (isset($_REQUEST['account'])) {
|
|
|
$map['tab_user.account'] = array('like', '%' . $_REQUEST['account'] . '%');
|
|
|
unset($_REQUEST['account']);
|
|
|
}
|
|
|
|
|
|
if(isset($_REQUEST['ba_id'])){
|
|
|
$map['ba_id'] = $_REQUEST['ba_id'];
|
|
|
unset($_REQUEST['ba_id']);
|
|
|
}
|
|
|
if (isset($_REQUEST['time-start']) && isset($_REQUEST['time-end'])) {
|
|
|
$map['register_time'] = array('BETWEEN', array(strtotime($_REQUEST['time-start']), strtotime($_REQUEST['time-end']) + 24 * 60 * 60 - 1));
|
|
|
unset($_REQUEST['time-start']);
|
|
|
unset($_REQUEST['time_end']);
|
|
|
}
|
|
|
if (isset($_REQUEST['start']) && isset($_REQUEST['end'])) {
|
|
|
$map['register_time'] = array('BETWEEN', array(strtotime($_REQUEST['start']), strtotime($_REQUEST['end']) + 24 * 60 * 60 - 1));
|
|
|
unset($_REQUEST['start']);
|
|
|
unset($_REQUEST['end']);
|
|
|
}
|
|
|
$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'
|
|
|
),
|
|
|
'key' => array('tab_user.account', 'tab_game.fgame_name'),
|
|
|
'map' => $map,
|
|
|
'order' => 'id desc',
|
|
|
'title' => "渠道注册",
|
|
|
'template_list' => 'ch_reg_list',
|
|
|
);
|
|
|
$name = $model['m_name'];
|
|
|
$xlsData = M($name, "tab_")
|
|
|
->field($model['fields'])
|
|
|
->join($model['join'])
|
|
|
->join($model['joins'])
|
|
|
->join($model['joinss'])
|
|
|
->where($model['map'])
|
|
|
->order($model['order'])
|
|
|
->group($model['group'])
|
|
|
->select();
|
|
|
foreach ($xlsData as $key => &$value) {
|
|
|
$xlsData[$key]['parent_id'] = get_top_promote($value['promote_id'], $value['parent_id']);
|
|
|
}
|
|
|
break;
|
|
|
case 3:
|
|
|
|
|
|
if($_REQUEST['type']==2){
|
|
|
$xlsCell = array(
|
|
|
array('id', L('Account_number_ID')),
|
|
|
array('register_type', L('Third_party_source'), "get_registertype", '*'),
|
|
|
array('account', "玩家账号"),
|
|
|
array('promote_account', L('Subordinate_channel')),
|
|
|
array('balance', "账户平台币"),
|
|
|
array('recharge_total', "累计充值"),
|
|
|
array('gold_coin', "金币"),
|
|
|
array('alipay', "绑定支付宝"),
|
|
|
array('small_count', "小号"),
|
|
|
array('vip_level', "VIP等级"),
|
|
|
array('register_time', L('Registration_time'), 'time_format', '*'),
|
|
|
array('login_time', "最后登录时间", 'time_format', '*'),
|
|
|
array('register_ip', L('Register_iP')),
|
|
|
array('lock_status', L('Account_status'), 'get_info_status', '*', '4'),
|
|
|
);
|
|
|
$map['tab_user.register_type']= ['in','3,4,5,6'];
|
|
|
}else{
|
|
|
$xlsCell = array(
|
|
|
array('id', L('Account_number_ID')),
|
|
|
array('account', "玩家账号"),
|
|
|
array('promote_account', L('Subordinate_channel')),
|
|
|
array('balance', "账户平台币"),
|
|
|
array('recharge_total', "累计充值"),
|
|
|
array('gold_coin', "金币"),
|
|
|
array('alipay', "绑定支付宝"),
|
|
|
array('small_count', "小号"),
|
|
|
array('vip_level', "VIP等级"),
|
|
|
array('register_type', "注册方式"),
|
|
|
array('register_time', L('Registration_time'), 'time_format', '*'),
|
|
|
array('login_time', "最后登录时间", 'time_format', '*'),
|
|
|
array('register_ip', L('Register_iP')),
|
|
|
array('lock_status', L('Account_status'), 'get_info_status', '*', '4'),
|
|
|
);
|
|
|
$map['tab_user.register_type']=['in','1,2'];
|
|
|
$map['tab_user.register_type']=['in','0,1,2,7'];
|
|
|
|
|
|
}
|
|
|
|
|
|
if (isset($_REQUEST['promote_account'])) {
|
|
|
$map['promote_id'] = get_promote_id(trim(I('promote_account')));
|
|
|
unset($_REQUEST['promote_account']);
|
|
|
}
|
|
|
if (isset($_REQUEST['register_way'])) {
|
|
|
if($_REQUEST['type']==1) {
|
|
|
if ($_GET['register_way'] == 1) {
|
|
|
empty($hav) || $hav .= ' AND ';
|
|
|
$hav .= ' tab_user.register_type in (0,1)';
|
|
|
$maps['tab_user.register_type'] = ['in',[0,1]];
|
|
|
} elseif($_GET['register_way'] == 7){
|
|
|
empty($hav) || $hav .= ' AND ';
|
|
|
$hav .= ' tab_user.register_type in(7)';
|
|
|
$maps['tab_user.register_type'] = 7;
|
|
|
}else {
|
|
|
empty($hav) || $hav .= ' AND ';
|
|
|
$hav .= ' tab_user.register_type in(2)';
|
|
|
$maps['tab_user.register_type'] = 2;
|
|
|
}
|
|
|
} else {
|
|
|
$map['register_way'] = I('register_way');
|
|
|
unset($_REQUEST['register_way']);
|
|
|
}
|
|
|
}
|
|
|
if (isset($_REQUEST['register_type'])) {
|
|
|
$map['register_type'] = I('register_type');
|
|
|
unset($_REQUEST['register_type']);
|
|
|
}
|
|
|
if (isset($_REQUEST['status'])) {
|
|
|
$map['lock_status'] = I('status');
|
|
|
unset($_REQUEST['status']);
|
|
|
}
|
|
|
if (!empty(I('time_start')) && !empty(I('time_end'))) {
|
|
|
$map['register_time'] = array('BETWEEN', array(strtotime(I('get.time_start')), strtotime(I('time_end')) + 24 * 60 * 60 - 1));
|
|
|
unset($_REQUEST['time_start']);
|
|
|
unset($_REQUEST['time_end']);
|
|
|
}
|
|
|
empty(I('account')) || $map['account'] = ['like', '%' . I('account') . '%'];
|
|
|
//排序
|
|
|
if (I('total_status') == 1) {
|
|
|
$order = 'cumulative asc';
|
|
|
} elseif (I('total_status') == 2) {
|
|
|
$order = 'cumulative desc';
|
|
|
} else {
|
|
|
$order = 'id desc';
|
|
|
}
|
|
|
|
|
|
if (isset($_REQUEST['viplevel'])) {
|
|
|
|
|
|
$havs = get_vip_level_limit('recharge_total',$_REQUEST['viplevel']);
|
|
|
}
|
|
|
|
|
|
$map['puid'] = array('eq',0);
|
|
|
$map['is_platform'] = 0;
|
|
|
//数据
|
|
|
$xlsData = M('user', 'tab_')->field('tab_user.id,tab_user.age_status,tab_user.account,tab_user.gold_coin,tab_user.alipay,tab_user.balance,tab_user.promote_account,register_time,tab_user.lock_status,tab_user.register_way,tab_user.register_type,tab_user.register_ip,tab_user.login_time,(IFNULL(sum(b.pay_amount),0) + IFNULL(sum(ss.pay_amount),0)) AS recharge_total')
|
|
|
->join('left join tab_deposit AS b ON tab_user.id = b.user_id AND b.pay_status = 1')
|
|
|
->join('left join tab_spend as ss on ss.user_id=tab_user.id AND ss.pay_status = 1')
|
|
|
->where($map)
|
|
|
->group('tab_user.id')
|
|
|
->order($order)
|
|
|
->having($havs)
|
|
|
->select();
|
|
|
if($xlsData) {
|
|
|
$ids = array_column($xlsData,'id');
|
|
|
/* 在手里 */
|
|
|
$small = M('user','tab_')->field('count(id) as count,puid')->where(['puid'=>array('in',$ids)])->group('puid')->select();
|
|
|
/* 出售中 */
|
|
|
$small2 = M('user','tab_')->field('count(id) as count,source_puid')->where(['source_puid'=>array('in',$ids),'source_time'=>0])->group('source_puid')->select();
|
|
|
|
|
|
foreach($xlsData as $k => $v) {
|
|
|
|
|
|
|
|
|
$xlsData[$k]['vip_level'] = get_vip_level($v['recharge_total']);
|
|
|
if(empty($v['alipay'])){
|
|
|
$xlsData[$k]['alipay'] = '--';
|
|
|
}
|
|
|
|
|
|
$xlsData[$k]['register_type'] = $v['register_type'] == 2?'手机号':($v['register_type']==7?'邮箱':'账号');
|
|
|
|
|
|
$xlsData[$k]['small_count'] = 0;
|
|
|
foreach($small as $s) {
|
|
|
if($s['puid'] == $v['id']) {
|
|
|
$xlsData[$k]['small_count'] += $s['count'];break;
|
|
|
}
|
|
|
}
|
|
|
foreach($small2 as $s) {
|
|
|
if($s['source_puid'] == $v['id']) {
|
|
|
$xlsData[$k]['small_count'] += $s['count'];break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
case 4:
|
|
|
$xlsName = $xlsName?$xlsName:"渠道充值";
|
|
|
|
|
|
/* if (isset($_REQUEST['game_name'])) {
|
|
|
if ($_REQUEST['game_name'] == L('All')) {
|
|
|
unset($_REQUEST['game_name']);
|
|
|
} else {
|
|
|
$map['game_name'] = $_REQUEST['game_name'];
|
|
|
unset($_REQUEST['game_name']);
|
|
|
}
|
|
|
}
|
|
|
if (!empty($_REQUEST['server_id'])) {
|
|
|
$map['server_id'] = $_REQUEST['server_id'];
|
|
|
unset($_REQUEST['server_id']);
|
|
|
}
|
|
|
if (isset($_REQUEST['promote_name'])) {
|
|
|
if ($_REQUEST['promote_name'] == L('All')) {
|
|
|
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['user_account']);
|
|
|
}
|
|
|
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']);
|
|
|
}
|
|
|
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']);
|
|
|
} */
|
|
|
|
|
|
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'))){
|
|
|
$maps['parent_id'] = I('parent_id');
|
|
|
$maps['grand_id'] =I('parent_id');
|
|
|
$maps['_logic'] = 'or';
|
|
|
$pro = M('promote','tab_')->field('id')->where($maps)->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');
|
|
|
}
|
|
|
|
|
|
|
|
|
$model = array(
|
|
|
'm_name' => 'Spend',
|
|
|
'map' => $map,
|
|
|
'order' => 'id desc',
|
|
|
'title' => '渠道充值',
|
|
|
'template_list' => 'spend_list',
|
|
|
);
|
|
|
$map1 = $map;
|
|
|
$map1['pay_status'] = 1;
|
|
|
$total = M('Spend', 'tab_')->where($map1)->sum('pay_amount');
|
|
|
$total = sprintf("%.2f", $total);
|
|
|
$xlsCell = array(
|
|
|
array('pay_order_number', "订单号"),
|
|
|
array('pay_time', "充值时间", 'time_format', '*'),
|
|
|
array('promote_account', L('Subordinate_channel')),
|
|
|
array('parent_id', "上级推广员"),
|
|
|
array('user_account', "玩家账号"),
|
|
|
array('game_name', "游戏名称"),
|
|
|
array('server_name', L('Game_area_clothing')),
|
|
|
array('game_player_name', "角色名"),
|
|
|
array('spend_ip', "充值ip"),
|
|
|
array('pay_amount', "应付金额"),
|
|
|
array('cost', "实付金额"),
|
|
|
array('pay_way', "充值方式", 'get_info_status', '*', 18),
|
|
|
array('promote_id', '商务专员', 'get_promote_business_account', '*'),
|
|
|
array('is_check','对账状态','get_info_status','*','37')
|
|
|
//array("", "共计充值{$total}"),
|
|
|
);
|
|
|
$name = $model['m_name'];
|
|
|
$xlsData = $data = D($name)
|
|
|
->where($map)
|
|
|
->order($model['order'])
|
|
|
->group($model['group'])
|
|
|
->select();
|
|
|
foreach ($xlsData as $key => &$value) {
|
|
|
$xlsData[$key]['parent_id'] = get_top_promote($value['promote_id'], $value['parent_id']);
|
|
|
}
|
|
|
break;
|
|
|
case 5:
|
|
|
$map['promote_id'] = array("neq", 0);
|
|
|
if (isset($_REQUEST['user_account'])) {
|
|
|
$map['user_account'] = array('like', '%' . $_REQUEST['user_account'] . '%');
|
|
|
unset($_REQUEST['user_account']);
|
|
|
}
|
|
|
if (!empty($_REQUEST['pay_way'])) {
|
|
|
$map['pay_way'] = $_REQUEST['pay_way'];
|
|
|
unset($_REQUEST['pay_way']);
|
|
|
}
|
|
|
if (isset($_REQUEST['promote_name'])) {
|
|
|
if ($_REQUEST['promote_name'] == L('All')) {
|
|
|
unset($_REQUEST['promote_name']);
|
|
|
} else if ($_REQUEST['promote_name'] == "官方渠道") {
|
|
|
$map['promote_id'] = array("elt", 0);
|
|
|
unset($_REQUEST['promote_name']);
|
|
|
} else {
|
|
|
$map['promote_id'] = get_promote_id($_REQUEST['promote_name']);
|
|
|
unset($_REQUEST['promote_name']);
|
|
|
unset($_REQUEST['promote_id']);
|
|
|
}
|
|
|
}
|
|
|
if (isset($_REQUEST['time-start']) && isset($_REQUEST['time-end'])) {
|
|
|
$map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['time-start']), strtotime($_REQUEST['time-end']) + 24 * 60 * 60 - 1));
|
|
|
unset($_REQUEST['time-start']);
|
|
|
unset($_REQUEST['time_end']);
|
|
|
}
|
|
|
if (isset($_REQUEST['start']) && isset($_REQUEST['end'])) {
|
|
|
$map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['start']), strtotime($_REQUEST['end']) + 24 * 60 * 60 - 1));
|
|
|
unset($_REQUEST['start']);
|
|
|
unset($_REQUEST['end']);
|
|
|
}
|
|
|
if (isset($_REQUEST['game_name'])) {
|
|
|
if ($_REQUEST['game_name'] == L('All')) {
|
|
|
unset($_REQUEST['game_name']);
|
|
|
} else {
|
|
|
$map['game_name'] = $_REQUEST['game_name'];
|
|
|
unset($_REQUEST['game_name']);
|
|
|
}
|
|
|
}
|
|
|
$map1 = $map;
|
|
|
$map1['pay_status'] = 1;
|
|
|
$total = M('Agent', 'tab_')->where($map1)->sum('amount');
|
|
|
$total = sprintf("%.2f", $total);
|
|
|
$xlsName = $xlsName?$xlsName:"代充记录";
|
|
|
$xlsCell = array(
|
|
|
array('promote_account', L('Subordinate_channel')),
|
|
|
array('user_account', "玩家账号"),
|
|
|
array('game_name', "游戏名称"),
|
|
|
array('amount', '代充金额'),
|
|
|
array('zhekou', '折扣比例'),
|
|
|
array('real_amount', '实付金额'),
|
|
|
array('pay_status', '充值状态', 'get_info_status', '*', '7'),
|
|
|
array('pay_way', '支付方式'),
|
|
|
array('create_time', '代充时间', 'time_format', '*'),
|
|
|
array("", "共计代充{$total}"),
|
|
|
);
|
|
|
|
|
|
$xlsData = D('Agent')
|
|
|
->where($map)
|
|
|
->order('id DESC')
|
|
|
->select();
|
|
|
foreach ($xlsData as $key=>$v){
|
|
|
$xlsData[$key]['pay_way'] = get_info_status($v['pay_way'],21);
|
|
|
}
|
|
|
break;
|
|
|
case 6:
|
|
|
if (isset($_REQUEST['account'])) {
|
|
|
if ($_REQUEST['account'] == L('All')) {
|
|
|
unset($_REQUEST['account']);
|
|
|
}
|
|
|
$map['account'] = array('like', '%' . $_REQUEST['account'] . '%');
|
|
|
unset($_REQUEST['account']);
|
|
|
}
|
|
|
$map['pay_limit'] = array('gt', '0');
|
|
|
$model = D('Promote');
|
|
|
$xlsData = $model
|
|
|
->where($map)
|
|
|
->select();
|
|
|
$xlsName = $xlsName?$xlsName:"代充额度";
|
|
|
$xlsCell = array(
|
|
|
array('id', 'ID'),
|
|
|
array('account', '推广员账号'),
|
|
|
array('pay_limit_game', "游戏名称", 'get_game_limit_name', '*'),
|
|
|
array('pay_limit', '代充额度'),
|
|
|
array('set_pay_time', '更新时间', 'time_format', '*'),
|
|
|
);
|
|
|
break;
|
|
|
case 7:
|
|
|
|
|
|
if (isset($_REQUEST['user_account'])) {
|
|
|
$map['user_account'] = array('like', '%' . trim($_REQUEST['user_account']) . '%');
|
|
|
unset($_REQUEST['user_account']);
|
|
|
}
|
|
|
if (isset($_REQUEST['spend_ip'])) {
|
|
|
$map['spend_ip'] = array('like', '%' . trim($_REQUEST['spend_ip']) . '%');
|
|
|
unset($_REQUEST['spend_ip']);
|
|
|
}
|
|
|
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']);
|
|
|
}
|
|
|
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']);
|
|
|
}
|
|
|
if (isset($_REQUEST['game_name'])) {
|
|
|
if ($_REQUEST['game_name'] == L('All')) {
|
|
|
unset($_REQUEST['game_name']);
|
|
|
} else {
|
|
|
$map['game_name'] = $_REQUEST['game_name'];
|
|
|
unset($_REQUEST['game_name']);
|
|
|
}
|
|
|
}
|
|
|
if (isset($_REQUEST['pay_order_number'])) {
|
|
|
$map['pay_order_number'] = array('like', '%' . trim($_REQUEST['pay_order_number']) . '%');
|
|
|
unset($_REQUEST['pay_order_number']);
|
|
|
}
|
|
|
if (isset($_REQUEST['pay_status'])) {
|
|
|
$map['pay_status'] = $_REQUEST['pay_status'];
|
|
|
unset($_REQUEST['pay_status']);
|
|
|
}
|
|
|
if (isset($_REQUEST['pay_way'])) {
|
|
|
$map['pay_way'] = $_REQUEST['pay_way'];
|
|
|
unset($_REQUEST['pay_status']);
|
|
|
}
|
|
|
if (isset($_REQUEST['pay_game_status'])) {
|
|
|
$map['pay_game_status'] = $_REQUEST['pay_game_status'];
|
|
|
unset($_REQUEST['pay_game_status']);
|
|
|
}
|
|
|
$map1 = $map;
|
|
|
$map1['pay_status'] = 1;
|
|
|
$total = D('Spend')->where($map1)->sum('pay_amount');
|
|
|
if (isset($map['pay_status']) && $map['pay_status'] == 0) {
|
|
|
$total = sprintf("%.2f", 0);
|
|
|
} else {
|
|
|
$total = sprintf("%.2f", $total);
|
|
|
}
|
|
|
$xlsData = D('Spend')
|
|
|
->field('pay_order_number,pay_time,user_account,game_name,promote_account,spend_ip,pay_amount,pay_amount,pay_status,pay_game_status,pay_way,server_name,game_player_name,cost')
|
|
|
->where($map)
|
|
|
->order('pay_time DESC')
|
|
|
->select();
|
|
|
$xlsCell = array(
|
|
|
array('pay_order_number', "订单号"),
|
|
|
array('pay_time', "充值时间", 'time_format', '*'),
|
|
|
array('user_account', "玩家账号"),
|
|
|
array('game_name', "游戏名称"),
|
|
|
array('promote_account', L('Subordinate_channel')),
|
|
|
array('spend_ip', "充值ip"),
|
|
|
array('server_name', "游戏区服"),
|
|
|
array('game_player_name', "角色名称"),
|
|
|
array('cost', "订单金额"),
|
|
|
array('pay_amount', "实付金额"),
|
|
|
array('pay_way', "充值方式", 'get_pay_way', '*'),
|
|
|
array('pay_status', L('Order_status'), 'get_info_status', '*', '9'),
|
|
|
array('pay_game_status', "游戏通知状态", 'get_info_status', '*', '14'),
|
|
|
array('', "消费"."{$total}")
|
|
|
);
|
|
|
break;
|
|
|
case 8:
|
|
|
$xlsName = $xlsName?$xlsName:L('Platform_currency_recharge');
|
|
|
if (isset($_REQUEST['user_account'])) {
|
|
|
$map['user_account'] = array('like', '%' . trim($_REQUEST['user_account']) . '%');
|
|
|
unset($_REQUEST['user_account']);
|
|
|
}
|
|
|
if (isset($_REQUEST['pay_order_number'])) {
|
|
|
$map['pay_order_number'] = array('like', '%' . trim($_REQUEST['pay_order_number']) . '%');
|
|
|
unset($_REQUEST['pay_order_number']);
|
|
|
}
|
|
|
if (isset($_REQUEST['pay_ip'])) {
|
|
|
$map['pay_ip'] = array('like', '%' . trim($_REQUEST['pay_ip']) . '%');
|
|
|
unset($_REQUEST['pay_ip']);
|
|
|
}
|
|
|
if (!isset($_REQUEST['promote_id'])) {
|
|
|
|
|
|
} else if (isset($_REQUEST['promote_id']) && $_REQUEST['promote_id'] == 0) {
|
|
|
$map['promote_id'] = array('elt', 0);
|
|
|
unset($_REQUEST['promote_id']);
|
|
|
unset($_REQUEST['promote_name']);
|
|
|
} elseif (isset($_REQUEST['promote_name']) && $_REQUEST['promote_id'] == -1) {
|
|
|
$map['promote_id'] = get_promote_id($_REQUEST['promote_name']);
|
|
|
unset($_REQUEST['promote_id']);
|
|
|
unset($_REQUEST['promote_name']);
|
|
|
} else {
|
|
|
$map['promote_id'] = $_REQUEST['promote_id'];
|
|
|
unset($_REQUEST['promote_id']);
|
|
|
unset($_REQUEST['promote_name']);
|
|
|
}
|
|
|
if (isset($_REQUEST['time-start']) && isset($_REQUEST['time-end'])) {
|
|
|
$map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['time-start']), strtotime($_REQUEST['time-end']) + 24 * 60 * 60 - 1));
|
|
|
unset($_REQUEST['time-start']);
|
|
|
unset($_REQUEST['time-end']);
|
|
|
}
|
|
|
if (isset($_REQUEST['start']) && isset($_REQUEST['end'])) {
|
|
|
$map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['start']), strtotime($_REQUEST['end']) + 24 * 60 * 60 - 1));
|
|
|
unset($_REQUEST['start']);
|
|
|
unset($_REQUEST['end']);
|
|
|
}
|
|
|
if (isset($_REQUEST['pay_way'])) {
|
|
|
$map['pay_way'] = $_REQUEST['pay_way'];
|
|
|
unset($_REQUEST['pay_way']);
|
|
|
}
|
|
|
if (isset($_REQUEST['pay_status'])) {
|
|
|
$map['pay_status'] = $_REQUEST['pay_status'];
|
|
|
unset($_REQUEST['pay_status']);
|
|
|
}
|
|
|
$map1 = $map;
|
|
|
$map1['pay_status'] = 1;
|
|
|
$total = D('Deposit')->where($map1)->sum('pay_amount');
|
|
|
if (isset($map['pay_status']) && $map['pay_status'] == 0) {
|
|
|
$total = sprintf("%.2f", 0);
|
|
|
} else {
|
|
|
$total = sprintf("%.2f", $total);
|
|
|
}
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('pay_order_number', "订单号"),
|
|
|
array('user_account', "玩家账号"),
|
|
|
array('promote_account', L('Subordinate_channel')),
|
|
|
array('pay_amount', "充值平台币"),
|
|
|
array('pay_way', "充值方式", 'get_pay_way', '*'),
|
|
|
array('pay_ip', "充值ip"),
|
|
|
array('create_time', "充值时间", 'time_format'),
|
|
|
array('pay_status', L('Order_status'), 'get_info_status', '*', '9'),
|
|
|
array('', "共计充值{$total}"),
|
|
|
);
|
|
|
$xlsData = D('Deposit')
|
|
|
->where($map)
|
|
|
->order('id DESC')
|
|
|
->select();
|
|
|
break;
|
|
|
case 9:
|
|
|
$xlsName = $xlsName?$xlsName:"平台币发放";
|
|
|
if (isset($_REQUEST['user_account'])) {
|
|
|
$map['user_account'] = array('like', '%' . trim($_REQUEST['user_account']) . '%');
|
|
|
unset($_REQUEST['user_account']);
|
|
|
}
|
|
|
if (isset($_REQUEST['time-start']) && isset($_REQUEST['time-end'])) {
|
|
|
$map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['time-start']), strtotime($_REQUEST['time-end']) + 24 * 60 * 60 - 1));
|
|
|
unset($_REQUEST['time-start']);
|
|
|
unset($_REQUEST['time-end']);
|
|
|
}
|
|
|
if (isset($_REQUEST['start']) && isset($_REQUEST['end'])) {
|
|
|
$map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['start']), strtotime($_REQUEST['end']) + 24 * 60 * 60 - 1));
|
|
|
unset($_REQUEST['start']);
|
|
|
unset($_REQUEST['end']);
|
|
|
}
|
|
|
if (isset($_REQUEST['game_name'])) {
|
|
|
if ($_REQUEST['game_name'] == L('All')) {
|
|
|
unset($_REQUEST['game_name']);
|
|
|
} else {
|
|
|
$map['game_name'] = $_REQUEST['game_name'];
|
|
|
unset($_REQUEST['game_name']);
|
|
|
}
|
|
|
}
|
|
|
if (isset($_REQUEST['op_account'])) {
|
|
|
if ($_REQUEST['op_account'] == L('All')) {
|
|
|
unset($_REQUEST['op_account']);
|
|
|
} else {
|
|
|
$map['op_account'] = $_REQUEST['op_account'];
|
|
|
unset($_REQUEST['op_account']);
|
|
|
}
|
|
|
}
|
|
|
$map1 = $map;
|
|
|
$map1['status'] = 1;
|
|
|
$total = M('provide', 'tab_')->where($map1)->sum('amount');
|
|
|
$total = sprintf("%.2f", $total);
|
|
|
$xlsData = M('provide', 'tab_')
|
|
|
->where($map)
|
|
|
->order('id DESC')
|
|
|
->select();
|
|
|
$xlsCell = array(
|
|
|
array('pay_order_number', "订单号"),
|
|
|
array('user_account', "玩家账号"),
|
|
|
array('game_name', "游戏名称"),
|
|
|
array('amount', "发放数量"),
|
|
|
array('status', "状态", 'get_info_status', '*', '15'),
|
|
|
array('op_account', L('Operator')),
|
|
|
array('create_time', "发放时间", 'time_format', '*'),
|
|
|
array('', "共计发放{$total}"),
|
|
|
);
|
|
|
break;
|
|
|
case 10:
|
|
|
$xlsName = $xlsName?$xlsName:"绑定平台币消费";
|
|
|
if (isset($_REQUEST['user_account'])) {
|
|
|
$map['user_account'] = array('like', '%' . trim($_REQUEST['user_account']) . '%');
|
|
|
unset($_REQUEST['user_account']);
|
|
|
}
|
|
|
if (isset($_REQUEST['pay_order_number'])) {
|
|
|
$map['pay_order_number'] = array('like', '%' . trim($_REQUEST['pay_order_number']) . '%');
|
|
|
unset($_REQUEST['pay_order_number']);
|
|
|
}
|
|
|
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']);
|
|
|
}
|
|
|
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']);
|
|
|
}
|
|
|
if (isset($_REQUEST['game_name'])) {
|
|
|
if ($_REQUEST['game_name'] == L('All')) {
|
|
|
unset($_REQUEST['game_name']);
|
|
|
} else {
|
|
|
$map['game_name'] = $_REQUEST['game_name'];
|
|
|
}
|
|
|
unset($_REQUEST['game_name']);
|
|
|
}
|
|
|
if (isset($_REQUEST['server_name'])) {
|
|
|
if ($_REQUEST['server_name'] == L('All')) {
|
|
|
unset($_REQUEST['server_name']);
|
|
|
} else {
|
|
|
$map['server_name'] = $_REQUEST['server_name'];
|
|
|
unset($_REQUEST['server_name']);
|
|
|
}
|
|
|
}
|
|
|
$map1 = $map;
|
|
|
$map1['pay_status'] = 1;
|
|
|
$total = D('BindSpend')->where($map1)->sum('pay_amount');
|
|
|
$total = sprintf("%.2f", $total);
|
|
|
$xlsCell = array(
|
|
|
array('pay_order_number', "订单号"),
|
|
|
array('pay_time', "充值时间", 'time_format', '*'),
|
|
|
array('user_account', "玩家账号"),
|
|
|
array('game_name', "游戏名称"),
|
|
|
array('server_name', L('Game_area_clothing')),
|
|
|
array('game_player_name', "角色名"),
|
|
|
array('spend_ip', "充值ip"),
|
|
|
array('pay_amount', "充值金额"),
|
|
|
array('pay_status', L('Order_status'), 'get_info_status', '*', '9'),
|
|
|
array('pay_game_status', '游戏通知状态', 'get_info_status', '*', '14'),
|
|
|
array('', "共计使用{$total}")
|
|
|
);
|
|
|
$xlsData = D('BindSpend')
|
|
|
->where($map)
|
|
|
->order('pay_time DESC,id DESC')
|
|
|
->select();
|
|
|
break;
|
|
|
case 11:
|
|
|
$xlsName = $xlsName?$xlsName:"礼包领取";
|
|
|
$xlsCell = array(
|
|
|
array('user_account', "玩家账号"),
|
|
|
array('game_name', "游戏名称"),
|
|
|
array('gift_name', '礼包名称'),
|
|
|
array('novice', '礼包卡号'),
|
|
|
array('gift_id', '运营平台', 'get_operation_platform', '*', 'giftbag'),
|
|
|
array('create_time', '领取时间', 'time_format', '*'),
|
|
|
);
|
|
|
if (isset($_REQUEST['game_name'])) {
|
|
|
$extend['game_name'] = trim($_REQUEST['game_name']);
|
|
|
unset($_REQUEST['game_name']);
|
|
|
}
|
|
|
if (isset($_REQUEST['user_account'])) {
|
|
|
$extend['user_account'] = trim($_REQUEST['user_account']);
|
|
|
unset($_REQUEST['user_account']);
|
|
|
}
|
|
|
if (isset($_REQUEST['sdk_version'])) {
|
|
|
if ($_REQUEST['sdk_version'] == '') {
|
|
|
unset($_REQUEST['sdk_version']);
|
|
|
} else {
|
|
|
$map['sdk_version'] = $_REQUEST['sdk_version'];
|
|
|
$game_ids = M('game', 'tab_')->field('id')->where($map)->select();
|
|
|
$game_ids = array_column($game_ids, 'id');
|
|
|
$extend['sdk_version'] = ['in', $game_ids];
|
|
|
unset($_REQUEST['sdk_version']);
|
|
|
}
|
|
|
}
|
|
|
$xlsData = M('gift_record', 'tab_')
|
|
|
->where($extend)
|
|
|
->order("id DESC")
|
|
|
->select();
|
|
|
break;
|
|
|
case 12:
|
|
|
get_info_status();
|
|
|
$xlsName = $xlsName?$xlsName:"推广员提现";
|
|
|
$xlsCell = array(
|
|
|
array('settlement_number', '提现单号'),
|
|
|
array('sum_money', '提现金额'),
|
|
|
array('promote_id', '推广员账号'),
|
|
|
array('create_time', '申请时间', 'time_format', '*'),
|
|
|
array('status', '提现状态', 'get_info_status', '*', 19),
|
|
|
array('end_time', '审核时间', 'time_format', '*'),
|
|
|
array('withdraw_type', '打款方式' ,'get_info_status', '*', 36),
|
|
|
);
|
|
|
if (isset($_REQUEST['settlement_number'])) {
|
|
|
$map['settlement_number'] = $_REQUEST['settlement_number'];
|
|
|
}
|
|
|
if (isset($_REQUEST['status'])) {
|
|
|
$map['status'] = $_REQUEST['status'];
|
|
|
}
|
|
|
if (isset($_REQUEST['promote_account'])) {
|
|
|
if ($_REQUEST['promote_account'] == L('All')) {
|
|
|
unset($_REQUEST['promote_account']);
|
|
|
} else {
|
|
|
$map['promote_account'] = $_REQUEST['promote_account'];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if ($_REQUEST['create_time'] == 2) {
|
|
|
$order = 'create_time desc';
|
|
|
} elseif ($_REQUEST['create_time'] == 1) {
|
|
|
$order = 'create_time asc';
|
|
|
}
|
|
|
if ($_REQUEST['sum_money'] == 2) {
|
|
|
$order = 'sum_money desc';
|
|
|
} elseif ($_REQUEST['sum_money'] == 1) {
|
|
|
$order = 'sum_money asc';
|
|
|
}
|
|
|
$model = array(
|
|
|
'm_name' => 'withdraw',
|
|
|
'order' => $order,
|
|
|
'title' => '推广员提现',
|
|
|
'template_list' => 'withdraw',
|
|
|
);
|
|
|
$name = $model['m_name'];
|
|
|
$xlsData = D($name)
|
|
|
->where($map)
|
|
|
->order($model['order'])
|
|
|
->select();
|
|
|
break;
|
|
|
|
|
|
case 14:
|
|
|
$xlsName = $xlsName?$xlsName:"游戏返利";
|
|
|
$xlsCell = array(
|
|
|
array('pay_order_number', "订单号"),
|
|
|
array('create_time', '返利时间', 'time_foramt', '*'),
|
|
|
array('user_id', "玩家账号", 'get_user_account', '*'),
|
|
|
array('promote_id', "所属推广员", 'get_promote_name', '*'),
|
|
|
array('game_name', "游戏名称"),
|
|
|
array('pay_amount', "充值金额"),
|
|
|
array('ratio', '返利比例', 'ratio_stytl', '*'),
|
|
|
array('ratio_amount', '返利绑币'),
|
|
|
);
|
|
|
if (isset($_REQUEST['user_account'])) {
|
|
|
$map['user_name'] = array('like', '%' . trim($_REQUEST['user_account']) . '%');
|
|
|
unset($_REQUEST['user_account']);
|
|
|
}
|
|
|
if (isset($_REQUEST['game_name'])) {
|
|
|
if ($_REQUEST['game_name'] == L('All')) {
|
|
|
unset($_REQUEST['game_name']);
|
|
|
} else {
|
|
|
$map['game_name'] = $_REQUEST['game_name'];
|
|
|
unset($_REQUEST['game_name']);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$xlsData = M('RebateList', 'tab_')
|
|
|
->where($map)
|
|
|
->order('id DESC')
|
|
|
->select();
|
|
|
break;
|
|
|
case 15:
|
|
|
$xlsName = $xlsName?$xlsName:"推广结算";
|
|
|
$xlsCell = array(
|
|
|
array('promote_account', '推广员账号'),
|
|
|
array('settlement_cycle', '结算周期',),
|
|
|
array('settlement_number', "结算单号"),
|
|
|
array('total_money', '总充值'),
|
|
|
array('total_number', '总注册'),
|
|
|
array('sum_money', '结算金额'),
|
|
|
array('bind_coin_status','结算范畴','get_bind_coin_status','*'),
|
|
|
array('create_time', '结算时间', 'time_format', '*'),
|
|
|
);
|
|
|
if (isset($_REQUEST['promote_account'])) {
|
|
|
$map['promote_account'] = array('like', '%' . trim($_REQUEST['promote_account']) . '%');
|
|
|
unset($_REQUEST['promote_account']);
|
|
|
}
|
|
|
if (isset($_REQUEST['game_name'])) {
|
|
|
if ($_REQUEST['game_name'] == L('All')) {
|
|
|
unset($_REQUEST['game_name']);
|
|
|
} else {
|
|
|
$map['game_name'] = $_REQUEST['game_name'];
|
|
|
unset($_REQUEST['game_name']);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$xlsData = M('settlement', 'tab_')
|
|
|
->field(array(
|
|
|
'settlement_number',
|
|
|
'starttime','endtime',
|
|
|
'promote_id','promote_account',
|
|
|
'sum(total_money) as total_money',
|
|
|
'sum(total_number) as total_number',
|
|
|
'sum(sum_money) as sum_money',
|
|
|
'bind_coin_status',
|
|
|
'create_time'))
|
|
|
->where($map)
|
|
|
->group('promote_id,starttime,endtime,create_time,bind_coin_status')
|
|
|
->order('create_time DESC')
|
|
|
->select();
|
|
|
foreach ($xlsData as $key=>$v){
|
|
|
$xlsData[$key]['settlement_cycle'] = date('Y-m-d',$v['starttime'])."-".$v['endtime'];
|
|
|
}
|
|
|
break;
|
|
|
case 16:
|
|
|
$xlsName = $xlsName?$xlsName:"给玩家发放";
|
|
|
$xlsCell = array(
|
|
|
array('pay_order_number', "订单号"),
|
|
|
array('user_account', "玩家账号"),
|
|
|
array('type', "发放类型"),
|
|
|
array('amount', "发放数量"),
|
|
|
array('status', "状态", 'get_info_status', '*', '15'),
|
|
|
array('op_account', '操作人员'),
|
|
|
array('create_time', '发放时间', 'time_format', '*'),
|
|
|
);
|
|
|
|
|
|
if (isset($_REQUEST['user_account'])) {
|
|
|
$map['user_account'] = array('like', '%' . trim($_REQUEST['user_account']) . '%');
|
|
|
}
|
|
|
if (isset($_REQUEST['op_id'])) {
|
|
|
$map['op_id'] = $_REQUEST['op_id'];
|
|
|
}
|
|
|
|
|
|
if (isset($_REQUEST['start']) && isset($_REQUEST['end'])) {
|
|
|
$map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['start']), strtotime($_REQUEST['end']) + 24 * 60 * 60 - 1));
|
|
|
}
|
|
|
|
|
|
$xlsData = M('provide_user', 'tab_')->field('*,"平台币" as type')
|
|
|
->where($map)
|
|
|
->order('id DESC')
|
|
|
->select();
|
|
|
break;
|
|
|
case 17:
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('id', "ID"),
|
|
|
array('account', "开发者账号"),
|
|
|
array('nickname', "开发者名称"),
|
|
|
array('xingzhi', "账号性质"),
|
|
|
array('nature', '属性','get_developer_type', '*'),
|
|
|
array('link_man', '联系人'),
|
|
|
array('mobile_phone', '手机号码'),
|
|
|
array('create_time', '注册时间', 'time_format', '*'),
|
|
|
array('last_login_time', '最后登录时间'),
|
|
|
array('status', '状态','get_info_status', '*', '35'),
|
|
|
);
|
|
|
|
|
|
if(isset($_GET['account'])){
|
|
|
$map['account']=I('get.account');
|
|
|
}
|
|
|
if(isset($_GET['status'])){
|
|
|
$map['status']=I('get.status');
|
|
|
}
|
|
|
|
|
|
if (isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])) {
|
|
|
$map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 24 * 60 * 60 - 1));
|
|
|
unset($_REQUEST['timestart']);
|
|
|
unset($_REQUEST['timeend']);
|
|
|
}
|
|
|
$xlsData = M('Developers', 'tab_')
|
|
|
->field('id,account,nickname,nature,link_man,mobile_phone,create_time,last_login_time,status,"开发者" as "xingzhi"')
|
|
|
->where($map)
|
|
|
->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']:'空';
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
case 18:
|
|
|
$xlsName = $xlsName?$xlsName:"开发者结算";
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('id', "ID"),
|
|
|
array('timestart', "月份"),
|
|
|
array('developers', "CP方"),
|
|
|
array('game_name', "游戏名称"),
|
|
|
array('total', '总充值'),
|
|
|
array('selle_ratio', '分成比例'),
|
|
|
array('ratio_money', '结算金额'),
|
|
|
array('selle_status', '状态'),
|
|
|
);
|
|
|
|
|
|
if($_REQUEST['sum_money']==2){
|
|
|
$order='pay_amount desc';
|
|
|
}else if($_REQUEST['sum_money']==1){
|
|
|
$order='pay_amount asc';
|
|
|
}
|
|
|
if(isset($_REQUEST['timestart'])&&$_REQUEST['timestart']!=''&&$_REQUEST['group']==1){
|
|
|
$starttime = strtotime($_REQUEST['timestart']);
|
|
|
$endtime = strtotime($_REQUEST['timeend'])+24*3600-1;
|
|
|
|
|
|
if(isset($_REQUEST['developers_id'])){
|
|
|
$map['g.developers'] = $_REQUEST['developers_id'];
|
|
|
}else{
|
|
|
$this->error('请选择开发者');
|
|
|
}
|
|
|
|
|
|
if(isset($_REQUEST['selle_status'])){
|
|
|
if($_REQUEST['selle_status']=="未结算"){
|
|
|
$map['s.selle_status']=0;
|
|
|
}else if($_REQUEST['selle_status']=="已结算"){
|
|
|
$map['s.selle_status']=1;
|
|
|
}
|
|
|
}
|
|
|
//判断是否结算绑币
|
|
|
if($_REQUEST['bind_coin'] == 0){
|
|
|
$map['s.pay_way'] = array('neq',-1);
|
|
|
}
|
|
|
$map['s.pay_status']=1;
|
|
|
$map['pay_time']=array('BETWEEN',array($starttime,$endtime));
|
|
|
$model = array(
|
|
|
'm_name' => 'Spend as s',
|
|
|
'order' => $order,
|
|
|
'title' => '渠道结算',
|
|
|
'group' => 'g.developers,g.id',
|
|
|
'fields' => 'sum(s.pay_amount) as total,s.selle_ratio,s.id,g.developers,s.selle_status,g.id as gid,g.game_name,s.pay_status,s.pay_amount',
|
|
|
'template_list' =>'cpsettlement',
|
|
|
);
|
|
|
|
|
|
|
|
|
$fields = $model['fields'];
|
|
|
//读取模型数据列表
|
|
|
$name = $model['m_name'];
|
|
|
// var_dump($fields);exit;
|
|
|
$new_model = M($name,'tab_');
|
|
|
$data = $new_model
|
|
|
->field($fields.",g.developers")
|
|
|
// 查询条件
|
|
|
->where($map)
|
|
|
/* 默认通过id逆序排列 */
|
|
|
->order($model['order'])
|
|
|
->join('tab_game as g on g.id=s.game_id','LEFT')
|
|
|
//根据字段分组
|
|
|
->group($model['group'])
|
|
|
/* 数据分页 */
|
|
|
->order($model['order'])
|
|
|
/* 执行查询 */
|
|
|
->select();
|
|
|
|
|
|
foreach ($data as $key => $value){
|
|
|
$data[$key]['timestart'] = I('timestart');
|
|
|
$data[$key]['developers'] = get_developers_account($data[$key]['developers'],'account');
|
|
|
$data[$key]['ratio_money'] = $data[$key]['total']*$data[$key]['selle_ratio']/100;
|
|
|
$data[$key]['selle_status'] = $data[$key]['selle_status'] == 0 ? "未结算" : "已结算";
|
|
|
}
|
|
|
|
|
|
$xlsData = $data;
|
|
|
}
|
|
|
|
|
|
|
|
|
break;
|
|
|
case 19:
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('developers', "开发者账号"),
|
|
|
array('settlement_number', "结算单号"),
|
|
|
array('starttime', "周期开始时间",'time_format','*'),
|
|
|
array('endtime', "周期结束时间",'time_format','*'),
|
|
|
array('total_money', '总充值(元)'),
|
|
|
array('sum_money', '结算金额(元)'),
|
|
|
array('bind_coin_status','结算范围','get_bind_coin_status','*'),
|
|
|
array('create_time', "结算时间",'time_format','*'),
|
|
|
);
|
|
|
if(isset($_REQUEST['timestart']) && $_REQUEST['timeend']!=''){
|
|
|
$starttime = strtotime($_REQUEST['timestart']);
|
|
|
$endtime = strtotime($_REQUEST['timeend'])+24*3600-1;
|
|
|
$map['starttime'] = array('egt',$starttime);
|
|
|
$map['endtime'] = array('elt',$endtime);
|
|
|
}elseif(isset($_REQUEST['timestart'])){
|
|
|
$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']!=''){
|
|
|
$starttime = strtotime($_REQUEST['start']);
|
|
|
$endtime = strtotime($_REQUEST['end'])+24*3600-1;
|
|
|
$map['create_time'] = array('BETWEEN',array($starttime,$endtime));
|
|
|
}elseif(isset($_REQUEST['start'])){
|
|
|
$starttime = strtotime($_REQUEST['start']);
|
|
|
$map['create_time'] = array('BETWEEN',array($starttime,time()));
|
|
|
}elseif(isset($_REQUEST['end'])){
|
|
|
$endtime = strtotime($_REQUEST['end'])+24*3600-1;
|
|
|
$map['create_time'] = array('LT',$endtime);
|
|
|
}
|
|
|
|
|
|
if(isset($_REQUEST['developers_id'])){
|
|
|
$map['developers']=$_REQUEST['developers_id'];
|
|
|
}else{
|
|
|
$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');
|
|
|
}
|
|
|
$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']);
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
default:
|
|
|
$xlsName = $xlsCell = $xlsData = [];
|
|
|
|
|
|
}
|
|
|
//数据处理
|
|
|
foreach ($xlsData as $key => $val) {
|
|
|
foreach ($xlsCell as $k => $v) {
|
|
|
if (isset($v[2])) {
|
|
|
$ar_k = array_search('*', $v);
|
|
|
if ($ar_k !== false) {
|
|
|
$v[$ar_k] = $val[$v[0]];
|
|
|
}
|
|
|
$fun = $v[2];
|
|
|
$param = $v;
|
|
|
unset($param[0], $param[1], $param[2]);
|
|
|
$xlsData[$key][$v[0]] = call_user_func_array($fun, $param);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
public function userarpuExport($p=1){
|
|
|
$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");
|
|
|
}
|
|
|
if(!empty($request['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) {
|
|
|
switch ($value) {
|
|
|
case 'time':
|
|
|
$xlsCell[$key] = array('time', "日期");
|
|
|
break;
|
|
|
case 'game_id':
|
|
|
$xlsCell[$key] = array('game_id', "游戏名称");
|
|
|
break;
|
|
|
case 'promote_id':
|
|
|
$xlsCell[$key] = array('promote_id', "推广员账号");
|
|
|
break;
|
|
|
case 'register_num':
|
|
|
$xlsCell[$key] = array('register_num', '新增玩家', 'time_format', '*');
|
|
|
break;
|
|
|
case 'act_user':
|
|
|
$xlsCell[$key] = array('act_user', '活跃玩家', 'time_format', '*');
|
|
|
break;
|
|
|
case 'keep_num':
|
|
|
$xlsCell[$key] = array('keep_num', '1日留存');
|
|
|
break;
|
|
|
case 'spend':
|
|
|
$xlsCell[$key] = array('spend', "充值");
|
|
|
break;
|
|
|
case 'spend_people':
|
|
|
$xlsCell[$key] = array('spend_people', '付费玩家');
|
|
|
break;
|
|
|
case 'spend_people':
|
|
|
$xlsCell[$key] = array('spend_people', '付费玩家');
|
|
|
break;
|
|
|
case 'new_pop':
|
|
|
$xlsCell[$key] = array('new_pop', '新付费玩家');
|
|
|
break;
|
|
|
case 'spend_rate':
|
|
|
$xlsCell[$key] = array('spend_rate', '付费率');
|
|
|
break;
|
|
|
case 'ARPU':
|
|
|
$xlsCell[$key] = array('ARPU', 'ARPU');
|
|
|
break;
|
|
|
case 'ARPPU':
|
|
|
$xlsCell[$key] = array('ARPPU', 'ARPPU');
|
|
|
break;
|
|
|
case 'pop_num':
|
|
|
$xlsCell[$key] = array('pop_num', '累计付费玩家');
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$page = intval($p);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据arraypage
|
|
|
$arraypage = $page ? $page : 1; //默认显示第一页数据
|
|
|
$row = 10;
|
|
|
$start = I('start');
|
|
|
$end = empty(I('end')) ? time_format(time(),'Y-m-d') : I('end');
|
|
|
$game_id = I('game_id');
|
|
|
$promote_id = I('promote_id');
|
|
|
$map_list = array();
|
|
|
if(I('game_id') !=0){
|
|
|
$this->assign('game_name',get_game_name(I('game_id')));
|
|
|
}
|
|
|
if(I('promote_id') !=0){
|
|
|
$this->assign('promote_name',get_promote_account(I('promote_id')));
|
|
|
}
|
|
|
if(I('game_id') != '') $map_list['game_id'] = I('game_id');
|
|
|
if(I('promote_id') != '') $map_list['promote_id'] = I('promote_id');
|
|
|
if(!empty($start)) {
|
|
|
//新增玩家
|
|
|
$data = A('Stat')->count_register($start, $end, $game_id, $promote_id);
|
|
|
foreach ($data as $key => $value) {
|
|
|
$time = $value['time'];
|
|
|
//活跃玩家
|
|
|
$data[$key]['act_user'] = A('Stat')->count_act_user($time,$game_id,$promote_id);
|
|
|
//1日留存
|
|
|
$map = $map_list;
|
|
|
if($map_list['promote_id']!=''){
|
|
|
$map['tab_user.promote_id']=$map_list['promote_id'];
|
|
|
}
|
|
|
unset($map['promote_id']);
|
|
|
$map["FROM_UNIXTIME(register_time,'%Y-%m-%d')"] = $time;
|
|
|
$login_time = date('Y-m-d', strtotime("+1 day",strtotime($time)));
|
|
|
$num = M('user','tab_')
|
|
|
->field('count(DISTINCT tab_user.id) as num')
|
|
|
->join("right join tab_user_login_record as ur on ur.user_id = tab_user.id and FROM_UNIXTIME(ur.login_time,'%Y-%m-%d') = '{$login_time}'")
|
|
|
->where($map)
|
|
|
->group('user_id')
|
|
|
->find();
|
|
|
$data[$key]['keep_num'] = (round($num['num']/$data[$key]['register_num'],4)*100) . '%';
|
|
|
//充值
|
|
|
$map = $map_list;
|
|
|
empty($game_name ) || $map['game_name'] = array('like','%'.$game_name.'%');
|
|
|
empty($promote_id) || $map['promote_id'] = $promote_id;
|
|
|
$map['pay_status'] = 1;
|
|
|
$map["FROM_UNIXTIME(pay_time,'%Y-%m-%d')"] = $time;
|
|
|
$spend = M('spend','tab_')->field("IFNULL(sum(pay_amount),0) as money,IFNULL(count(distinct user_id),0) as people")->where($map)->find();
|
|
|
$data[$key]['spend'] = $spend['money'];
|
|
|
//付费玩家数
|
|
|
$data[$key]['spend_people'] = $spend['people'];
|
|
|
//新付费玩家
|
|
|
$map = $map_list;
|
|
|
$map['pay_status'] = 1;
|
|
|
$sql = M('spend','tab_')->field("user_id,min(pay_time) as time")->group('user_id')->where($map)->select(false);
|
|
|
$sql = "select IFNULL(count(user_id),0) as num from ({$sql}) as t WHERE FROM_UNIXTIME(t.time,'%Y-%m-%d') = '{$time}'";
|
|
|
$query = M()->query($sql);
|
|
|
$data[$key]['new_pop'] = $query[0]['num'];
|
|
|
//付费率
|
|
|
$data[$key]['spend_rate'] = (round($data[$key]['spend_people']/$data[$key]['act_user'],4)*100) . '%';
|
|
|
//ARPU
|
|
|
$data[$key]['ARPU'] = round($data[$key]['spend']/$data[$key]['act_user'],2);
|
|
|
//ARPPU
|
|
|
$data[$key]['ARPPU'] = round($data[$key]['spend']/$data[$key]['spend_people'],2);
|
|
|
|
|
|
//累计付费玩家
|
|
|
$map = $map_list;
|
|
|
$map['pay_status'] = 1;
|
|
|
$map["FROM_UNIXTIME(pay_time,'%Y-%m-%d')"] = array('elt',$time);
|
|
|
$pop_num = M('spend','tab_')->field('count(distinct user_id) as num')->where($map)->find();
|
|
|
$data[$key]['pop_num'] = $pop_num['num'];
|
|
|
}
|
|
|
}else{
|
|
|
unset($_REQUEST['data_order']);
|
|
|
if(count(I('get.'))!=0){
|
|
|
$this->error('时间选择错误,请重新选择!');
|
|
|
}
|
|
|
}
|
|
|
if($request['data_order']!=''){
|
|
|
$data_order=reset(explode(',',$request['data_order']));
|
|
|
$data_order_type=end(explode(',',$request['data_order']));
|
|
|
$this->assign('userarpu_order',$data_order);
|
|
|
$this->assign('userarpu_order_type',$data_order_type);
|
|
|
}
|
|
|
$data=my_sort($data,$data_order_type,(int)$data_order,SORT_STRING);
|
|
|
$size=10;//每页显示的记录数
|
|
|
$pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数
|
|
|
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
|
|
|
$data = array_slice($data, ($arraypage-1)*$size, $size);
|
|
|
foreach ($data as $key => $value) {
|
|
|
$data[$key]['game_id'] = get_game_name($request['game_id']);
|
|
|
$data[$key]['promote_id'] = get_promote_account($request['promote_id']);
|
|
|
}
|
|
|
$xlsData = $data;
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 统计-平台统计
|
|
|
*
|
|
|
* @param int $type 1: 游戏充值统计,2:注册方式统计,3:充值方式统计,其他:游戏注册统计
|
|
|
* @param int $p
|
|
|
*
|
|
|
* @author: 鹿文学[lwx]<fyj301415926@126.com>
|
|
|
* @since: 2019\5\7 0007 10:52
|
|
|
*/
|
|
|
public function platform_statistics($type=0, $p=1) {
|
|
|
switch($type) {
|
|
|
case 1:
|
|
|
$this->gamepay_statistics_export($p);
|
|
|
break;
|
|
|
case 2:
|
|
|
$this->resway_statistics_export($p);
|
|
|
break;
|
|
|
case 3:
|
|
|
$this->payway_statistics_export($p);
|
|
|
break;
|
|
|
default:
|
|
|
$this->game_statistics_export($p);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private function game_statistics_export($p = 1){
|
|
|
$xlsName = $_REQUEST['xlsname']?$_REQUEST['xlsname']:"游戏注册统计";
|
|
|
$xlsCell = array(
|
|
|
array('fgame_name', "游戏名称"),
|
|
|
array('count', "累计注册"),
|
|
|
array('rand', "排行榜"),
|
|
|
array('today', "今日注册"),
|
|
|
array('week', "本周注册"),
|
|
|
array('mounth', "本月注册"),
|
|
|
);
|
|
|
$page = intval($p);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
$arraypage=$page;
|
|
|
$row = 10;
|
|
|
$user=M('User','tab_');
|
|
|
$map['fgame_id']=array('gt',0);$map['puid'] = 0;
|
|
|
if(isset($_REQUEST['timestart'])&&isset($_REQUEST['timeend'])){
|
|
|
$map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+24*60*60-1));
|
|
|
unset($_REQUEST['timestart']);unset($_REQUEST['timeend']);
|
|
|
}
|
|
|
if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){
|
|
|
$map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1));
|
|
|
unset($_REQUEST['start']);unset($_REQUEST['end']);
|
|
|
}
|
|
|
if(isset($_REQUEST['game_name'])&&$_REQUEST['game_name']!=''){
|
|
|
$map['fgame_name'] =$_REQUEST['game_name'];
|
|
|
unset($_REQUEST['fgame_name']);
|
|
|
}
|
|
|
$today=total(1);
|
|
|
$week=total(2);
|
|
|
$mounth=total(3);
|
|
|
$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,
|
|
|
count(IF(register_time '.$week.',1,null)) as week,
|
|
|
count(IF(register_time '.$mounth.',1,null)) as mounth')
|
|
|
->where($map)
|
|
|
->group('fgame_id')
|
|
|
->order('count desc')
|
|
|
->select();
|
|
|
$count=count($data);
|
|
|
foreach ($data as $key => $value) {
|
|
|
static $i=0;
|
|
|
$i++;
|
|
|
$data[$key]['rand']=$i;
|
|
|
}
|
|
|
$total=A('Platform')->data_total($data);
|
|
|
if($_REQUEST['data_order']!=''){
|
|
|
$data_order=reset(explode(',',$_REQUEST['data_order']));
|
|
|
$data_order_type=end(explode(',',$_REQUEST['data_order']));
|
|
|
$this->assign('userarpu_order',$data_order);
|
|
|
$this->assign('userarpu_order_type',$data_order_type);
|
|
|
}
|
|
|
$data=my_sort($data,$data_order_type,(int)$data_order);
|
|
|
$size=$row;//每页显示的记录数
|
|
|
$pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数
|
|
|
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
|
|
|
$data = array_slice($data, ($arraypage-1)*$size, $size);
|
|
|
$length = count($data);
|
|
|
$data[$length] = array(
|
|
|
'fgame_name'=>'汇总',
|
|
|
'count'=>$total['sum_count'],
|
|
|
'rand'=>'---',
|
|
|
'today'=>$total['sum_today'],
|
|
|
'week'=>$total['sum_week'],
|
|
|
'mounth'=>$total['sum_mounth']
|
|
|
);
|
|
|
$xlsData = $data;
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}
|
|
|
|
|
|
private function gamepay_statistics_export($p=1){
|
|
|
$xlsName = $_REQUEST['xlsname']?$_REQUEST['xlsname']:"游戏充值统计";
|
|
|
$xlsCell = array(
|
|
|
array('game_name', "游戏名称"),
|
|
|
array('count', "累计充值"),
|
|
|
array('rand', "排行榜"),
|
|
|
array('today', "今日充值"),
|
|
|
array('week', "本周充值"),
|
|
|
array('mounth', "本月充值"),
|
|
|
);
|
|
|
$page = intval($p);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
$arraypage=$page;
|
|
|
$row = 10;
|
|
|
$spend=M('Spend','tab_');
|
|
|
$deposit = M('Deposit',"tab_");
|
|
|
$map['game_id']=array('gt',0);
|
|
|
if(isset($_REQUEST['timestart'])&&isset($_REQUEST['timeend'])){
|
|
|
$map['pay_time'] =array('BETWEEN',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+24*60*60-1));
|
|
|
unset($_REQUEST['timestart']);unset($_REQUEST['timeend']);
|
|
|
}
|
|
|
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']);
|
|
|
}
|
|
|
if(isset($_REQUEST['game_name'])&&$_REQUEST['game_name']!=''){
|
|
|
$map['game_id'] =$_REQUEST['game_name'];
|
|
|
unset($_REQUEST['game_name']);
|
|
|
}
|
|
|
$map['pay_status']=1;
|
|
|
$today=total(1);
|
|
|
$week=total(2);
|
|
|
$mounth=total(3);
|
|
|
$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,
|
|
|
sum(IF(pay_time '.$week.',pay_amount,0)) as week,
|
|
|
sum(IF(pay_time '.$mounth.',pay_amount,0)) as mounth')
|
|
|
->where($map)
|
|
|
->group('game_id')
|
|
|
->order('count desc')
|
|
|
->select();
|
|
|
$count=count($data);
|
|
|
foreach ($data as $key => $value) {
|
|
|
static $i=0;
|
|
|
$i++;
|
|
|
$data[$key]['rand']=$i;
|
|
|
}
|
|
|
$total=A('Platform')->data_total($data);
|
|
|
$this->assign('total',$total);
|
|
|
if($_REQUEST['data_order']!=''){
|
|
|
$data_order=reset(explode(',',$_REQUEST['data_order']));
|
|
|
$data_order_type=end(explode(',',$_REQUEST['data_order']));
|
|
|
$this->assign('userarpu_order',$data_order);
|
|
|
$this->assign('userarpu_order_type',$data_order_type);
|
|
|
}
|
|
|
if($count > $row){
|
|
|
$page = new \Think\Page($count, $row);
|
|
|
$page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
|
|
|
$this->assign('_page', $page->show());
|
|
|
}
|
|
|
$data=my_sort($data,$data_order_type,(int)$data_order);
|
|
|
$size=$row;//每页显示的记录数
|
|
|
$pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数
|
|
|
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
|
|
|
$data = array_slice($data, ($arraypage-1)*$size, $size);
|
|
|
$length = count($data);
|
|
|
$data[$length] = array(
|
|
|
'game_name'=>'汇总',
|
|
|
'count'=>$total['sum_count'],
|
|
|
'rand'=>'---',
|
|
|
'today'=>$total['sum_today'],
|
|
|
'week'=>$total['sum_week'],
|
|
|
'mounth'=>$total['sum_mounth']
|
|
|
);
|
|
|
$xlsData = $data;
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}
|
|
|
|
|
|
private function resway_statistics_export($p=0){
|
|
|
$xlsName = $_REQUEST['xlsname']?$_REQUEST['xlsname']:"注册方式统计";
|
|
|
$xlsCell = array(
|
|
|
array('register_way', "注册方式"),
|
|
|
array('count', "累计注册"),
|
|
|
array('rand', "排行榜"),
|
|
|
array('today', "今日注册"),
|
|
|
array('week', "本周注册"),
|
|
|
array('mounth', "本月注册"),
|
|
|
);
|
|
|
$page = intval($p);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
$arraypage=$page;
|
|
|
$row = 10;
|
|
|
$user=M('User','tab_');$map['puid'] = 0;
|
|
|
if(isset($_REQUEST['timestart'])&&isset($_REQUEST['timeend'])){
|
|
|
$map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+24*60*60-1));
|
|
|
unset($_REQUEST['timestart']);unset($_REQUEST['timeend']);
|
|
|
}
|
|
|
if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){
|
|
|
$map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1));
|
|
|
unset($_REQUEST['start']);unset($_REQUEST['end']);
|
|
|
}
|
|
|
if(isset($_REQUEST['register_way'])&&$_REQUEST['register_way']!=''){
|
|
|
$map['register_way'] =$_REQUEST['register_way'];
|
|
|
unset($_REQUEST['register_way']);
|
|
|
}
|
|
|
$today=total(1);
|
|
|
$week=total(2);
|
|
|
$mounth=total(3);
|
|
|
$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,
|
|
|
count(IF(register_time '.$week.',1,null)) as week,
|
|
|
count(IF(register_time '.$mounth.',1,null)) as mounth')
|
|
|
->where($map)
|
|
|
->group('register_way')
|
|
|
->order('count desc')
|
|
|
->select();
|
|
|
$count=count($data);
|
|
|
foreach ($data as $key => $value) {
|
|
|
static $i=0;
|
|
|
$i++;
|
|
|
$data[$key]['rand']=$i;
|
|
|
}
|
|
|
$total=A('Platform')->data_total($data);
|
|
|
if($_REQUEST['data_order']!=''){
|
|
|
$data_order=reset(explode(',',$_REQUEST['data_order']));
|
|
|
$data_order_type=end(explode(',',$_REQUEST['data_order']));
|
|
|
$this->assign('userarpu_order',$data_order);
|
|
|
$this->assign('userarpu_order_type',$data_order_type);
|
|
|
}
|
|
|
if($count > $row){
|
|
|
$page = new \Think\Page($count, $row);
|
|
|
$page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
|
|
|
$this->assign('_page', $page->show());
|
|
|
}
|
|
|
$data=my_sort($data,$data_order_type,(int)$data_order);
|
|
|
$size=$row;//每页显示的记录数
|
|
|
$pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数
|
|
|
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
|
|
|
$data = array_slice($data, ($arraypage-1)*$size, $size);
|
|
|
foreach ($data as $key => $value) {
|
|
|
$data[$key]['register_way'] = get_register_way($data[$key]['register_way']);
|
|
|
}
|
|
|
$length = count($data);
|
|
|
$data[$length] = array(
|
|
|
'register_way'=>'汇总',
|
|
|
'count'=>$total['sum_count'],
|
|
|
'rand'=>'---',
|
|
|
'today'=>$total['sum_today'],
|
|
|
'week'=>$total['sum_week'],
|
|
|
'mounth'=>$total['sum_mounth']
|
|
|
);
|
|
|
$xlsData = $data;
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}
|
|
|
|
|
|
private function payway_statistics_export($p=0){
|
|
|
$page = intval($p);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
$arraypage=$page;
|
|
|
$row = 10;
|
|
|
$deposit = M('Deposit',"tab_");
|
|
|
$user=M('User','tab_');
|
|
|
$spend=M('Spend','tab_');
|
|
|
if(isset($_REQUEST['timestart'])&&isset($_REQUEST['timeend'])){
|
|
|
$map['pay_time'] =array('BETWEEN',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+24*60*60-1));
|
|
|
unset($_REQUEST['timestart']);unset($_REQUEST['timeend']);
|
|
|
}
|
|
|
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']);
|
|
|
}
|
|
|
if(isset($_REQUEST['pay_way'])&&$_REQUEST['pay_way']!=''){
|
|
|
$map['pay_way'] = array('in',$_REQUEST['pay_way']) ;
|
|
|
unset($_REQUEST['pay_way']);
|
|
|
}
|
|
|
$map['pay_status']=1;
|
|
|
$today=total(1);
|
|
|
$week=total(2);
|
|
|
$mounth=total(3);
|
|
|
$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,
|
|
|
sum(IF(pay_time '.$week.',pay_amount,0)) as week,
|
|
|
sum(IF(pay_time '.$mounth.',pay_amount,0)) as mounth')
|
|
|
->where($map)
|
|
|
->group('pay_way')
|
|
|
->order('count desc')
|
|
|
->select();
|
|
|
$count=count($data);
|
|
|
foreach ($data as $key => $value) {
|
|
|
static $i=0;
|
|
|
$i++;
|
|
|
$data[$key]['rand']=$i;
|
|
|
}
|
|
|
$total = A('Platform')->data_total($data);
|
|
|
$this->assign('total',$total);
|
|
|
if($_REQUEST['data_order']!=''){
|
|
|
$data_order=reset(explode(',',$_REQUEST['data_order']));
|
|
|
$data_order_type=end(explode(',',$_REQUEST['data_order']));
|
|
|
$this->assign('userarpu_order',$data_order);
|
|
|
$this->assign('userarpu_order_type',$data_order_type);
|
|
|
}
|
|
|
if($count > $row){
|
|
|
$page = new \Think\Page($count, $row);
|
|
|
$page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
|
|
|
$this->assign('_page', $page->show());
|
|
|
}
|
|
|
$data=my_sort($data,$data_order_type,(int)$data_order);
|
|
|
$size=$row;//每页显示的记录数
|
|
|
$pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数
|
|
|
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
|
|
|
$data = array_slice($data, ($arraypage-1)*$size, $size);
|
|
|
$xlsName = $_REQUEST['xlsname']?$_REQUEST['xlsname']:'充值方式统计';
|
|
|
$xlsCell = array(
|
|
|
array('pay_way', "充值方式"),
|
|
|
array('count' , "累计充值"),
|
|
|
array('rand' , "排行榜"),
|
|
|
array('today' , "今日充值"),
|
|
|
array('week' , "本周充值"),
|
|
|
array('mounth' , "本月充值"),
|
|
|
);
|
|
|
foreach ($data as $key => $value) {
|
|
|
$data[$key]['pay_way'] = get_pay_way($data[$key]['pay_way']);
|
|
|
}
|
|
|
$length = count($data);
|
|
|
$data[$length] = array(
|
|
|
'pay_way'=>'汇总',
|
|
|
'count'=>$total['sum_count'],
|
|
|
'rand'=>'---',
|
|
|
'today'=>$total['sum_today'],
|
|
|
'week'=>$total['sum_week'],
|
|
|
'mounth'=>$total['sum_mounth']
|
|
|
);
|
|
|
$xlsData = $data;
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 统计-推广员统计
|
|
|
*
|
|
|
* @param int $type 1 推广员充值统计,其他 推广员注册统计
|
|
|
* @param int $p
|
|
|
*
|
|
|
* @author: 鹿文学[lwx]<fyj301415926@126.com>
|
|
|
* @since: 2019\5\7 0007 10:48
|
|
|
*/
|
|
|
public function promote_statistics($type=0,$p=0) {
|
|
|
if($type == 1) {
|
|
|
$this->promotepay_statistics_export($p);
|
|
|
} else {
|
|
|
$this->promote_statistics_export($p);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private function promote_statistics_export($p=0){
|
|
|
$page = intval($p);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
$arraypage=$page;
|
|
|
$row = 10;
|
|
|
$user=M('User','tab_');
|
|
|
$map['promote_id']=array('egt',0);
|
|
|
if(isset($_REQUEST['timestart'])&&isset($_REQUEST['timeend'])){
|
|
|
$map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+24*60*60-1));
|
|
|
unset($_REQUEST['timestart']);unset($_REQUEST['timeend']);
|
|
|
}
|
|
|
if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){
|
|
|
$map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1));
|
|
|
unset($_REQUEST['start']);unset($_REQUEST['end']);
|
|
|
}
|
|
|
if(isset($_REQUEST['promote_id'])){
|
|
|
$map['_string'] = "promote_id = {$_REQUEST['promote_id']} or tab_promote.parent_id = {$_REQUEST['promote_id']} or tab_promote.grand_id = {$_REQUEST['promote_id']} ";
|
|
|
unset($_REQUEST['promote_id']);
|
|
|
}
|
|
|
$today=total(1);
|
|
|
$week=total(2);
|
|
|
$mounth=total(3);
|
|
|
$map['puid'] = 0;
|
|
|
$data=$user
|
|
|
->field('promote_account,promote_id,date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(tab_user.id) as count,
|
|
|
IF(tab_promote.grand_id>0,tab_promote.grand_id,IF(tab_promote.grand_id=0 and tab_promote.parent_id >0,tab_promote.parent_id,promote_id)) as promote_id1 ,
|
|
|
count(IF(register_time '.$today.',1,null)) as today,
|
|
|
count(IF(register_time '.$week.',1,null)) as week,
|
|
|
count(IF(register_time '.$mounth.',1,null)) as mounth')
|
|
|
->join('tab_promote on promote_id = tab_promote.id','left')
|
|
|
->where($map)
|
|
|
->group('promote_id1')
|
|
|
->having('promote_id != 0')
|
|
|
->order('count desc,register_time')
|
|
|
->select();
|
|
|
$count=count($data);
|
|
|
foreach ($data as $key => $value) {
|
|
|
static $i=0;
|
|
|
$i++;
|
|
|
$data[$key]['rand']=$i;
|
|
|
}
|
|
|
foreach ($data as $key => $value) {
|
|
|
if($data[$key]['promote_id']==0){
|
|
|
unset($data[$key]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$total=A('Platform')->data_total($data);
|
|
|
if($_REQUEST['data_order']!=''){
|
|
|
$data_order=reset(explode(',',$_REQUEST['data_order']));
|
|
|
$data_order_type=end(explode(',',$_REQUEST['data_order']));
|
|
|
$this->assign('userarpu_order',$data_order);
|
|
|
$this->assign('userarpu_order_type',$data_order_type);
|
|
|
}
|
|
|
if($count > $row){
|
|
|
$page = new \Think\Page($count, $row);
|
|
|
$page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
|
|
|
$this->assign('_page', $page->show());
|
|
|
}
|
|
|
$data=my_sort($data,$data_order_type,(int)$data_order);
|
|
|
$size=$row;//每页显示的记录数
|
|
|
$pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数
|
|
|
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
|
|
|
$data = array_slice($data, ($arraypage-1)*$size, $size);
|
|
|
$xlsName = $_REQUEST['xlsname']?$_REQUEST['xlsname']:'推广员注册统计';
|
|
|
$xlsCell = array(
|
|
|
array('promote_id', "推广员账号"),
|
|
|
array('count' , "累计注册"),
|
|
|
array('rand' , "排行榜"),
|
|
|
array('today' , "今日注册"),
|
|
|
array('week' , "本周注册"),
|
|
|
array('mounth' , "本月注册"),
|
|
|
);
|
|
|
foreach ($data as $key => $value) {
|
|
|
$data[$key]['promote_id'] = get_promote_account($data[$key]['promote_id']);
|
|
|
}
|
|
|
$length = count($data);
|
|
|
$data[$length] = array(
|
|
|
'promote_id'=>'汇总',
|
|
|
'count'=>$total['sum_count'],
|
|
|
'rand'=>'---',
|
|
|
'today'=>$total['sum_today'],
|
|
|
'week'=>$total['sum_week'],
|
|
|
'mounth'=>$total['sum_mounth']
|
|
|
);
|
|
|
$xlsData = $data;
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}
|
|
|
|
|
|
private function promotepay_statistics_export($p=0){
|
|
|
$page = intval($p);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
$arraypage=$page;
|
|
|
$row = 10;
|
|
|
$map['promote_id']=array('gt',0);
|
|
|
$spend=M('Spend','tab_');
|
|
|
if(isset($_REQUEST['timestart'])&&isset($_REQUEST['timeend'])){
|
|
|
$map['pay_time'] =array('BETWEEN',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+24*60*60-1));
|
|
|
unset($_REQUEST['timestart']);unset($_REQUEST['timeend']);
|
|
|
}
|
|
|
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']);
|
|
|
}
|
|
|
// if(isset($_REQUEST['promote_id'])){
|
|
|
// $map['promote_id'] =$_REQUEST['promote_id'];
|
|
|
// unset($_REQUEST['promote_id']);
|
|
|
// }
|
|
|
$map['pay_status']=1;
|
|
|
$today=total(1);
|
|
|
$week=total(2);
|
|
|
$mounth=total(3);
|
|
|
$map1['pay_way'] = $map['pay_way'] = array('gt',0);
|
|
|
$bindrecharge_data = M('bind_recharge','tab_')
|
|
|
->field('max(id) as id,promote_account,promote_id,create_time as ordertime,date_format(FROM_UNIXTIME(create_time),"%Y-%m-%d") AS time, sum(real_amount) as count,
|
|
|
sum(IF(create_time '.$today.',real_amount,0)) as today,
|
|
|
sum(IF(create_time '.$week.',real_amount,0)) as week,
|
|
|
sum(IF(create_time '.$mounth.',real_amount,0)) as mounth')
|
|
|
->where($map1)
|
|
|
->group('promote_id')
|
|
|
->select(false);
|
|
|
|
|
|
$deposit_data = M('deposit','tab_')
|
|
|
->field('max(id) as id,promote_account,promote_id,create_time as ordertime,date_format(FROM_UNIXTIME(create_time),"%Y-%m-%d") AS time, sum(pay_amount) as count,
|
|
|
sum(IF(create_time '.$today.',pay_amount,0)) as today,
|
|
|
sum(IF(create_time '.$week.',pay_amount,0)) as week,
|
|
|
sum(IF(create_time '.$mounth.',pay_amount,0)) as mounth')
|
|
|
->where($map1)
|
|
|
->group('promote_id')
|
|
|
->select(false);
|
|
|
if(isset($_REQUEST['game_name'])){
|
|
|
$map['game_name'] = $_REQUEST['game_name'];
|
|
|
if(isset($_REQUEST['server_id'])){
|
|
|
$map['server_name'] = $_REQUEST['server_id'];
|
|
|
unset($_REQUEST['server_id']);
|
|
|
}
|
|
|
$data=$spend
|
|
|
->field('max(id) as id,promote_account,promote_id,pay_time as ordertime,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time, sum(pay_amount) as count,
|
|
|
sum(IF(pay_time '.$today.',pay_amount,0)) as today,
|
|
|
sum(IF(pay_time '.$week.',pay_amount,0)) as week,
|
|
|
sum(IF(pay_time '.$mounth.',pay_amount,0)) as mounth')
|
|
|
->where($map)
|
|
|
->group('promote_id')
|
|
|
->select(false);
|
|
|
}else{
|
|
|
$data=$spend
|
|
|
->field('max(id) as id,promote_account,promote_id,pay_time as ordertime,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time, sum(pay_amount) as count,
|
|
|
sum(IF(pay_time '.$today.',pay_amount,0)) as today,
|
|
|
sum(IF(pay_time '.$week.',pay_amount,0)) as week,
|
|
|
sum(IF(pay_time '.$mounth.',pay_amount,0)) as mounth')
|
|
|
->where($map)
|
|
|
->union(' ('.$bindrecharge_data.') ')
|
|
|
->union(' ('.$deposit_data.') ')
|
|
|
->group('promote_id')
|
|
|
->select(false);
|
|
|
}
|
|
|
if(isset($_REQUEST['promote_id'])){
|
|
|
$condition['_string'] = "promote_id = {$_REQUEST['promote_id']} or tab_promote.parent_id = {$_REQUEST['promote_id']} or tab_promote.grand_id = {$_REQUEST['promote_id']} ";
|
|
|
unset($_REQUEST['promote_id']);
|
|
|
}
|
|
|
$data = $spend->field('a.promote_account,a.promote_id,a.time,sum(a.count) as count,sum(a.today) as today,sum(a.week) as week,sum(a.mounth) as mounth,IF(tab_promote.grand_id>0,tab_promote.grand_id,IF(tab_promote.grand_id=0 and tab_promote.parent_id >0,tab_promote.parent_id,promote_id)) as promote_id1')
|
|
|
->join('tab_promote on promote_id = tab_promote.id','left')
|
|
|
->where($condition)
|
|
|
->table('('.$data.') as a')->group('promote_id')->order('a.count desc,a.ordertime')->select();
|
|
|
$count=count($data);
|
|
|
foreach ($data as $key => $value) {
|
|
|
static $i=0;
|
|
|
$i++;
|
|
|
$data[$key]['rand']=$i;
|
|
|
if($data[$key]['promote_id']=='0'){
|
|
|
unset($data[$key]);
|
|
|
}
|
|
|
}
|
|
|
$total=A('Platform')->data_total($data);
|
|
|
if($_REQUEST['data_order']!=''){
|
|
|
$data_order=reset(explode(',',$_REQUEST['data_order']));
|
|
|
$data_order_type=end(explode(',',$_REQUEST['data_order']));
|
|
|
}
|
|
|
|
|
|
$data=my_sort($data,$data_order_type,(int)$data_order);
|
|
|
$size=$row;//每页显示的记录数
|
|
|
$pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数
|
|
|
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
|
|
|
$data = array_slice($data, ($arraypage-1)*$size, $size);
|
|
|
$xlsName = $_REQUEST['xlsname']?$_REQUEST['xlsname']:'推广员充值统计';
|
|
|
$xlsCell = array(
|
|
|
array('promote_id', "推广员账号"),
|
|
|
array('count' , "累计充值"),
|
|
|
array('rand' , "排行榜"),
|
|
|
array('today' , "今日充值"),
|
|
|
array('week' , "本周充值"),
|
|
|
array('mounth' , "本月充值"),
|
|
|
);
|
|
|
foreach ($data as $key => $value) {
|
|
|
$data[$key]['promote_id'] = get_promote_account($data[$key]['promote_id']);
|
|
|
}
|
|
|
$length = count($data);
|
|
|
$data[$length] = array(
|
|
|
'promote_id'=>'汇总',
|
|
|
'count'=>$total['sum_count'],
|
|
|
'rand'=>'---',
|
|
|
'today'=>$total['sum_today'],
|
|
|
'week'=>$total['sum_week'],
|
|
|
'mounth'=>$total['sum_mounth']
|
|
|
);
|
|
|
$xlsData = $data;
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}
|
|
|
|
|
|
public function userretention_export($p = 0)
|
|
|
{
|
|
|
$request=$_REQUEST;
|
|
|
$page = intval($p);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
$arraypage=$page;
|
|
|
$row = 10;
|
|
|
$start = I('start');
|
|
|
$end = empty(I('end')) ? time_format(time(),'Y-m-d') : I('end');
|
|
|
if(!empty($start)){
|
|
|
$game_id = I('game_id');
|
|
|
$promote_id = I('promote_id');
|
|
|
$map_list = array();
|
|
|
//统计每日注册数
|
|
|
$data = A('Stat')->count_register($start,$end,$game_id,$promote_id,$page);
|
|
|
|
|
|
$day = array(1,2,3,4,5,6,7,15,30,60);
|
|
|
foreach ($data as $k=>$v) {
|
|
|
//当日注册人账号
|
|
|
$map = $map_list;
|
|
|
$time = $v['time'];
|
|
|
$map["FROM_UNIXTIME(register_time,'%Y-%m-%d')"] = $time;
|
|
|
//每日留存
|
|
|
foreach ($day as $key => $value) {
|
|
|
$map = $map_list;
|
|
|
$map["FROM_UNIXTIME(register_time,'%Y-%m-%d')"] = $time;
|
|
|
$login_time = date('Y-m-d', strtotime("+{$value} day",strtotime($time)));
|
|
|
$num = M('user','tab_')
|
|
|
->field('count(DISTINCT tab_user.id) as num')
|
|
|
->join("right join tab_user_login_record as ur on ur.user_id = tab_user.id and FROM_UNIXTIME(ur.login_time,'%Y-%m-%d') = '{$login_time}'")
|
|
|
->where($map)
|
|
|
->group('user_id')
|
|
|
->find();
|
|
|
$data[$k][$value] = $num['num'];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//分页
|
|
|
$time_map['time'] = array('between',array($start,$end));
|
|
|
$count = M('date_list')->where($time_map)->count();
|
|
|
if($count > $row){
|
|
|
$page = new \Think\Page($count, $row);
|
|
|
$page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
|
|
|
$this->assign('_page', $page->show());
|
|
|
}
|
|
|
}else{
|
|
|
unset($_REQUEST['data_order']);
|
|
|
if(count(I('get.'))!=0){
|
|
|
$this->error('时间选择错误,请重新选择!');
|
|
|
}
|
|
|
}
|
|
|
if($request['data_order']!=''){
|
|
|
$data_order=reset(explode(',',$request['data_order']));
|
|
|
$data_order_type=end(explode(',',$request['data_order']));
|
|
|
}
|
|
|
$data=my_sort($data,$data_order_type,(int)$data_order,SORT_STRING);
|
|
|
$size=10;//每页显示的记录数
|
|
|
$pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数
|
|
|
$data = array_slice($data, ($arraypage-1)*$size, $size);
|
|
|
|
|
|
$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");
|
|
|
}
|
|
|
if(!empty($request['promote_id'])){
|
|
|
$key = empty($request['game_id'])?1:2;
|
|
|
array_splice($dataKey,$key,0,"promote_id");
|
|
|
}
|
|
|
|
|
|
foreach ($dataKey as $key => $value) {
|
|
|
switch ($value) {
|
|
|
case 'time':
|
|
|
$xlsCell[$key] = array('time', "日期");
|
|
|
break;
|
|
|
case 'game_id':
|
|
|
$xlsCell[$key] = array('game_id', "游戏名称");
|
|
|
break;
|
|
|
case 'promote_id':
|
|
|
$xlsCell[$key] = array('promote_id', "推广员账号");
|
|
|
break;
|
|
|
case 'register_num':
|
|
|
$xlsCell[$key] = array('register_num', '新增玩家', 'time_format', '*');
|
|
|
break;
|
|
|
case '1':
|
|
|
$xlsCell[$key] = array('1', '1日留存', 'time_format', '*');
|
|
|
break;
|
|
|
case '2':
|
|
|
$xlsCell[$key] = array('2', '2日留存');
|
|
|
break;
|
|
|
case '3':
|
|
|
$xlsCell[$key] = array('3', "3日留存");
|
|
|
break;
|
|
|
case '4':
|
|
|
$xlsCell[$key] = array('4', '4日留存');
|
|
|
break;
|
|
|
case '5':
|
|
|
$xlsCell[$key] = array('5', '5日留存');
|
|
|
break;
|
|
|
case '6':
|
|
|
$xlsCell[$key] = array('6', '6日留存');
|
|
|
break;
|
|
|
case '7':
|
|
|
$xlsCell[$key] = array('7', '7日留存');
|
|
|
break;
|
|
|
case '15':
|
|
|
$xlsCell[$key] = array('15', '15日留存');
|
|
|
break;
|
|
|
case '30':
|
|
|
$xlsCell[$key] = array('30', '30日留存');
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
$data[$key]['game_id'] = get_game_name($request['game_id']);
|
|
|
$data[$key]['promote_id'] = get_promote_account($request['promote_id']);
|
|
|
$data[$key]['1'] = (round($data[$key]['1']/$data[$key]['register_num'],4)*100).'%';
|
|
|
$data[$key]['2'] = (round($data[$key]['2']/$data[$key]['register_num'],4)*100).'%';
|
|
|
$data[$key]['3'] = (round($data[$key]['3']/$data[$key]['register_num'],4)*100).'%';
|
|
|
$data[$key]['4'] = (round($data[$key]['4']/$data[$key]['register_num'],4)*100).'%';
|
|
|
$data[$key]['5'] = (round($data[$key]['5']/$data[$key]['register_num'],4)*100).'%';
|
|
|
$data[$key]['6'] = (round($data[$key]['6']/$data[$key]['register_num'],4)*100).'%';
|
|
|
$data[$key]['7'] = (round($data[$key]['7']/$data[$key]['register_num'],4)*100).'%';
|
|
|
$data[$key]['15'] = (round($data[$key]['15']/$data[$key]['register_num'],4)*100).'%';
|
|
|
$data[$key]['30'] = (round($data[$key]['30']/$data[$key]['register_num'],4)*100).'%';
|
|
|
}
|
|
|
$xlsData = $data;
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}
|
|
|
|
|
|
public function summaryQueryExport($p=1){
|
|
|
$xlsCell = array(
|
|
|
array('cycle', "查询时间"),
|
|
|
array('ba_account' , "商务专员账号"),
|
|
|
array('pro_count' , "旗下推广员数"),
|
|
|
array('pro_reg_count' , "总注册(个)"),
|
|
|
array('pro_reg_sum' , "总充值(元)"),
|
|
|
);
|
|
|
$xlsName = $_REQUEST['xlsname']?$_REQUEST['xlsname']:'汇总查询';
|
|
|
$page = intval($p);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据arraypage
|
|
|
$arraypage = $page ? $page : 1; //默认显示第一页数据
|
|
|
$size = 10;
|
|
|
|
|
|
if (isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])) {
|
|
|
if (isset($_GET['ba_id'])) {
|
|
|
$map['id'] = $_GET['ba_id'];
|
|
|
}
|
|
|
$ba = M('business_affairs', 'tab_')->field('id,account,promote_id')->where($map)->select();
|
|
|
|
|
|
foreach ($ba as $key => $value) {
|
|
|
$lists[$key]['ba_account'] = $value['account'];
|
|
|
$pro_map['ba_id'] = $value['id'];
|
|
|
$pro_count = M('promote', 'tab_')->field('id')->where($pro_map)->count();
|
|
|
$lists[$key]['pro_count'] = $pro_count;
|
|
|
$pro_reg_map['promote_id'] = ['in', $value['promote_id']];
|
|
|
$pro_reg_map_time['register_time'] = array('BETWEEN', array(strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 24 * 60 * 60 - 1));
|
|
|
$pro_reg_map_paytime['pay_time'] = array('BETWEEN', array(strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 24 * 60 * 60 - 1));
|
|
|
$pro_reg = M('user', 'tab_')->field('id')->where($pro_reg_map)->where($pro_reg_map_time)->count();
|
|
|
$lists[$key]['pro_reg_count'] = $pro_reg;
|
|
|
$pro_reg_map['pay_status'] = 1;
|
|
|
$pro_spend = M('spend', 'tab_')->where($pro_reg_map)->where($pro_reg_map_paytime)->sum('pay_amount');
|
|
|
$lists[$key]['pro_reg_sum'] = empty($pro_spend) ? 0 : $pro_spend;
|
|
|
}
|
|
|
|
|
|
$count = count($lists);
|
|
|
$lists = array_slice($lists, ($arraypage - 1) * $size, $size);
|
|
|
|
|
|
foreach ($lists as $key => $value) {
|
|
|
$lists[$key]["cycle"] = $_REQUEST['timestart']."到".$_REQUEST['timeend'];
|
|
|
}
|
|
|
$xlsData = $lists;
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}else{
|
|
|
$xlsCell = array(
|
|
|
array('cycle', "查询时间"),
|
|
|
array('ba_account' , "商务专员账号"),
|
|
|
array('pro_count' , "旗下推广员数"),
|
|
|
array('pro_reg_count' , "总注册(个)"),
|
|
|
array('pro_reg_sum' , "总充值(元)"),
|
|
|
);
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, "");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public function BindRechargeRecordExport($p=1){
|
|
|
$model = new \Admin\Model\BindRechargeModel();
|
|
|
empty(I('game_id')) || $map['game_id'] = I('game_id');
|
|
|
empty(I("pay_way")) || $map['pay_way'] = I("pay_way");
|
|
|
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]];
|
|
|
$data = $model->getLists($map,"create_time desc",$p);
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('pay_order_number', "订单号"),
|
|
|
array('user_account' , "玩家账号"),
|
|
|
array('promote_account' , "所属推广员"),
|
|
|
array('game_name' , "游戏名称"),
|
|
|
array('amount' , "充值绑币"),
|
|
|
array('real_amount' , "实付金额"),
|
|
|
array('pay_way' , "充值方式"),
|
|
|
array('recharge_ip' , "充值IP"),
|
|
|
array('create_time' , "充值时间"),
|
|
|
array('pay_status' , "订单状态"),
|
|
|
);
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
$data = $data['data'];
|
|
|
foreach ($data as $key => $value) {
|
|
|
$data[$key]['pay_way'] = get_pay_way($value['pay_way']);
|
|
|
$data[$key]['create_time'] = date('Y-m-d H:i:s',$value['create_time']);
|
|
|
$data[$key]['pay_status'] = get_info_status($value['pay_status'],9);
|
|
|
}
|
|
|
$xlsData = $data;
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 用户分析
|
|
|
* @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 = '全部';
|
|
|
}
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('time','日期'),
|
|
|
array('source','来源游戏'),
|
|
|
array('promote','推广员'),
|
|
|
array('news','新增用户'),
|
|
|
array('old','老用户'),
|
|
|
array('dau','DAU'),
|
|
|
array('wau','WAU'),
|
|
|
array('mau','MAU'),
|
|
|
);
|
|
|
|
|
|
if (is_file(dirname(__FILE__).'/access_data_user.txt')) {
|
|
|
|
|
|
$filetxt = file_get_contents(dirname(__FILE__).'/access_data_user.txt');
|
|
|
|
|
|
$data = json_decode($filetxt,true);
|
|
|
|
|
|
} else {
|
|
|
$page = intval($p);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}//10;
|
|
|
|
|
|
$start = I('start',date('Y-m-d',strtotime('-7 day')));
|
|
|
|
|
|
$end = I('end',date('Y-m-d',strtotime('-1 day')));
|
|
|
|
|
|
$end = strtotime($end)>=strtotime(date('Y-m-d'))?date('Y-m-d',strtotime('-1 day')):$end;
|
|
|
|
|
|
$data = D('user')->user(strtotime($start),strtotime($end),$promote_id,$game_id);
|
|
|
|
|
|
$count = count($list);
|
|
|
|
|
|
$data = array_slice($list,($page-1)*$row,$row,true);
|
|
|
|
|
|
}
|
|
|
|
|
|
foreach ($data as $v) {
|
|
|
$v['source'] = $gamesource;
|
|
|
$v['promote'] = $promoteaccount;
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
}
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* ltv统计
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function ltv($p=1) {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
$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'),
|
|
|
);
|
|
|
|
|
|
if (is_file(dirname(__FILE__).'/access_data_ltv.txt')) {
|
|
|
|
|
|
$filetxt = file_get_contents(dirname(__FILE__).'/access_data_ltv.txt');
|
|
|
|
|
|
$data = json_decode($filetxt,true);
|
|
|
|
|
|
} else {
|
|
|
$page = intval($p);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}//10;
|
|
|
|
|
|
$start = I('start',date('Y-m-d',strtotime('-30 day')));
|
|
|
|
|
|
$end = I('end',date('Y-m-d',strtotime('-1 day')));
|
|
|
|
|
|
$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);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 统计总揽数据
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function overview() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'].'_'.$_REQUEST['name'];
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('time','日期'),
|
|
|
array('count',$_REQUEST['name']),
|
|
|
);
|
|
|
|
|
|
$num = I('num',2);
|
|
|
$key = $_REQUEST['key'];
|
|
|
|
|
|
if (is_file(dirname(__FILE__).'/access_data_foldline.txt')) {
|
|
|
|
|
|
$filetxt = file_get_contents(dirname(__FILE__).'/access_data_foldline.txt');
|
|
|
|
|
|
$data = json_decode($filetxt,true);
|
|
|
|
|
|
$xlsData = $data[$key];
|
|
|
$xlsSummary[] = $data['sum'][$key];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$start = I('start',date('Y-m-d',strtotime('-1 day')));
|
|
|
|
|
|
$end = I('end',date('Y-m-d',strtotime('-1 day')));
|
|
|
|
|
|
$starttime = strtotime($start);
|
|
|
$endtime = strtotime($end)+86399;
|
|
|
|
|
|
$user = D('User');
|
|
|
$spend = D('Spend');
|
|
|
|
|
|
$flag = 1;
|
|
|
|
|
|
if ($start == $end) {
|
|
|
|
|
|
$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'];
|
|
|
|
|
|
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;}
|
|
|
}
|
|
|
|
|
|
// 新增用户
|
|
|
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];
|
|
|
}
|
|
|
|
|
|
|
|
|
$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(!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('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('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();
|
|
|
|
|
|
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);
|
|
|
}
|
|
|
|
|
|
$xlsData = $data;
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 用户金币提现记录列表
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function user_withdraw() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
$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','提现状态'),
|
|
|
);
|
|
|
|
|
|
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'];}
|
|
|
|
|
|
$wgc = M('WithdrawGoldCoin','tab_');
|
|
|
|
|
|
$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);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 应用概况
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function device_survey() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'].'_'.$_REQUEST['name'];
|
|
|
|
|
|
$num = I('num',2);
|
|
|
$key = $_REQUEST['key'];
|
|
|
|
|
|
if($key=='model') {
|
|
|
$xlsCell = array(
|
|
|
array('model',$_REQUEST['name']),
|
|
|
array('version','系统版本'),
|
|
|
array('count','数量'),
|
|
|
);
|
|
|
} else {
|
|
|
$xlsCell = array(
|
|
|
array('time','日期'),
|
|
|
array('version','系统版本'),
|
|
|
array('count',$_REQUEST['name']),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
if (is_file(dirname(__FILE__).'/device_data_foldline.txt')) {
|
|
|
|
|
|
$filetxt = file_get_contents(dirname(__FILE__).'/device_data_foldline.txt');
|
|
|
|
|
|
$data = json_decode($filetxt,true);
|
|
|
|
|
|
$xlsData = $data[$key];
|
|
|
|
|
|
$xlsSummary[] = $data['sum'][$key];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$start = I('start',date('Y-m-d',strtotime('-1 day')));
|
|
|
|
|
|
$end = I('end',date('Y-m-d',strtotime('-1 day')));
|
|
|
|
|
|
$starttime = strtotime($start);
|
|
|
$endtime = strtotime($end)+86399;
|
|
|
|
|
|
$device = D('DeviceRecord');
|
|
|
|
|
|
$flag = 1;
|
|
|
|
|
|
if ($start == $end) {
|
|
|
|
|
|
$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'];
|
|
|
|
|
|
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;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 新增设备
|
|
|
if ($key == 'news'){
|
|
|
$hoursnews = $device->news_on_time(['create_time'=>['between',[$starttime,$endtime]]],'news',5,'time,version');
|
|
|
|
|
|
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'];
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$datelist = get_date_list($starttime,$endtime,$num==7?2:1);
|
|
|
|
|
|
$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;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
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]]]);
|
|
|
|
|
|
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;
|
|
|
}
|
|
|
|
|
|
$xlsData = $export[$key];
|
|
|
$xlsSummary[] = $export['sum'][$key];
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 投放平台
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function platform() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
$map['status'] = 1;
|
|
|
|
|
|
if($_REQUEST['group']==1) {
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('id','编号'),
|
|
|
array('name','名称'),
|
|
|
array('promote_account','渠道'),
|
|
|
array('create_time','创建时间'),
|
|
|
array('update_time','最后更新时间'),
|
|
|
);
|
|
|
|
|
|
$map['mark'] = 1;
|
|
|
} else {
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('id','编号'),
|
|
|
array('name','名称'),
|
|
|
array('create_time','创建时间'),
|
|
|
array('update_time','最后更新时间'),
|
|
|
);
|
|
|
|
|
|
$map['mark'] = 0;
|
|
|
}
|
|
|
|
|
|
if(!empty($_REQUEST['name'])) {$map['name']=array('like','%'.$_REQUEST['name'].'%');}
|
|
|
if(!empty($_REQUEST['promote_id'])) {$map['promote_id']=$_REQUEST['promote_id'];}
|
|
|
|
|
|
|
|
|
$platform = D('LaunchPlatform');
|
|
|
|
|
|
$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']);
|
|
|
}
|
|
|
|
|
|
$xlsData = $data;
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 投放数据统计
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function launch_data($p=1) {
|
|
|
|
|
|
$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'),
|
|
|
);
|
|
|
|
|
|
if (is_file(dirname(__FILE__).'/access_data_launch.txt')) {
|
|
|
|
|
|
$filetxt = file_get_contents(dirname(__FILE__).'/access_data_launch.txt');
|
|
|
|
|
|
$data = json_decode($filetxt,true);
|
|
|
|
|
|
} 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'));
|
|
|
|
|
|
|
|
|
$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');
|
|
|
|
|
|
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);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$data = $launchrecord->data($p,$map,array('duration'=>['between',[$start,$end+86399]]));
|
|
|
|
|
|
}
|
|
|
}
|
|
|
} elseif(!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {
|
|
|
$start = strtotime($_REQUEST['timestart']);
|
|
|
|
|
|
$data = $launchrecord->lists($p,$map,$start,$currentdate+86399);
|
|
|
|
|
|
} elseif(empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
|
|
|
$end = strtotime($_REQUEST['timeend']);
|
|
|
if($end>=$currentdate) {
|
|
|
|
|
|
$data = $launchrecord->lists($p,$map,'',$currentdate+86399);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$data = $launchrecord->data($p,$map,array('duration'=>['lt',$end+86399]));
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
|
|
|
$data = $launchrecord->data($p,$map,array('duration'=>['lt',$currentdate]));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$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'];}
|
|
|
|
|
|
$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'],'--');
|
|
|
}
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
}
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 登录记录
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function login_record() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('user_account','玩家账号'),
|
|
|
array('game_name','游戏名称'),
|
|
|
array('server_name','游戏区服'),
|
|
|
array('user_nickname','角色名'),
|
|
|
array('login_time','登录时间'),
|
|
|
array('login_ip','最后登录ip'),
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
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['login_time'] = array('BETWEEN', array(strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 24 * 60 * 60 - 1));
|
|
|
}elseif(isset($_REQUEST['timestart'])){
|
|
|
$map['login_time'] = array('GT',strtotime($_REQUEST['timestart']));
|
|
|
}elseif(isset($_REQUEST['timeend'])){
|
|
|
$map['login_time'] = array('lt',(strtotime($_REQUEST['timeend'])+ 24 * 60 * 60 - 1));
|
|
|
}
|
|
|
if (isset($_REQUEST['account'])) {
|
|
|
$map['user_account'] = array('like', '%' . trim($_REQUEST['account']) . '%');
|
|
|
}
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
$data = M('UserLoginRecord','tab_')
|
|
|
->where($map)->order('id desc')->select();
|
|
|
|
|
|
$xlsData = [];
|
|
|
|
|
|
foreach($data as $k => $v) {
|
|
|
|
|
|
$v['login_time'] = date('Y-m-d H:i:s',$v['login_time']);
|
|
|
$v['server_name'] = empty($v['server_name'])?'空':$v['server_name'];
|
|
|
|
|
|
$gamename=trim(get_game_name($v['game_id'],'id'));
|
|
|
|
|
|
$v['game_name'] = empty($gamename)?($v['type']==2?'APP登录':'平台登录'):$gamename;
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 账户修改记录
|
|
|
* @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 = [];
|
|
|
|
|
|
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['type']=trim(get_info_status($v['type'],17));
|
|
|
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 管理员列表
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function manager_list() {
|
|
|
|
|
|
$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'];
|
|
|
}
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
$data=M('Member')
|
|
|
->where($map)
|
|
|
->order('uid desc')
|
|
|
->select();
|
|
|
|
|
|
$xlsData = [];
|
|
|
|
|
|
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['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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 系统检查
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function check_lists() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('id','序号'),
|
|
|
array('info','异常简介'),
|
|
|
array('url','异常简介'),
|
|
|
array('type','异常类型'),
|
|
|
array('create_time','异常时间'),
|
|
|
array('status','异常状态'),
|
|
|
);
|
|
|
|
|
|
|
|
|
if(!empty($_REQUEST['start']) && !empty($_REQUEST['end'])){
|
|
|
|
|
|
$map['create_time'] = array('BETWEEN',array(strtotime(I('start')),strtotime(I('end'))+24*60*60-1));
|
|
|
|
|
|
}elseif(!empty($_REQUEST['start'])){
|
|
|
|
|
|
$map['create_time'] =array('egt',strtotime(I('start')));
|
|
|
|
|
|
}elseif(!empty($_REQUEST['end'])){
|
|
|
|
|
|
$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(is_numeric($_REQUEST['t']) && $_REQUEST['t']>0 && $_REQUEST['t']<5) { $map['type'] = array('like',$_REQUEST['t'].'%'); }
|
|
|
|
|
|
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
$data=M('Check','tab_')
|
|
|
->where($map)
|
|
|
->order('id desc')
|
|
|
->select();
|
|
|
|
|
|
$xlsData = [];
|
|
|
|
|
|
foreach($data as $k => $v) {
|
|
|
|
|
|
$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['url']=!empty(trim($v['url']))?($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].trim($v['url'])):'';
|
|
|
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 商务专员列表
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function business_affairs_list() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
$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']);
|
|
|
}
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
$data=M('business_affairs','tab_')
|
|
|
->where($map)
|
|
|
->order('id desc')
|
|
|
->select();
|
|
|
|
|
|
$xlsData = [];
|
|
|
|
|
|
foreach($data as $k => $v) {
|
|
|
|
|
|
$v['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
|
|
|
|
|
|
|
|
|
$v['status']=trim(get_info_status($v['status'],30));
|
|
|
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 平台币发放
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function promote_coin_send_list() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
$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'];
|
|
|
|
|
|
}
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
$promotecoin = M('PromoteCoin','tab_');
|
|
|
|
|
|
$data=$promotecoin
|
|
|
->where($map)
|
|
|
->order('id desc')
|
|
|
->select();
|
|
|
|
|
|
$xlsData = [];
|
|
|
|
|
|
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']));
|
|
|
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 平台币收回
|
|
|
* @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;
|
|
|
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').'%') ;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
$data=$model
|
|
|
->where($map)
|
|
|
->order('id desc')
|
|
|
->select();
|
|
|
|
|
|
$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));
|
|
|
|
|
|
|
|
|
$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'] = '平台币';
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 绑币收回
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function deduct_bind_list() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('user_account','玩家账号'),
|
|
|
array('game_name','游戏名称'),
|
|
|
array('coin_type','收回类型'),
|
|
|
array('quantity','收回数量'),
|
|
|
array('create_time','收回时间'),
|
|
|
array('execute_account','收回人员'),
|
|
|
);
|
|
|
|
|
|
$model = M('DeductBindRecord','tab_');
|
|
|
|
|
|
if(isset($_GET['account'])){
|
|
|
$map['user_account']= array('like','%'.I('account').'%') ;
|
|
|
|
|
|
}
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
|
|
|
$data=$model
|
|
|
->where($map)
|
|
|
->order('id desc')
|
|
|
->select();
|
|
|
|
|
|
$xlsData = [];
|
|
|
|
|
|
if(is_array($data)){
|
|
|
|
|
|
foreach($data as $k => $v) {
|
|
|
$v['create_time'] = date('Y-m-d H:i',$v['create_time']);
|
|
|
|
|
|
$v['coin_type'] = '绑定平台币';
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 返利设置
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function rebate_set_list() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('promote_account','返利对象'),
|
|
|
array('game_name','游戏名称'),
|
|
|
array('status','金额限制状态'),
|
|
|
array('money','金额限制'),
|
|
|
array('ratio','返利比例'),
|
|
|
array('time','返利周期'),
|
|
|
array('create_time','添加时间'),
|
|
|
);
|
|
|
|
|
|
$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'];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
|
|
|
$data=$model
|
|
|
->where($map)
|
|
|
->order('id desc')
|
|
|
->select();
|
|
|
|
|
|
$xlsData = [];
|
|
|
|
|
|
if(is_array($data)){
|
|
|
|
|
|
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['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');
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 折扣设置
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function promote_welfare_list() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$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($_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','续充状态'),
|
|
|
);
|
|
|
|
|
|
|
|
|
$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','折扣状态'),
|
|
|
);
|
|
|
|
|
|
|
|
|
$map['status'] = 1;
|
|
|
if(isset($_REQUEST['recharge_status']) ){
|
|
|
$map['recharge_status'] = $_REQUEST['recharge_status'];
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
|
|
|
$data=$model
|
|
|
->where($map)
|
|
|
->order('id desc')
|
|
|
->select();
|
|
|
|
|
|
$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']);
|
|
|
|
|
|
$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;
|
|
|
|
|
|
}
|
|
|
} 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['promote_account'] = get_promote_name($v['promote_id']);
|
|
|
$v['op_account'] = get_admin_name($v['op_id']);
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 游戏列表
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function game_list() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$model = M('game','tab_');
|
|
|
|
|
|
if(isset($_REQUEST['game_name'])){
|
|
|
$map['game_name'] = $_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) {
|
|
|
|
|
|
$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);
|
|
|
|
|
|
} 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','关联游戏编号'), */
|
|
|
);
|
|
|
|
|
|
|
|
|
$map['developers'] = array('EQ',0);
|
|
|
|
|
|
}
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
|
|
|
$data=$model
|
|
|
->where($map)
|
|
|
->order('sort desc, id desc')
|
|
|
->select();
|
|
|
|
|
|
$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']='--';
|
|
|
}
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
foreach($data as $k => $v) {
|
|
|
|
|
|
$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['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;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 游戏类型
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function game_type_list() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
|
|
|
if($_REQUEST['type']==2) {
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('open_name','类型名称'),
|
|
|
array('status','显示状态'),
|
|
|
array('op_nickname','添加人员'),
|
|
|
array('create_time','添加时间'),
|
|
|
);
|
|
|
|
|
|
$model = M('Opentype','tab_');
|
|
|
|
|
|
if(isset($_REQUEST['status_show'])){
|
|
|
if($_REQUEST['status_show']!='all'){
|
|
|
$map['status'] = $_REQUEST['status_show'];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('type_name','游戏类型'),
|
|
|
array('status_show','显示状态'),
|
|
|
array('op_nickname','添加人员'),
|
|
|
array('create_time','添加时间'),
|
|
|
);
|
|
|
|
|
|
$model = M('GameType','tab_');
|
|
|
|
|
|
if(isset($_REQUEST['status_show'])){
|
|
|
if($_REQUEST['status_show']!='all'){
|
|
|
$map['status_show'] = $_REQUEST['status_show'];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
|
|
|
$data=$model
|
|
|
->where($map)
|
|
|
->order('id desc')
|
|
|
->select();
|
|
|
|
|
|
$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['status'] = '已' . get_info_status($v['status']);
|
|
|
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
foreach($data as $k => $v) {
|
|
|
|
|
|
$v['create_time'] = date('Y-m-d H:i',$v['create_time']);
|
|
|
|
|
|
$v['status_show'] = '已' . get_info_status($v['status_show']);
|
|
|
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 游戏原包
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function game_source_list() {
|
|
|
|
|
|
$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'];
|
|
|
}
|
|
|
|
|
|
$model = M('GameSource','tab_');
|
|
|
|
|
|
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','上传时间'),
|
|
|
);
|
|
|
|
|
|
|
|
|
$map['develop_id'] = array('NEQ',0);
|
|
|
|
|
|
} 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','操作时间'),
|
|
|
);
|
|
|
|
|
|
$map['develop_id'] = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
|
|
|
$data=$model
|
|
|
->where($map)
|
|
|
->order('id desc')
|
|
|
->select();
|
|
|
|
|
|
$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']);
|
|
|
|
|
|
$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;
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
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']);
|
|
|
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 自建官网
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function selfbuilt_list() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$model = M('Selfbuilt');
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('id','编号'),
|
|
|
array('game_name','游戏名称'),
|
|
|
array('webname','官网名称'),
|
|
|
array('template','模板名称'),
|
|
|
array('weburl','域名'),
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
|
|
|
$data=$model
|
|
|
->order('id desc')
|
|
|
->select();
|
|
|
|
|
|
$xlsData = [];
|
|
|
|
|
|
if(is_array($data)){
|
|
|
|
|
|
foreach($data as $k => $v) {
|
|
|
|
|
|
$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']);
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 区服列表
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function server_list() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
if(isset($_REQUEST['show_status'])){
|
|
|
$map['show_status']=$_REQUEST['show_status'];
|
|
|
}
|
|
|
if(isset($_REQUEST['server_version'])){
|
|
|
$map['server_version']=$_REQUEST['server_version'];
|
|
|
}
|
|
|
if(isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])){
|
|
|
$map['start_time'] = array('BETWEEN',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+24*60*60-1));
|
|
|
}elseif(isset($_REQUEST['timestart'])){
|
|
|
$map['start_time']=array('EGT',strtotime($_REQUEST['timestart']));
|
|
|
}elseif(isset($_REQUEST['timeend'])){
|
|
|
$map['start_time']=array('ELT',strtotime($_REQUEST['timeend']));
|
|
|
}
|
|
|
|
|
|
if(isset($_REQUEST['game_name'])){
|
|
|
if($_REQUEST['game_name']=='全部'){
|
|
|
}else{
|
|
|
$map['game_name']=$_REQUEST['game_name'];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$model = M('Server','tab_');
|
|
|
|
|
|
if($_REQUEST['type']==2) {
|
|
|
|
|
|
$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);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('game_name','游戏名称'),
|
|
|
array('server_name','区服名称'),
|
|
|
array('server_version','运营平台'),
|
|
|
array('show_status','显示状态'),
|
|
|
array('start_time','开服时间'),
|
|
|
);
|
|
|
|
|
|
$map['developers'] = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
|
|
|
$data=$model
|
|
|
->where($map)
|
|
|
->order('id desc')
|
|
|
->select();
|
|
|
|
|
|
$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']);
|
|
|
|
|
|
$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;
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
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['server_version'] = get_systems_name($v['server_version']);
|
|
|
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 礼包列表
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function giftbag_list() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
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']));
|
|
|
}elseif(isset($_REQUEST['timeend'])){
|
|
|
$map['create_time']=array('elt',strtotime($_REQUEST['timeend'])+24*60*60-1);
|
|
|
}
|
|
|
if(isset($_REQUEST['game_name'])){
|
|
|
if($_REQUEST['game_name']=='全部'){
|
|
|
}else{
|
|
|
$map['game_name']=$_REQUEST['game_name'];
|
|
|
}
|
|
|
}
|
|
|
if(isset($_REQUEST['giftbag_name'])){
|
|
|
$map['giftbag_name']=array('like','%'.$_REQUEST['giftbag_name'].'%');
|
|
|
}
|
|
|
if(isset($_REQUEST['status'])){
|
|
|
if($_REQUEST['status']=='全部'){
|
|
|
}else{
|
|
|
$map['status']=$_REQUEST['status'];
|
|
|
}
|
|
|
}
|
|
|
if(isset($_REQUEST['giftbag_version'])){
|
|
|
if($_REQUEST['giftbag_version']=='全部'){
|
|
|
}else{
|
|
|
$map['giftbag_version']=$_REQUEST['giftbag_version'];
|
|
|
}
|
|
|
}
|
|
|
if(isset($_REQUEST['developers'])){
|
|
|
$map['developers']=$_REQUEST['developers'];
|
|
|
}
|
|
|
|
|
|
|
|
|
$model = M('Giftbag','tab_');
|
|
|
|
|
|
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','有效时间'),
|
|
|
);
|
|
|
|
|
|
|
|
|
$map['developers'] = array('NEQ',0);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
|
|
|
$data=$model
|
|
|
->where($map)
|
|
|
->order('create_time desc')
|
|
|
->select();
|
|
|
|
|
|
$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']);
|
|
|
|
|
|
$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']);
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
foreach($data as $k => $v) {
|
|
|
|
|
|
$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']);
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 推广员列表
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function promote_list() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
if($_REQUEST['type']==2) {
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('id','编号'),
|
|
|
array('promote_account','推广员账号'),
|
|
|
array('url_type','站点来源'),
|
|
|
array('site_url','站点链接'),
|
|
|
array('status','审核状态'),
|
|
|
array('create_time','创建时间'),
|
|
|
);
|
|
|
|
|
|
$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','状态'),
|
|
|
);
|
|
|
|
|
|
$model = M('Promote','tab_');
|
|
|
|
|
|
if(isset($_REQUEST['promote_id'])){
|
|
|
$map['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['id']=array('in',$zid);
|
|
|
}
|
|
|
if(I('promote_level') == 1){
|
|
|
$map['parent_id'] = 0;
|
|
|
}elseif(I('promote_level') == 2){
|
|
|
$map['parent_id'] = ['neq',0];
|
|
|
$map['grand_id'] = 0;
|
|
|
}elseif (I('promote_level') == 3) {
|
|
|
$map['parent_id'] = ['neq',0];
|
|
|
$map['grand_id'] = ['neq',0];
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
|
|
|
$data=$model
|
|
|
->where($map)
|
|
|
->order('create_time desc')
|
|
|
->select();
|
|
|
|
|
|
$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['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;
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
foreach($data as $k => $v) {
|
|
|
|
|
|
$v['create_time'] = date('Y-m-d H:i',$v['create_time']);
|
|
|
$v['last_login_time'] = date('Y-m-d H:i',$v['last_login_time']);
|
|
|
|
|
|
$v['status'] = get_info_status($v['status'],3);
|
|
|
$v['business_affairs'] = get_business_affairs_account($v['ba_id']);
|
|
|
$v['grand_account'] = get_top_promote($v['id'],$v['grand_id']?$v['grand_id']:$v['parent_id']);
|
|
|
$v['promote_levels'] = get_promote_levels($v['id']);
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$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']);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$model = M('Apply','tab_');
|
|
|
|
|
|
$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','注册单价'),
|
|
|
);
|
|
|
|
|
|
if($_REQUEST['type']==2) {
|
|
|
|
|
|
$map['tab_apply.sdk_version']= 2;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$map['tab_apply.sdk_version']= 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
$type = $_REQUEST['type'] || 1;
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$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();
|
|
|
|
|
|
$xlsData = [];
|
|
|
|
|
|
if(is_array($data)){
|
|
|
$launchmodel = M('apply_launch','tab_');
|
|
|
|
|
|
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['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;
|
|
|
|
|
|
$money = is_null($v['promote_money'])?$v['game_money']:$v['promote_money'];
|
|
|
$money || $money = 0;
|
|
|
|
|
|
$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?'已开启':'已关闭');
|
|
|
}
|
|
|
|
|
|
$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'] = $launchmodel->where(['apply_id'=>$v['id']])->count();
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 游戏盒子分包列表
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function app_subpackage_list() {
|
|
|
|
|
|
$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');
|
|
|
|
|
|
|
|
|
$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','审核时间'),
|
|
|
);
|
|
|
|
|
|
if($_REQUEST['type']==2) {
|
|
|
|
|
|
$map['app_version'] = 2;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$map['app_version'] = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
$type = $_REQUEST['type'] || 1;
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
|
|
|
$data=$model
|
|
|
->where($map)
|
|
|
->order('apply_time desc')
|
|
|
->select();
|
|
|
|
|
|
$xlsData = [];
|
|
|
|
|
|
if(is_array($data)){
|
|
|
$launchmodel = M('apply_launch','tab_');
|
|
|
|
|
|
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['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?'打包失败':'未打包')));
|
|
|
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 推广补链
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function mend_list() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$model = M('user','tab_');
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('account','玩家账号'),
|
|
|
array('register_time','注册时间'),
|
|
|
array('login_time','最后登录时间'),
|
|
|
array('register_type','注册来源'),
|
|
|
array('register_ip','注册IP'),
|
|
|
array('login_time','上次登录'),
|
|
|
array('top_promote','所属推广员'),
|
|
|
);
|
|
|
|
|
|
if(isset($_REQUEST['account'])){
|
|
|
if ($_REQUEST['account']=='全部') {
|
|
|
unset($_REQUEST['account']);
|
|
|
}
|
|
|
$map['account']=array('like','%'.$_REQUEST['account'].'%');
|
|
|
unset($_REQUEST['account']);
|
|
|
}
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
|
|
|
$data=$model
|
|
|
->where($map)
|
|
|
->order('id desc')
|
|
|
->select();
|
|
|
|
|
|
$xlsData = [];
|
|
|
|
|
|
if(is_array($data)){
|
|
|
|
|
|
foreach($data as $k => $v) {
|
|
|
|
|
|
$v['register_time'] = date('Y-m-d H:i:s',$v['register_time']);
|
|
|
$v['login_time'] = $v['login_time']>0?date('Y-m-d H:i:s',$v['login_time']):'暂无登录';
|
|
|
|
|
|
$v['register_type'] = get_registertype($v['register_type']);
|
|
|
|
|
|
$promote = get_parent_promoteto($v['promote_id']);
|
|
|
|
|
|
$v['top_promote'] = $promote?($v['promote_account'] . get_parent_promoteto($v['promote_id'])):get_promote_name($v['promote_id']);
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 补链记录
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function mend_record_list() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$model = M('Mend','tab_');
|
|
|
|
|
|
$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'].'%');
|
|
|
|
|
|
}
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
|
|
|
$data=$model
|
|
|
->where($map)
|
|
|
->order('id desc')
|
|
|
->select();
|
|
|
|
|
|
$xlsData = [];
|
|
|
|
|
|
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'] = get_promote_name($v['promote_id']);
|
|
|
$v['promote_account_to'] = get_promote_name($v['promote_id_to']);
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 平台币转移记录
|
|
|
* @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','转移时间'),
|
|
|
);
|
|
|
|
|
|
$map['type'] = 2;
|
|
|
$map['source_id'] = ['neq',0];
|
|
|
|
|
|
if(isset($_REQUEST['source_id'])) {$map['source_id'] = $_REQUEST['source_id'];}
|
|
|
if(isset($_REQUEST['promote_id'])) {$map['promote_id'] = $_REQUEST['promote_id'];}
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
|
|
|
$data=$model
|
|
|
->where($map)
|
|
|
->order('id desc')
|
|
|
->select();
|
|
|
|
|
|
$xlsData = [];
|
|
|
|
|
|
if(is_array($data)){
|
|
|
|
|
|
foreach($data as $k => $v) {
|
|
|
|
|
|
$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']);
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 角色权限
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function auth_manager() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$model = M('AuthGroup');
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('title','用户组'),
|
|
|
array('description','详情'),
|
|
|
array('status','状态'),
|
|
|
);
|
|
|
|
|
|
$map['module'] = 'admin';
|
|
|
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
|
|
|
$data=$model
|
|
|
->where($map)
|
|
|
->order('id asc')
|
|
|
->select();
|
|
|
|
|
|
$xlsData = [];
|
|
|
|
|
|
if(is_array($data)){
|
|
|
|
|
|
foreach($data as $k => $v) {
|
|
|
|
|
|
$v['description'] = $v['description']?mb_strimwidth($v['description'],0,60,"...","utf-8"):'空';
|
|
|
|
|
|
$v['status']= get_status_title($v['status']);
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 行为日志
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function actionlog() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$model = M('ActionLog');
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('id','编号'),
|
|
|
array('remark','行为'),
|
|
|
array('nickname','管理员账号'),
|
|
|
array('create_time','行为时间'),
|
|
|
array('action_ip','行为IP'),
|
|
|
);
|
|
|
|
|
|
$map['status'] = array('gt', -1);
|
|
|
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
|
|
|
$data=$model
|
|
|
->where($map)
|
|
|
->order('id desc')
|
|
|
->select();
|
|
|
|
|
|
int_to_string($data);
|
|
|
|
|
|
$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']);
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 站内通知
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function msg_lists() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$model = M('Msg','tab_');
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('id','ID'),
|
|
|
array('content','通知内容'),
|
|
|
array('create_time','通知时间'),
|
|
|
array('status','状态'),
|
|
|
);
|
|
|
|
|
|
$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;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
$page = intval($_REQUEST['p']);
|
|
|
|
|
|
$page = $page?$page:1;
|
|
|
|
|
|
$row = $_REQUEST['row']?$_REQUEST['row']:10;
|
|
|
|
|
|
|
|
|
$data=$model
|
|
|
->where($map)
|
|
|
->order('status desc,id')
|
|
|
->select();
|
|
|
|
|
|
int_to_string($data);
|
|
|
|
|
|
$xlsData = [];
|
|
|
|
|
|
foreach ($data as $k=>$v){
|
|
|
$v['status'] = get_info_status($v['status'],13);
|
|
|
$v['create_time'] = set_show_time($v['create_time']);
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function spend_list() {
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('pay_order_number', "订单号"),
|
|
|
array('pay_time', "充值时间"),
|
|
|
array('promote_account', L('Subordinate_channel')),
|
|
|
array('parent_id', "上级推广员"),
|
|
|
array('user_account', "玩家账号"),
|
|
|
array('game_name', "游戏名称"),
|
|
|
array('server_name', L('Game_area_clothing')),
|
|
|
array('game_player_name', "角色名"),
|
|
|
array('spend_ip', "充值ip"),
|
|
|
array('pay_amount', "应付金额"),
|
|
|
array('cost', "实付金额"),
|
|
|
array('pay_way', "充值方式"),
|
|
|
array('promote_id', '商务专员'),
|
|
|
array('is_check','对账状态')
|
|
|
);
|
|
|
|
|
|
|
|
|
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['pay_way'])){
|
|
|
$map['pay_way'] = get_pay_way_map($_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['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(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']);
|
|
|
if(!empty(I('parent_id')) && $map['promote_id']){
|
|
|
|
|
|
if(I('parent_id') == $map['promote_id']) {
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
$maps['parent_id'] = I('parent_id');
|
|
|
$maps['grand_id'] =I('parent_id');
|
|
|
$maps['_logic'] = 'or';
|
|
|
$pro = M('promote','tab_')->field('id')->where([array('id'=>$map['promote_id']),$maps])->select();
|
|
|
|
|
|
if(!$pro) {
|
|
|
$map['promote_id'] = array('eq',999999999);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
$maps['parent_id'] = $map['promote_id'];
|
|
|
$maps['grand_id'] =$map['promote_id'];
|
|
|
$maps['_logic'] = 'or';
|
|
|
$pro = M('promote','tab_')->field('id')->where($maps)->select();
|
|
|
$pro_ids = array_column($pro,'id');
|
|
|
$pro_ids[] = $map['promote_id'];
|
|
|
if (!empty($pro_ids)){
|
|
|
$map['promote_id'] = ['in',$pro_ids];
|
|
|
}else{
|
|
|
$map['promote_id'] = array('eq',999999999);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
if(!empty(I('parent_id'))){
|
|
|
$maps['parent_id'] = I('parent_id');
|
|
|
$maps['grand_id'] =I('parent_id');
|
|
|
$maps['_logic'] = 'or';
|
|
|
$pro = M('promote','tab_')->field('id')->where($maps)->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);
|
|
|
}
|
|
|
} else {
|
|
|
$map['promote_id']=array("gt",0);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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['tab_spend.pay_status'] = 1;
|
|
|
|
|
|
|
|
|
$xlsData = D('Spend')
|
|
|
// 查询条件
|
|
|
->where($map)
|
|
|
/* 默认通过id逆序排列 */
|
|
|
->order('id desc')
|
|
|
/* 执行查询 */
|
|
|
->select();
|
|
|
|
|
|
foreach ($xlsData as $key => &$value) {
|
|
|
$xlsData[$key]['parent_id'] = get_top_promote($value['promote_id'], $value['parent_id']);
|
|
|
$xlsData[$key]['pay_way'] = get_pay_way($value['pay_way']);
|
|
|
$xlsData[$key]['promote_id'] = get_promote_business_account($value['promote_id']);
|
|
|
$xlsData[$key]['is_check'] = get_info_status($value['is_check'],37);
|
|
|
$xlsData[$key]['pay_time'] = date('Y-m-d H:i:s',$value['pay_time']);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|