|
|
<?php
|
|
|
|
|
|
namespace Qrcode\Controller;
|
|
|
|
|
|
use Think\Controller;
|
|
|
|
|
|
class ExportController extends BaseController
|
|
|
{
|
|
|
public function exportExcel($expTitle, $expCellName, $expTableData)
|
|
|
{
|
|
|
$xlsTitle = iconv('utf-8', 'gb2312', $expTitle);//文件名称
|
|
|
// $fileName = session('promote_auth.account').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_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:
|
|
|
/* $xlsName = "代充汇总"; */
|
|
|
$xlsCell = array(
|
|
|
array('user_account', '账号'),
|
|
|
array('game_name', '游戏名称'),
|
|
|
array('pay_order_number', '流水号'),
|
|
|
array('amount', '充值金额'),
|
|
|
array('real_amount', '实扣金额'),
|
|
|
// array('zhekou','折扣比例'),(0未充值 1已充值)
|
|
|
array('pay_status', '支付状态'),
|
|
|
array('pay_way', '支付方式'),
|
|
|
array('create_time', '充值时间'),
|
|
|
// array('promote_account','推广员账号'),
|
|
|
);
|
|
|
$map['promote_id'] = session('promote_auth.pid');
|
|
|
if (isset($_REQUEST['user_account'])) {
|
|
|
$map['user_account'] = array('like', '%' . $_REQUEST['user_account'] . '%');
|
|
|
}
|
|
|
if (isset($_REQUEST['game_id'])) {
|
|
|
if ($_REQUEST['game_id'] == '0') {
|
|
|
unset($_REQUEST['game_id']);
|
|
|
} else {
|
|
|
$map['game_id'] = $_REQUEST['game_id'];
|
|
|
unset($_REQUEST['game_id']);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$start_time = strtotime(I('POST.time_start'));
|
|
|
$end_time = strtotime(I('POST.time_end'));
|
|
|
if (!empty($start_time) && !empty($end_time)) {
|
|
|
$map['create_time'] = ['BETWEEN', [$start_time, $end_time + 24 * 60 * 60 - 1]];
|
|
|
unset($_REQUEST['time_start']);
|
|
|
unset($_REQUEST['time_end']);
|
|
|
} else if (!empty($start_time)) {
|
|
|
$map['create_time'] = array('gt', $start_time);
|
|
|
} else if (!empty($end_time)) {
|
|
|
$map['create_time'] = array('lt', $end_time + 24 * 60 * 60 - 1);
|
|
|
}
|
|
|
|
|
|
$xlsData = M('agent', 'tab_')
|
|
|
->field("user_account,game_name,amount,real_amount,pay_order_number,pay_status,pay_type,pay_way,FROM_UNIXTIME(create_time,'%Y-%m-%d %H:%i:%s') as create_time")
|
|
|
->where($map)
|
|
|
->order("id desc")
|
|
|
->select();
|
|
|
foreach ($xlsData as $key => $value) {
|
|
|
if ($value['pay_status'] == 1) {
|
|
|
$xlsData[$key]['pay_status'] = '成功';
|
|
|
}
|
|
|
if ($value['pay_status'] == 0) {
|
|
|
$xlsData[$key]['pay_status'] = '失败';
|
|
|
}
|
|
|
$xlsData[$key]['pay_way'] = get_info_status($value['pay_way'], 21);
|
|
|
}
|
|
|
break;
|
|
|
case 2:
|
|
|
/* $xlsName = "代充记录"; */
|
|
|
$xlsCell = array(
|
|
|
array('promote_account', '代理账号'),
|
|
|
array('parent_account', '父级账号'),
|
|
|
array('order_number', '流水号'),
|
|
|
array('amount', '充值金额'),
|
|
|
array('create_time', '充值时间'),
|
|
|
);
|
|
|
if (isset($_REQUEST['promote_account']) && $_REQUEST['promote_account'] !== "") {
|
|
|
$map['promote_account'] = array("like", "%" . $_REQUEST['promote_account'] . "%");
|
|
|
unset($_REQUEST['promote_account']);
|
|
|
}
|
|
|
$map['parent_id'] = session('promote_auth.pid');
|
|
|
$xlsData = M('PayAgents', 'tab_')
|
|
|
->field("promote_account,parent_account,order_number,amount,FROM_UNIXTIME(create_time,'%Y-%m-%d %H:%i:%s') as create_time")
|
|
|
->where($map)
|
|
|
->order("create_time")
|
|
|
->select();
|
|
|
break;
|
|
|
case 3:
|
|
|
/* $xlsName = "购买记录"; */
|
|
|
$xlsCell = array(
|
|
|
array('pay_order_number', '订单号'),
|
|
|
array('promote_account', '推广员账号'),
|
|
|
array('amount', '充值金额'),
|
|
|
array('pay_status', '状态(0 未充值 1 已充值)'),
|
|
|
array('create_time', '充值时间'),
|
|
|
);
|
|
|
if (isset($_REQUEST['promote_account']) && $_REQUEST['promote_account'] !== "") {
|
|
|
$map['promote_account'] = array("like", "%" . $_REQUEST['promote_account'] . "%");
|
|
|
unset($_REQUEST['promote_account']);
|
|
|
}
|
|
|
$map['promote_id'] = session('promote_auth.pid');
|
|
|
$map['pay_status'] = 1;
|
|
|
$xlsData = M('ProSpend', 'tab_')
|
|
|
->field("pay_order_number,promote_account,promote_account,amount,pay_status,FROM_UNIXTIME(create_time,'%Y-%m-%d %H:%i:%s') as create_time")
|
|
|
->where($map)
|
|
|
->select();
|
|
|
break;
|
|
|
case 4:
|
|
|
/* $xlsName = "充值明细"; */
|
|
|
$xlsCell = array(
|
|
|
array('id', 'ID'),
|
|
|
array('user_account', '玩家账号'),
|
|
|
array('pay_order_number', '订单号'),
|
|
|
array('game_name', '游戏名称'),
|
|
|
array('server_name', '区服'),
|
|
|
array('cost', '应付金额'),
|
|
|
array('pay_amount', '实付金额'),
|
|
|
array('pay_time', '充值时间'),
|
|
|
array('pay_way', '充值方式'),
|
|
|
array('promote_account', '推广员账号'),
|
|
|
);
|
|
|
$pro_id = get_prmoote_chlid_account(session('promote_auth.pid'));
|
|
|
foreach ($pro_id as $key => $value) {
|
|
|
$pro_id1[] = $value['id'];
|
|
|
}
|
|
|
if (!empty($pro_id1)) {
|
|
|
$pro_id2 = array_merge($pro_id1, array(get_pid()));
|
|
|
} else {
|
|
|
$pro_id2 = array(get_pid());
|
|
|
}
|
|
|
$map['promote_id'] = array('in', $pro_id2);
|
|
|
if (I('request.version', 1) == 1) {
|
|
|
$map['pay_way'] = array('neq', -1);
|
|
|
} else {
|
|
|
$map['pay_way'] = array('eq', -1);
|
|
|
}
|
|
|
if (isset($_REQUEST['user_account']) && trim($_REQUEST['user_account'])) {
|
|
|
$map['user_account'] = array('like', '%' . $_REQUEST['user_account'] . '%');
|
|
|
unset($_REQUEST['user_account']);
|
|
|
}
|
|
|
if (isset($_REQUEST['game_appid']) && !empty($_REQUEST['game_appid'])) {
|
|
|
$map['game_id'] = $_REQUEST['game_appid'];
|
|
|
}
|
|
|
if ($_REQUEST['promote_id'] > 0) {
|
|
|
$map['promote_id'] = $_REQUEST['promote_id'];
|
|
|
}
|
|
|
if (!empty($_REQUEST['time-start']) && !empty($_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 (!empty($_REQUEST['start']) && !empty($_REQUEST['end'])) {
|
|
|
$map['pay_time'] = array('BETWEEN', array(strtotime($_REQUEST['start']), strtotime($_REQUEST['end']) + 24 * 60 * 60 - 1));
|
|
|
unset($_REQUEST['start']);
|
|
|
unset($_REQUEST['end']);
|
|
|
}
|
|
|
$map['pay_status'] = 1;
|
|
|
$map['is_check'] = array('neq', 2);
|
|
|
$xlsData = M('Spend', 'tab_')
|
|
|
->field("tab_spend.*,FROM_UNIXTIME(pay_time,'%Y-%m-%d %H:%i:%s') as pay_time")
|
|
|
->where($map)
|
|
|
->order('id desc,pay_time desc')
|
|
|
->select();
|
|
|
foreach ($xlsData as $key => $value) {
|
|
|
$xlsData[$key]['pay_way'] = get_pay_way($value['pay_way']);
|
|
|
}
|
|
|
break;
|
|
|
case 5:
|
|
|
/* $xlsName = "我的游戏"; */
|
|
|
if (I('check') == 1) {
|
|
|
$xlsCell = array(
|
|
|
array('game_name', '游戏名称'),
|
|
|
array('sdk_version', '平台'),
|
|
|
array('banben', '版本号'),
|
|
|
array('game_size', '包的大小'),
|
|
|
array('apply_time', '更新时间'),
|
|
|
array('launch', '投放平台'),
|
|
|
// array('game_type_name', '类型'),
|
|
|
array('tmoney', '注册单价'),
|
|
|
array('tratio', '分成比例'),
|
|
|
array('launch_time', '投放创建时间'),
|
|
|
array('down_url', '下载链接'),
|
|
|
array('tui_url', '推广链接'),
|
|
|
// array('status', '状态(0待审核 1已审核)'),//(0待审核 1已审核 2 审核失败)
|
|
|
);
|
|
|
} else {
|
|
|
$xlsCell = array(
|
|
|
array('game_name', '游戏名称'),
|
|
|
array('sdk_version', '平台'),
|
|
|
array('banben', '版本号'),
|
|
|
array('game_size', '包的大小'),
|
|
|
array('apply_time', '更新时间'),
|
|
|
array('launch', '投放平台'),
|
|
|
// array('game_type_name', '类型'),
|
|
|
array('tmoney', '注册单价'),
|
|
|
array('tratio', '分成比例'),
|
|
|
array('launch_time', '投放创建时间'),
|
|
|
// array('status', '状态(0待审核 1已审核)'),//(0待审核 1已审核 2 审核失败)
|
|
|
);
|
|
|
}
|
|
|
|
|
|
if ($_REQUEST['game_id'] != null) {
|
|
|
$map['tab_apply.game_id'] = $_REQUEST['game_id'];
|
|
|
}
|
|
|
$map['tab_game.game_status'] = 1;//游戏状态
|
|
|
$map['promote_id'] = session("promote_auth.pid");
|
|
|
if (I('type', -2) < 0) {
|
|
|
unset($map['status']);
|
|
|
} else {
|
|
|
$map['status'] = $_REQUEST['type'];
|
|
|
}
|
|
|
if (I('check') == 1) {
|
|
|
$map['status'] = 1;
|
|
|
} else {
|
|
|
$map['status'] = 0;
|
|
|
}
|
|
|
empty(I('sdk_version')) || $map['tab_game.sdk_version'] = I('sdk_version');
|
|
|
$xlsData = M("game", "tab_")
|
|
|
->field("tab_game.*,al.platform_id,al.launch_time,al.position,tab_apply.id as applyid,tab_apply.promote_id,tab_apply.promote_account,tab_apply.status,tab_apply.ratio as tratio,tab_apply.money as tmoney,tab_game.sdk_version")
|
|
|
->join("tab_apply ON tab_game.id = tab_apply.game_id and tab_apply.promote_id = " . session('promote_auth.pid'))
|
|
|
->join('left join tab_apply_launch as al on (al.apply_id = tab_apply.id) ')
|
|
|
->order("apply_time desc,id desc")
|
|
|
// 查询条件
|
|
|
->where($map)
|
|
|
->select();
|
|
|
|
|
|
foreach ($xlsData as $key => $value) {
|
|
|
$xlsData[$key]['tratio'] = $value['tratio'] . '%';
|
|
|
$res = M('game_source', 'tab_')->where(['game_id' => $value['id']])->find();
|
|
|
if ($res['version']) {
|
|
|
$xlsData[$key]['banben'] = $res['version'];
|
|
|
} else {
|
|
|
$xlsData[$key]['banben'] = '无';
|
|
|
}
|
|
|
if ($res['create_time']) {
|
|
|
$xlsData[$key]['apply_time'] = date('Y-m-d', $res['create_time']);
|
|
|
} else {
|
|
|
$xlsData[$key]['apply_time'] = '无';
|
|
|
}
|
|
|
if ($value['sdk_version'] == 1) {
|
|
|
$xlsData[$key]['sdk_version'] = '安卓';
|
|
|
} else {
|
|
|
$xlsData[$key]['sdk_version'] = '苹果';
|
|
|
|
|
|
}
|
|
|
|
|
|
$xlsData[$key]['launch'] = get_launch_platform_name($value['platform_id'], '--');
|
|
|
|
|
|
$xlsData[$key]['launch_time'] = $value['launch_time'] > 0 ? date('Y-m-d', $value['launch_time']) : '--';
|
|
|
|
|
|
if (I('check') == 1) {
|
|
|
$xlsData[$key]['down_url'] = 'http://' . $_SERVER['HTTP_HOST'] . U('Down/launch_down_file', array('platform_id' => $value['platform_id'], 'position' => $value['position'], 'game_id' => $value['id'], 'promote_id' => $map['promote_id']));
|
|
|
$xlsData[$key]['tui_url'] = 'http://' . $_SERVER['HTTP_HOST'] . U('Home/promotionofregistration', ['pid' => $map['promote_id'], 'gid' => $value['id'], 'lid' => $value['platform_id'], 'p' => $value['position']]);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
case 6:
|
|
|
/* $xlsName = "注册明细"; */
|
|
|
$xlsCell = array(
|
|
|
array('id', 'ID'),
|
|
|
array('account', '玩家账号'),
|
|
|
array('fgame_name', '游戏名称'),
|
|
|
array('server_name', '区服'),
|
|
|
array('register_time', '注册日期'),
|
|
|
array('register_ip', '注册IP'),
|
|
|
array('promote_account', '推广员账号'),
|
|
|
);
|
|
|
$pro_id = get_prmoote_chlid_account(session('promote_auth.pid'));
|
|
|
foreach ($pro_id as $key => $value) {
|
|
|
$pro_id1[] = $value['id'];
|
|
|
}
|
|
|
if (!empty($pro_id1)) {
|
|
|
$pro_id2 = array_merge($pro_id1, array(get_pid()));
|
|
|
} else {
|
|
|
$pro_id2 = array(get_pid());
|
|
|
}
|
|
|
$map['promote_id'] = array('in', $pro_id2);
|
|
|
if (isset($_REQUEST['account']) && trim($_REQUEST['account'])) {
|
|
|
$map['account'] = array('like', '%' . $_REQUEST['account'] . '%');
|
|
|
unset($_REQUEST['user_account']);
|
|
|
}
|
|
|
if (isset($_REQUEST['game_appid']) && $_REQUEST['game_appid'] != 0) {
|
|
|
$map['fgame_id'] = $_REQUEST['game_appid'];
|
|
|
}
|
|
|
if ($_REQUEST['promote_id'] > 0) {
|
|
|
$map['promote_id'] = $_REQUEST['promote_id'];
|
|
|
}
|
|
|
if (!empty($_REQUEST['time_start']) && !empty($_REQUEST['time_end'])) {
|
|
|
$map['register_time'] = array('BETWEEN', array(strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 24 * 60 * 60 - 1));
|
|
|
}
|
|
|
if (!empty($_REQUEST['start']) && !empty($_REQUEST['end'])) {
|
|
|
$map['register_time'] = array('BETWEEN', array(strtotime($_REQUEST['start']), strtotime($_REQUEST['end']) + 24 * 60 * 60 - 1));
|
|
|
}
|
|
|
$map['is_check'] = array('neq', 2);
|
|
|
$xlsData = M("User", "tab_")
|
|
|
->field("tab_user.*,FROM_UNIXTIME(register_time,'%Y-%m-%d %H:%i:%s') as register_time")
|
|
|
// 查询条件
|
|
|
->where($map)->order('id desc')
|
|
|
->select();
|
|
|
foreach ($xlsData as $k => $v) {
|
|
|
if (!empty($xlsData[$k]['fgame_id'])) {
|
|
|
$sName = M('UserPlay', 'tab_')
|
|
|
->where(array('user_id' => $data[$k]['id'], 'game_id' => $data[$k]['fgame_id']))
|
|
|
->order('id desc')
|
|
|
->getField('server_name');
|
|
|
$xlsData[$k]['server_name'] = empty($sName) ? "--" : $sName;
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 7:
|
|
|
/* $xlsName = "我的对账单"; */
|
|
|
$xlsCell = array(
|
|
|
array('bill_number', '对账单号'),
|
|
|
array('bill_time', '对账单时间'),
|
|
|
array('promote_account', '所属渠道'),
|
|
|
array('game_name', '游戏名称'),
|
|
|
array('total_money', '充值总额'),
|
|
|
array('total_number', '注册人数'),
|
|
|
array('status', '状态(0未对账;1已对账)'),
|
|
|
);
|
|
|
$map['promote_id'] = get_pid();
|
|
|
if (isset($_REQUEST['bill_number']) && !empty($_REQUEST['bill_number'])) {
|
|
|
$map['bill_number'] = $_REQUEST['bill_number'];
|
|
|
}
|
|
|
if (isset($_REQUEST['game_id']) && !empty($_REQUEST['game_id'])) {
|
|
|
$map['game_id'] = $_REQUEST['game_id'];
|
|
|
}
|
|
|
if (!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
|
|
|
$map['bill_start_time'] = array('egt', strtotime($_REQUEST['timestart']));
|
|
|
$map['bill_end_time'] = array('elt', strtotime($_REQUEST['timeend']) + 24 * 3600 - 1);
|
|
|
}
|
|
|
$xlsData = M("Bill", "tab_")
|
|
|
->field("tab_bill.*")
|
|
|
// 查询条件
|
|
|
->where($map)
|
|
|
->select();
|
|
|
break;
|
|
|
case 8:
|
|
|
/* $xlsName = "平台入账记录"; */
|
|
|
$xlsCell = array(
|
|
|
array('id', 'ID'),
|
|
|
array('create_time', '发放时间'),
|
|
|
array('num', '平台币数量'),
|
|
|
array('source_id', '平台币来源'),
|
|
|
);
|
|
|
$map['type'] = 1;
|
|
|
$map['promote_id'] = session('promote_auth.pid');
|
|
|
$end_time = strtotime(I('time_end'));
|
|
|
$start_time = strtotime(I('time_start'));
|
|
|
if (!empty($_REQUEST['time_start']) && !empty($_REQUEST['time_end'])) {
|
|
|
$map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 24 * 60 * 60 - 1));
|
|
|
} elseif (!empty($_REQUEST['time_start']) && empty($_REQUEST['time_end'])) {
|
|
|
$map['create_time'] = array('egt', strtotime($_REQUEST['time_start']));
|
|
|
} elseif (empty($_REQUEST['time_start']) && !empty($_REQUEST['time_end'])) {
|
|
|
$map['create_time'] = array('elt', strtotime($_REQUEST['time_end']) + 24 * 60 * 60 - 1);
|
|
|
}
|
|
|
$xlsData = D('PromoteCoin')->where($map)->order('create_time desc')->select();
|
|
|
foreach ($xlsData as $k => $v) {
|
|
|
$xlsData[$k]['create_time'] = time_format($v['create_time']);
|
|
|
$xlsData[$k]['source_id'] = get_status_text(4, $v['source_id']);
|
|
|
}
|
|
|
break;
|
|
|
case 9:
|
|
|
/* $xlsName = "平台转移记录"; */
|
|
|
$xlsCell = array(
|
|
|
array('id', 'ID'),
|
|
|
array('create_time', '转移时间'),
|
|
|
array('num', '平台币数量'),
|
|
|
array('source_id', '转移账号'),
|
|
|
);
|
|
|
$map['source_id'] = empty(I('promote_id')) ? ['neq', '0'] : I('promote_id');
|
|
|
$map['type'] = 2;
|
|
|
$map['promote_id'] = PID;
|
|
|
$end_time = strtotime(I('time_end'));
|
|
|
$start_time = strtotime(I('time_start'));
|
|
|
if (!empty($end_time) && !empty($start_time)) {
|
|
|
$map['create_time'] = ['between', [$start_time, $end_time + 86400 - 1]];
|
|
|
} elseif (!empty($start_time)) {
|
|
|
$map['create_time'] = array('gt', $start_time);
|
|
|
} elseif (!empty($end_time)) {
|
|
|
$map['create_time'] = array('lt', $end_time + 86400 - 1);
|
|
|
}
|
|
|
|
|
|
$xlsData = D('PromoteCoin')->where($map)->order('create_time desc')->select();
|
|
|
foreach ($xlsData as $k => $v) {
|
|
|
$xlsData[$k]['create_time'] = time_format($v['create_time']);
|
|
|
$xlsData[$k]['source_id'] = get_promote_account($v['source_id']);
|
|
|
}
|
|
|
break;
|
|
|
case 10:
|
|
|
/* $xlsName = "子渠道游戏"; */
|
|
|
$xlsCell = array(
|
|
|
array('promote_account', '子渠道账号'),
|
|
|
array('game_name', '游戏名称'),
|
|
|
array('sdk_version', '平台'),
|
|
|
array('game_type_name', '类型'),
|
|
|
array('game_size', '包的大小'),
|
|
|
array('dispose_time', '审核时间'),
|
|
|
array('launch', '投放平台'),
|
|
|
array('tmoney', '注册单价'),
|
|
|
array('tratio', '分成比例'),
|
|
|
);
|
|
|
if ($_REQUEST['game_id'] != null) {
|
|
|
$map['tab_apply.game_id'] = $_REQUEST['game_id'];
|
|
|
}
|
|
|
|
|
|
$map['promote_id'] = get_promote_child_ids(session("promote_auth.pid"));
|
|
|
$map['promote_id'] = array_map('array_shift', $map['promote_id']);
|
|
|
$map['promote_id'] = implode(',', $map['promote_id']);
|
|
|
if ($map['promote_id']) {
|
|
|
$map['promote_id'] = ['in', $map['promote_id']];
|
|
|
} else {
|
|
|
$map['promote_id'] = -1;
|
|
|
}
|
|
|
if ($_REQUEST['promote_id'] != null) {
|
|
|
$map['tab_apply.promote_id'] = $_REQUEST['promote_id'];
|
|
|
}
|
|
|
|
|
|
$map['status'] = 1;
|
|
|
empty(I('sdk_version')) || $map['tab_game.sdk_version'] = I('sdk_version');
|
|
|
$xlsData = M("game", "tab_")
|
|
|
->field("tab_game.*,al.platform_id,al.position,al.launch_time,tab_apply.promote_id,tab_game.sdk_version,tab_apply.promote_account,tab_apply.status,FROM_UNIXTIME(dispose_time,'%Y-%m-%d %H:%i:%s') as dispose_time,tab_apply.ratio as tratio,tab_apply.money as tmoney")
|
|
|
->join("tab_apply ON tab_game.id = tab_apply.game_id ")
|
|
|
->join('left join tab_apply_launch as al on (al.apply_id = tab_apply.id)')
|
|
|
->order("id desc")
|
|
|
// 查询条件
|
|
|
->where($map)
|
|
|
->select();
|
|
|
foreach ($xlsData as $key => $value) {
|
|
|
$xlsData[$key]['tratio'] = $value['tratio'] . '%';
|
|
|
if ($value['sdk_version'] == 1) {
|
|
|
$xlsData[$key]['sdk_version'] = '安卓';
|
|
|
} else {
|
|
|
$xlsData[$key]['sdk_version'] = '苹果';
|
|
|
|
|
|
}
|
|
|
|
|
|
$xlsData[$key]['launch'] = get_launch_platform_name($value['platform_id'], '--');
|
|
|
|
|
|
$xlsData[$key]['launch_time'] = $value['launch_time'] > 0 ? date('Y-m-d', $value['launch_time']) : '--';
|
|
|
|
|
|
}
|
|
|
break;
|
|
|
case 11:
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('id', '推广员ID'),
|
|
|
array('account', '推广员账号'),
|
|
|
array('register_user', '注册用户'),
|
|
|
array('register_ip', '注册IP数'),
|
|
|
array('dabiao_user', '达标用户'),
|
|
|
array('dabiao_game', '达标游戏'),
|
|
|
array('spend', '移动端充值人数'),
|
|
|
array('and_spend', '安卓充值'),
|
|
|
array('ios_spend', '苹果充值'),
|
|
|
);
|
|
|
$page = intval($p);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据arraypage
|
|
|
$arraypage = $page ? $page : 1; //默认显示第一页数据
|
|
|
$size = 10;
|
|
|
$uid = session('promote_auth.pid');
|
|
|
|
|
|
if (isset($_REQUEST['game_id']) && !empty($_REQUEST['game_id'])) {
|
|
|
$game_id = M('game', 'tab_')->field('id')->where(array('relation_game_id' => $_REQUEST['game_id']))->select();
|
|
|
$game_id = array_map('array_shift', $game_id);
|
|
|
$umap['fgame_id'] = $gmap['game_id'] = $g_map['id'] = array('in', $game_id);
|
|
|
// unset($_REQUEST['game_id']);
|
|
|
}
|
|
|
|
|
|
if (isset($_REQUEST['promote_id']) && !empty($_REQUEST['promote_id']) && !empty($_REQUEST['promote_account']) && isset($_REQUEST['promote_account'])) {
|
|
|
if ($_REQUEST['promote_id'] != $_REQUEST['promote_account']) {
|
|
|
$this->error('渠道ID与渠道账号不匹配');
|
|
|
} else {
|
|
|
$map['id'] = $_REQUEST['promote_id'];
|
|
|
}
|
|
|
unset($_REQUEST['promote_id']);
|
|
|
unset($_REQUEST['promote_account']);
|
|
|
} elseif (isset($_REQUEST['promote_id']) && !empty($_REQUEST['promote_id'])) {
|
|
|
$map['id'] = $_REQUEST['promote_id'];
|
|
|
unset($_REQUEST['promote_id']);
|
|
|
} elseif (isset($_REQUEST['promote_account']) && !empty($_REQUEST['promote_account'])) {
|
|
|
$map['id'] = $_REQUEST['promote_account'];
|
|
|
unset($_REQUEST['promote_account']);
|
|
|
} else {
|
|
|
$map['parent_id'] = $uid;
|
|
|
$map['id'] = $uid;
|
|
|
$map['_logic'] = 'or';
|
|
|
}
|
|
|
|
|
|
if (isset($_REQUEST['server_name']) && !empty($_REQUEST['server_name'])) {
|
|
|
$smap['server_name'] = $gmap['server_name'] = $dmap['server_name'] = $_REQUEST['server_name'];
|
|
|
unset($_REQUEST['server_name']);
|
|
|
}
|
|
|
if (isset($_REQUEST['game_level']) && !empty($_REQUEST['game_level'])) {
|
|
|
$gamedata = M('game', 'tab_')->field('first_level,first_level_name,second_level_name,second_level,third_level,third_level_name')->where(array('relation_game_id' => $_REQUEST['game_id']))->find();
|
|
|
if ($gamedata['first_level_name'] == $_REQUEST['game_level']) {
|
|
|
$dmap['role_level'] = array('egt', $gamedata['first_level']);
|
|
|
} elseif ($gamedata['second_level_name'] == $_REQUEST['game_level']) {
|
|
|
$dmap['role_level'] = array('egt', $gamedata['second_level']);
|
|
|
} elseif ($gamedata['third_level_name'] == $_REQUEST['game_level']) {
|
|
|
$dmap['role_level'] = array('egt', $gamedata['third_level']);
|
|
|
}
|
|
|
unset($_REQUEST['game_level']);
|
|
|
}
|
|
|
if (isset($_REQUEST['begtime']) && isset($_REQUEST['endtime']) && !empty($_REQUEST['begtime']) && !empty($_REQUEST['endtime'])) {
|
|
|
$gmap['register_time'] = $umap['register_time'] = $smap['pay_time'] = $dmap['play_time'] = array('BETWEEN', [strtotime($_REQUEST['begtime']), strtotime($_REQUEST['endtime']) + 86400]);
|
|
|
unset($_REQUEST['begtime']);
|
|
|
unset($_REQUEST['endtime']);
|
|
|
} elseif (isset($_REQUEST['begtime']) && !empty($_REQUEST['begtime'])) {
|
|
|
$gmap['register_time'] = $umap['register_time'] = $smap['pay_time'] = $dmap['play_time'] = array('BETWEEN', [strtotime($_REQUEST['begtime']), date("Y-m-d", strtotime("-1 day"))]);
|
|
|
unset($_REQUEST['begtime']);
|
|
|
} elseif (isset($_REQUEST['endtime']) && !empty($_REQUEST['endtime'])) {
|
|
|
$gmap['register_time'] = $umap['register_time'] = $smap['pay_time'] = $dmap['play_time'] = array('ELT', strtotime($_REQUEST['endtime']) + 86400);
|
|
|
unset($_REQUEST['endtime']);
|
|
|
}
|
|
|
//子渠道
|
|
|
$child = M('promote', 'tab_')
|
|
|
->field('id,account')
|
|
|
->where($map)
|
|
|
/* ->page($page,$size) */
|
|
|
->select();
|
|
|
/* $count = count($child);
|
|
|
$this->assign("count",$count);
|
|
|
if($count > $size){
|
|
|
$page = new \Think\Page($count, $size);
|
|
|
$page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
|
|
|
$this->assign('_page', $page->show());
|
|
|
} */
|
|
|
foreach ($child as $k3 => $v3) {
|
|
|
if ($child[$k3]['id'] == PID) {
|
|
|
$child[$k3]['gid'] = PID;
|
|
|
} else {
|
|
|
$child[$k3]['gid'] = M('promote', 'tab_')->field('id')->where(array('parent_id' => $child[$k3]['id']))->select();
|
|
|
$child[$k3]['gid'] = array_map('array_shift', $child[$k3]['gid']);
|
|
|
array_push($child[$k3]['gid'], $child[$k3]['id']);
|
|
|
}
|
|
|
$child[$k3]['register_user'] = M('user', 'tab_')
|
|
|
->field('id')
|
|
|
->where($umap)
|
|
|
->where(array('promote_id' => array('in', $child[$k3]['gid']), 'puid' => 0))
|
|
|
->count();
|
|
|
$child[$k3]['new_user'] = M('user', 'tab_')
|
|
|
->field('id')
|
|
|
->where($umap)
|
|
|
->where(array('promote_id' => array('in', $child[$k3]['gid']), 'puid' => 0))
|
|
|
->group('register_ip')
|
|
|
->select();
|
|
|
$child[$k3]['new_user'] = count($child[$k3]['new_user']);
|
|
|
$child[$k3]['register_ip'] = M('user', 'tab_')
|
|
|
->field('register_ip')
|
|
|
->where($umap)
|
|
|
->where(array('promote_id' => array('in', $child[$k3]['gid']), 'puid' => 0))
|
|
|
->group('register_ip')
|
|
|
->select();
|
|
|
$child[$k3]['register_ip'] = count($child[$k3]['register_ip']);
|
|
|
$game1 = M('apply', 'tab_')
|
|
|
->field('game_id')
|
|
|
->where($gmap)
|
|
|
->where(array('promote_id' => array('in', $child[$k3]['gid']), 'status' => 1))
|
|
|
->group('game_id')
|
|
|
->select();
|
|
|
$game_count1 = count($game1);
|
|
|
$dabiao_user1 = 0;
|
|
|
$dabiao_game1 = 0;
|
|
|
for ($j = 0; $j <= $game_count1; $j++) {
|
|
|
$game_level = M('game', 'tab_')->field('first_level')->where(array('id' => $game1[$j]['game_id']))->find();
|
|
|
if ($dmap['role_level']) {
|
|
|
$game_level['first_level'] = $dmap['role_level'][1];
|
|
|
}
|
|
|
$dabiao1 = M('user_play_info', 'tab_')
|
|
|
->field('user_id')
|
|
|
->where($dmap)
|
|
|
->where(array('game_id' => $game1[$j]['game_id'], 'role_level' => array('egt', $game_level['first_level']), 'promote_id' => array('in', $child[$k3]['gid'])))
|
|
|
->group('user_id')
|
|
|
->select();
|
|
|
$dabiao1 = count($dabiao1);
|
|
|
if ($dabiao1 > 0) {
|
|
|
$dabiao_game1++;
|
|
|
}
|
|
|
$dabiao_user1 += $dabiao1;
|
|
|
}
|
|
|
$child[$k3]['dabiao_user'] = $dabiao_user1;
|
|
|
/*$dabiao_game1 = 0;
|
|
|
for($k=0;$k<=$game_count1;$k++){
|
|
|
$game_level = M('game','tab_')->field('first_level')->where(array('id'=>$game1[$k]['game_id']))->find();
|
|
|
if($dmap['role_level']){
|
|
|
$game_level['first_level'] = $dmap['role_level'][1];
|
|
|
}
|
|
|
$gdabiao = M('user_play_info','tab_')
|
|
|
->field('user_id')
|
|
|
->where($dmap)
|
|
|
->where(array('game_id'=>$game1[$k]['game_id'],'role_level'=>array('egt',$game_level['first_level']),'promote_id'=>array('in',$v3['id'])))
|
|
|
->group('user_id')
|
|
|
->select();
|
|
|
$gdabiao = count($gdabiao);
|
|
|
$dabiao_game1 += $gdabiao;
|
|
|
}*/
|
|
|
$child[$k3]['dabiao_game'] = $dabiao_game1;
|
|
|
$child[$k3]['spend'] = M('spend', 'tab_')
|
|
|
->field('user_id')
|
|
|
->where($gmap)
|
|
|
->where(array('promote_id' => array('in', $child[$k3]['gid']), 'pay_status' => 1))
|
|
|
->group('user_id')
|
|
|
->select();
|
|
|
$child[$k3]['spend'] = count($child[$k3]['spend']);
|
|
|
$child[$k3]['and_spend'] = M('spend', 'tab_')
|
|
|
->field('sum(pay_amount) as amount ')
|
|
|
->where($gmap)
|
|
|
->where(array('promote_id' => array('in', $child[$k3]['gid']), 'pay_status' => 1, 'sdk_version' => 1))
|
|
|
->select();
|
|
|
$child[$k3]['and_spend'] = array_map('array_shift', $child[$k3]['and_spend'])[0];
|
|
|
$child[$k3]['ios_spend'] = M('spend', 'tab_')
|
|
|
->field('sum(pay_amount) as amount ')
|
|
|
->where($gmap)
|
|
|
->where(array('promote_id' => array('in', $child[$k3]['gid']), 'pay_status' => 1, 'sdk_version' => 2))
|
|
|
->select();
|
|
|
$child[$k3]['ios_spend'] = array_map('array_shift', $child[$k3]['ios_spend'])[0];
|
|
|
}
|
|
|
$xlsData = $child;
|
|
|
foreach ($xlsData as $key1 => $value1) {
|
|
|
$xlsData[$key]['register_user'] = IsNull($value1['register_user']);
|
|
|
$xlsData[$key1]['register_ip'] = IsNull($value1['register_ip']);
|
|
|
$xlsData[$key1]['dabiao_user'] = IsNull($value1['dabiao_user']);
|
|
|
$xlsData[$key1]['dabiao_game'] = IsNull($value1['dabiao_game']);
|
|
|
$xlsData[$key1]['spend'] = IsNull($value1['spend']);
|
|
|
$xlsData[$key1]['and_spend'] = null_to_0($value1['and_spend']);
|
|
|
$xlsData[$key1]['ios_spend'] = null_to_0($value1['ios_spend']);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}
|
|
|
|
|
|
|
|
|
/*
|
|
|
* 子渠道列表
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function child($p = 1)
|
|
|
{
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('id', '账号ID'),
|
|
|
array('account', '子渠道'),
|
|
|
array('status', '状态'),
|
|
|
array('create_time', '创建时间'),
|
|
|
);
|
|
|
|
|
|
if ($_REQUEST['account'] != null) {
|
|
|
$map['account'] = array('like', '%' . $_REQUEST['account'] . '%');
|
|
|
}
|
|
|
$map['parent_id'] = session("promote_auth.pid");
|
|
|
|
|
|
$page = intval($p);
|
|
|
|
|
|
$page = $page ? $page : 1;
|
|
|
|
|
|
$row = !empty($_REQUEST['row']) ? $_REQUEST['row'] : 10;
|
|
|
|
|
|
$data = M('Promote', 'tab_')->where($map)->page($page, $row)->select();
|
|
|
|
|
|
foreach ($data as $k => $v) {
|
|
|
$data[$k]['create_time'] = date('Y-m-d H:i:s', $v['create_time']);
|
|
|
$data[$k]['status'] = $v['status'] == 1 ? '启用' : '禁用';
|
|
|
}
|
|
|
|
|
|
$xlsData = $data;
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* ARPU统计
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function arpu_analysis($p = 1)
|
|
|
{
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('activeUsers', '活跃用户'),
|
|
|
array('newUsers', '新增用户'),
|
|
|
array('payUsers', '付费用户'),
|
|
|
array('newPayUsers', '新增付费用户'),
|
|
|
array('usersIncome', '付费总额'),
|
|
|
array('usersPayRate', '付费率'),
|
|
|
array('newPaySum', '新增付费额'),
|
|
|
array('totalPayUsers', '累计付费用户'),
|
|
|
array('ratentionRate1', '1日留存'),
|
|
|
array('usersArpu', 'ARPU'),
|
|
|
array('usersArppu', 'ARPPU'),
|
|
|
);
|
|
|
|
|
|
if (!empty($_REQUEST['promote_id'])) {
|
|
|
array_unshift($xlsCell, array('promote_account', '所属渠道'));
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['game_id'])) {
|
|
|
|
|
|
array_unshift($xlsCell, array('game_name', '游戏名称'));
|
|
|
|
|
|
} else {
|
|
|
array_unshift($xlsCell, array('payGame', '付费游戏数'));
|
|
|
}
|
|
|
|
|
|
array_unshift($xlsCell, array('time', '日期'));
|
|
|
|
|
|
|
|
|
if (is_file(dirname(__FILE__) . '/arpu' . PID . '.txt')) {
|
|
|
|
|
|
$filetxt = file_get_contents(dirname(__FILE__) . '/arpu' . PID . '.txt');
|
|
|
|
|
|
$data = json_decode($filetxt, true);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$data = A('User', 'Event')->arpu_analysis_data();
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
foreach ($data as $k => $v) {
|
|
|
|
|
|
$v['time'] = $k;
|
|
|
|
|
|
empty($_REQUEST['promote_account']) || $v['promote_account'] = $_REQUEST['promote_account'];
|
|
|
empty($_REQUEST['game_name']) || $v['game_name'] = $_REQUEST['game_name'];
|
|
|
empty($v['newPaySum']) && $v['newPaySum'] = '0.00';
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* ARPU统计详情
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function arpu_analysis_detail($p = 1)
|
|
|
{
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('game_name', '游戏名称'),
|
|
|
array('register_num', '新增玩家'),
|
|
|
array('act_user', '活跃玩家'),
|
|
|
array('keep_num', '1日留存'),
|
|
|
array('spend', '充值金额'),
|
|
|
array('spend_people', '付费玩家'),
|
|
|
array('spend_news', '新付费玩家'),
|
|
|
array('spend_rate', '付费率'),
|
|
|
array('ARPU', 'ARPU'),
|
|
|
array('ARPPU', 'ARPPU'),
|
|
|
);
|
|
|
|
|
|
if (is_file(dirname(__FILE__) . '/arpu_detail' . PID . '.txt')) {
|
|
|
|
|
|
$filetxt = file_get_contents(dirname(__FILE__) . '/arpu_detail' . PID . '.txt');
|
|
|
|
|
|
$data = json_decode($filetxt, true);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$data = A('User', 'Event')->arpu_analysis_detail_data();
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
foreach ($data as $k => $v) {
|
|
|
|
|
|
|
|
|
$v['ARPU'] = number_format($v['ARPU'], 2);
|
|
|
$v['ARPPU'] = number_format($v['ARPPU'], 2);
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}
|
|
|
|
|
|
|
|
|
/*
|
|
|
* 留存统计
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function retention_analysis($p = 1)
|
|
|
{
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('newUsers', '新增玩家'),
|
|
|
array('ratentionRate1', '1日留存'),
|
|
|
array('ratentionRate2', '2日留存'),
|
|
|
array('ratentionRate3', '3日留存'),
|
|
|
array('ratentionRate4', '4日留存'),
|
|
|
array('ratentionRate5', '5日留存'),
|
|
|
array('ratentionRate6', '6日留存'),
|
|
|
array('ratentionRate7', '7日留存'),
|
|
|
array('ratentionRate15', '15日留存'),
|
|
|
array('ratentionRate30', '30日留存'),
|
|
|
);
|
|
|
|
|
|
if (!empty($_REQUEST['promote_id'])) {
|
|
|
array_unshift($xlsCell, array('promote_account', '所属渠道'));
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['game_id'])) {
|
|
|
|
|
|
array_unshift($xlsCell, array('game_name', '游戏名称'));
|
|
|
|
|
|
}
|
|
|
|
|
|
array_unshift($xlsCell, array('time', '日期'));
|
|
|
|
|
|
|
|
|
if (is_file(dirname(__FILE__) . '/retention' . PID . '.txt')) {
|
|
|
|
|
|
$filetxt = file_get_contents(dirname(__FILE__) . '/retention' . PID . '.txt');
|
|
|
|
|
|
$data = json_decode($filetxt, true);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$data = A('User', 'Event')->retention_analysis_data();
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
foreach ($data as $k => $v) {
|
|
|
|
|
|
$v['time'] = $k;
|
|
|
|
|
|
empty($_REQUEST['promote_account']) || $v['promote_account'] = $_REQUEST['promote_account'];
|
|
|
empty($_REQUEST['game_name']) || $v['game_name'] = $_REQUEST['game_name'];
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 我的结算
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function earning($p = 1)
|
|
|
{
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('time', '结算周期'),
|
|
|
array('settlement_number', '结算单号'),
|
|
|
array('total_money', '总充值'),
|
|
|
array('total_number', '总注册'),
|
|
|
array('sum_money', '结算金额'),
|
|
|
array('bind_coin_status', '结算范围'),
|
|
|
array('create_time', '结算时间'),
|
|
|
);
|
|
|
|
|
|
if (is_file(dirname(__FILE__) . '/earning' . PID . '.txt')) {
|
|
|
|
|
|
$filetxt = file_get_contents(dirname(__FILE__) . '/earning' . PID . '.txt');
|
|
|
|
|
|
$data = json_decode($filetxt, true);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$data = A('User', 'Event')->earning_data();
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
foreach ($data as $k => $v) {
|
|
|
|
|
|
if (is_numeric($k)) {
|
|
|
$v['time'] = date('Y-m-d', $v['starttime']) . '至' . date('Y-m-d', $v['endtime']);
|
|
|
$v['bind_coin_status'] = $v['bind_coin_status'] == 0 ? '排除绑币' : '包含绑币';
|
|
|
$v['create_time'] = date('Y-m-d', $v['create_time']);
|
|
|
|
|
|
} else {
|
|
|
$v['time'] = $k;
|
|
|
$v['settlement_number'] = '--';
|
|
|
$v['total_money'] = '--';
|
|
|
$v['total_number'] = '--';
|
|
|
$v['bind_coin_status'] = '--';
|
|
|
$v['create_time'] = '--';
|
|
|
}
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 我的结算详情
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function earning_detail()
|
|
|
{
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('time', '结算周期'),
|
|
|
array('game_name', '游戏名称'),
|
|
|
array('total_money', '总充值'),
|
|
|
array('total_number', '总注册'),
|
|
|
array('pattern', '结算模式'),
|
|
|
array('ratio', '分成比例'),
|
|
|
array('money', '注册单价'),
|
|
|
array('sum_money', '结算金额'),
|
|
|
);
|
|
|
|
|
|
if (is_file(dirname(__FILE__) . '/earning_detail' . PID . '.txt')) {
|
|
|
|
|
|
$filetxt = file_get_contents(dirname(__FILE__) . '/earning_detail' . PID . '.txt');
|
|
|
|
|
|
$data = json_decode($filetxt, true);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$data = A('User', 'Event')->earning_detail_data();
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
foreach ($data as $k => $v) {
|
|
|
|
|
|
if (is_numeric($k)) {
|
|
|
$v['time'] = date('Y-m-d', $v['starttime']) . '至' . date('Y-m-d', $v['endtime']);
|
|
|
$v['pattern'] = get_pattern($v['pattern']);
|
|
|
|
|
|
} else {
|
|
|
$v['time'] = $k;
|
|
|
$v['total_number'] = '--';
|
|
|
$v['total_money'] = '--';
|
|
|
$v['pattern'] = '--';
|
|
|
$v['ratio'] = '--';
|
|
|
$v['money'] = '--';
|
|
|
$v['game_name'] = '--';
|
|
|
}
|
|
|
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}
|
|
|
|
|
|
|
|
|
/*
|
|
|
* 游戏列表
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function game_lists()
|
|
|
{
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('relation_game_name', '游戏名称'),
|
|
|
array('sdk_version', '平台'),
|
|
|
array('version', '版本号'),
|
|
|
array('game_size', '包的大小'),
|
|
|
array('time', '更新时间'),
|
|
|
array('money', '注册单价'),
|
|
|
array('ratio', '分成比例'),
|
|
|
);
|
|
|
|
|
|
|
|
|
if (isset($_REQUEST['game_name'])) {
|
|
|
$map['tab_game.game_name'] = array('like', '%' . $_REQUEST['game_name'] . '%');
|
|
|
}
|
|
|
empty(I('game_id')) || $map['tab_game.id'] = I('game_id');
|
|
|
empty(I('sdk_version')) || $map['tab_game.sdk_version'] = I('sdk_version');
|
|
|
|
|
|
if ($_REQUEST['enable_status'] != "") {
|
|
|
if ($_REQUEST['enable_status'] == 0) {
|
|
|
$map['enable_status'] = array(array('EXP', 'IS NULL'), 0, 'OR');
|
|
|
|
|
|
} else {
|
|
|
$map['enable_status'] = I('enable_status');
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
$map['tab_game.online_status'] = 1;//开发者游戏上线状态
|
|
|
$map['tab_game.down_port'] = 1;//游戏端口 第三方接口不能申请
|
|
|
$map['tab_game.game_status'] = 1;//游戏状态
|
|
|
|
|
|
$data = M("game", "tab_")
|
|
|
/* 查询指定字段,不指定则查询所有字段 */
|
|
|
->field("tab_game.id,tab_game.game_size,tab_game.game_name,tab_game.money,tab_game.sdk_version,tab_game.ratio,tab_game.icon,tab_game.game_type_name,tab_game.recommend_status,promote_id,status,tab_apply.dow_status,tab_apply.plist_url,tab_apply.id as applyid,enable_status,tab_game.sort,tab_game.relation_game_id,tab_game.relation_game_name,tg.relation_game_id as trelation_game_id,tg.id as tid,tg.sdk_version as tsdk_version,tg.game_size as tgame_size,tg.money as tmoney,tg.ratio as tratio,dispose_time")
|
|
|
->join("tab_apply ON tab_game.id = tab_apply.game_id and tab_apply.promote_id = " . get_pid(), "LEFT")
|
|
|
->join("left join tab_game as tg ON (tab_game.id = tg.relation_game_id and tg.game_status = 1 and tab_game.id!=tab_game.relation_game_id) or (tab_game.id = tg.relation_game_id and tab_game.id!=tg.id and tg.game_status = 1) or (tab_game.id!=tab_game.relation_game_id and tab_game.relation_game_id=tg.id and tab_game.game_status=1)")
|
|
|
// 查询条件
|
|
|
->where($map)
|
|
|
/* 默认通过id逆序排列 */
|
|
|
->order("sort asc,enable_status desc, id desc")
|
|
|
->group("relation_game_id")
|
|
|
/* 数据分页 */
|
|
|
->page($page, $row)
|
|
|
/* 执行查询 */
|
|
|
->select();
|
|
|
$applymodel = M('apply', 'tab_');
|
|
|
$gamesource = M('game_source', 'tab_');
|
|
|
foreach ($data as $key => $value) {
|
|
|
$data[$key]['plist_url'] = !empty($data[$key]['plist_url']) ? 'https://' . $_SERVER['HTTP_HOST'] . substr($data[$key]['plist_url'], 1) : '';
|
|
|
$data[$key]['applyid'] = empty($data[$key]['applyid']) ? 0 : $data[$key]['applyid'];
|
|
|
|
|
|
|
|
|
if ($value['sdk_version'] == 2 && $value['tsdk_version'] == 1) {
|
|
|
$game_ios = get_game_info($value['id']);
|
|
|
$game_and = get_game_info($value['tid']);
|
|
|
$data[$key] = $game_and;
|
|
|
$data[$key]['tid'] = $game_ios['id'];
|
|
|
$data[$key]['tsdk_version'] = $game_ios['sdk_version'];
|
|
|
$data[$key]['tgame_size'] = $game_ios['game_size'];
|
|
|
$data[$key]['tmoney'] = $game_ios['money'];
|
|
|
$data[$key]['tratio'] = $game_ios['ratio'];
|
|
|
$data[$key]['dispose_time'] = $game_ios['dispose_time'];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
|
$gs = $gamesource->where(['game_id' => $value['id']])->find();
|
|
|
$tgs = $gamesource->where(['game_id' => $value['tid']])->find();
|
|
|
|
|
|
if ($gs['version']) {
|
|
|
$data[$key]['version'] = $gs['version'];
|
|
|
} else {
|
|
|
$data[$key]['version'] = '无';
|
|
|
}
|
|
|
if ($tgs['version']) {
|
|
|
$data[$key]['tversion'] = $tgs['version'];
|
|
|
} else {
|
|
|
$data[$key]['tversion'] = '无';
|
|
|
}
|
|
|
if ($value['sdk_version']) {
|
|
|
if ($value['sdk_version'] == 1) {
|
|
|
$data[$key]['sdk_version'] = '安卓';
|
|
|
} else {
|
|
|
$data[$key]['sdk_version'] = '苹果';
|
|
|
|
|
|
}
|
|
|
}
|
|
|
if ($value['tsdk_version']) {
|
|
|
if ($value['tsdk_version'] == 1) {
|
|
|
$data[$key]['tsdk_version'] = '安卓';
|
|
|
} else {
|
|
|
$data[$key]['tsdk_version'] = '苹果';
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if ($gs['create_time']) {
|
|
|
$data[$key]['time'] = date('Y-m-d', $gs['create_time']);
|
|
|
} else {
|
|
|
$data[$key]['time'] = '无';
|
|
|
}
|
|
|
|
|
|
if ($tgs['create_time']) {
|
|
|
$data[$key]['ttime'] = date('Y-m-d', $tgs['create_time']);
|
|
|
} else {
|
|
|
$data[$key]['ttime'] = '无';
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
foreach ($data as $k => $v) {
|
|
|
if (!empty($v['id'])) {
|
|
|
$xlsData[] = array(
|
|
|
'relation_game_name' => $v['relation_game_name'],
|
|
|
'sdk_version' => $v['sdk_version'],
|
|
|
'version' => $v['version'],
|
|
|
'game_size' => $v['game_size'],
|
|
|
'time' => $v['time'],
|
|
|
'money' => $v['money'],
|
|
|
'ratio' => $v['ratio'],
|
|
|
);
|
|
|
|
|
|
}
|
|
|
if (!empty($v['tid'])) {
|
|
|
$xlsData[] = array(
|
|
|
'relation_game_name' => $v['relation_game_name'],
|
|
|
'sdk_version' => $v['tsdk_version'],
|
|
|
'version' => $v['tversion'],
|
|
|
'game_size' => $v['tgame_size'],
|
|
|
'time' => $v['time'],
|
|
|
'money' => $v['tmoney'],
|
|
|
'ratio' => $v['tratio'],
|
|
|
);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 游戏投放平台列表
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function game_apply_launch($p = 1)
|
|
|
{
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
if ($_REQUEST['notchild'] == 1) {
|
|
|
$xlsCell = array(
|
|
|
array('platform_name', '投放平台'),
|
|
|
array('launch_time', '创建时间'),
|
|
|
array('launch_url', '投放地址'),
|
|
|
array('promotion_url', '推广注册地址'),
|
|
|
array('remark', '备注'),
|
|
|
);
|
|
|
} else {
|
|
|
$xlsCell = array(
|
|
|
array('platform_name', '投放平台'),
|
|
|
array('launch_time', '创建时间'),
|
|
|
array('remark', '备注'),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
$relation_game_id = $_REQUEST['rgid'];
|
|
|
$applyid = $_REQUEST['applyid'];
|
|
|
$sdk_version = $_REQUEST['sdk_version'];
|
|
|
|
|
|
if (is_numeric($applyid) && $applyid > 0) {
|
|
|
|
|
|
$launchmodel = M('apply_launch', 'tab_');
|
|
|
|
|
|
$page = intval($p);
|
|
|
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
|
|
|
$map = ['apply_id' => $applyid];
|
|
|
|
|
|
|
|
|
$data = $launchmodel->alias('l')->field('l.*,a.promote_id,a.sdk_version,a.enable_status')
|
|
|
->join('tab_apply as a on(a.id=l.apply_id) ')
|
|
|
->where($map)->select();
|
|
|
|
|
|
if ($_REQUEST['notchild'] == 1) {
|
|
|
foreach ($data as $k => $v) {
|
|
|
$v['launch_time'] = date('Y-m-d H:i:s', $v['launch_time']);
|
|
|
if ($sdk_version == 1) {
|
|
|
$v['launch_url'] = $v['launch_down_url'] ? $v['launch_down_url'] : '--';
|
|
|
} else {
|
|
|
$v['launch_url'] = $v['launch_down_url'] ? $v['launch_down_url'] : '--';
|
|
|
}
|
|
|
$v['promotion_url'] = 'http://' . $_SERVER['HTTP_HOST'] . U('Home/promotionofregistration', ['pid' => $v['promote_id'], 'gid' => $relation_game_id, 'lid' => $v['platform_id'], 'p' => $v['position']]);
|
|
|
$v['platform_name'] = get_launch_platform_name($v['platform_id'], '--');
|
|
|
$xlsData[] = $v;
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
foreach ($data as $k => $v) {
|
|
|
$v['launch_time'] = date('Y-m-d H:i:s', $v['launch_time']);
|
|
|
$v['platform_name'] = get_launch_platform_name($v['platform_id'], '--');
|
|
|
$xlsData[] = $v;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 我的福利列表
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function discount()
|
|
|
{
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('id', '编号'),
|
|
|
array('promote_account', '推广员账号'),
|
|
|
array('game_name', '游戏名称'),
|
|
|
array('game_discount', '统一折扣'),
|
|
|
array('promote_discount', '代充折扣'),
|
|
|
array('first_discount', '首充折扣'),
|
|
|
array('continue_discount', '续充折扣'),
|
|
|
);
|
|
|
|
|
|
|
|
|
$map['promote_id'] = ['in', PID . ",-1,-2"];
|
|
|
empty(I('game_name')) || $map['game_name'] = ['like', '%' . I('game_name') . '%'];
|
|
|
empty(I('game_id')) || $map['game_id'] = I('game_id');
|
|
|
|
|
|
$data = M('PromoteWelfare', 'tab_')->where($map)->select();
|
|
|
|
|
|
foreach ($data as $k => $v) {
|
|
|
$v['promote_account'] = get_promote_account($v['promote_id']);
|
|
|
$xlsData[] = discount_data($v);
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 子渠道福利列表
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function child_discount()
|
|
|
{
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('id', '编号'),
|
|
|
array('promote_account', '推广员账号'),
|
|
|
array('game_name', '游戏名称'),
|
|
|
array('game_discount', '统一折扣'),
|
|
|
array('promote_discount', '代充折扣'),
|
|
|
array('first_discount', '首充折扣'),
|
|
|
array('continue_discount', '续充折扣'),
|
|
|
);
|
|
|
|
|
|
|
|
|
$child_promote = get_zi_promote_id(PID);
|
|
|
$child_promote = $child_promote . ",-1";
|
|
|
|
|
|
if (empty(I('promote_id')) || in_array(I('promote_id'), explode(',', $child_promote))) {
|
|
|
|
|
|
$map['promote_id'] = empty(I('promote_id')) ? ['in', $child_promote] : I('promote_id');
|
|
|
|
|
|
empty(I('game_name')) || $map['game_name'] = ['like', '%' . I('game_name') . '%'];
|
|
|
|
|
|
empty(I('game_id')) || $map['game_id'] = I('game_id');
|
|
|
|
|
|
$data = M('PromoteWelfare', 'tab_')->where($map)->select();
|
|
|
|
|
|
foreach ($data as $k => $v) {
|
|
|
$v['promote_account'] = get_promote_account($v['promote_id']);
|
|
|
$xlsData[] = discount_data($v);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 联盟站点游戏列表
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function sitegame()
|
|
|
{
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('game_name', '游戏名称'),
|
|
|
array('sdk_version', '游戏平台'),
|
|
|
array('game_type', '游戏类型'),
|
|
|
array('game_size', '游戏大小'),
|
|
|
array('recommend_status', '推荐状态'),
|
|
|
array('group_code', 'QQ群号'),
|
|
|
array('group_name', 'QQ群名称'),
|
|
|
array('in_num', '加群人数'),
|
|
|
array('version', '版本号'),
|
|
|
array('update_time', '更新时间'),
|
|
|
);
|
|
|
|
|
|
$data = M('SiteGame', 'tab_')->field('tab_site_game.*,sg.group_code,sg.group_name,sg.in_num')
|
|
|
->join('tab_site_group as sg on sg.site_game_id = tab_site_game.id', 'left')
|
|
|
->where($map)->order('is_top desc,top_time desc')->select();
|
|
|
|
|
|
foreach ($data as $k => $v) {
|
|
|
$v['game_size'] .= 'M';
|
|
|
$v['sdk_version'] = $v['sdk_version'] == 1 ? '安卓' : '苹果';
|
|
|
$v['recommend_status'] = $v['recommend_status'] ? get_recommend_status_info($v['recommend_status']) : '不推荐';
|
|
|
$v['group_code'] = $v['group_code'] ? $v['group_code'] : '--';
|
|
|
$v['group_name'] = $v['group_name'] ? $v['group_name'] : '--';
|
|
|
$v['in_num'] = $v['in_num'] ? $v['in_num'] : '--';
|
|
|
$v['update_time'] = $v['update_time'] > 0 ? date('Y-m-d H:i', $v['update_time']) : '--';
|
|
|
$xlsData[] = $v;
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 联盟站点区服列表
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function siteserver()
|
|
|
{
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('game_name', '游戏名称'),
|
|
|
array('server_version', '游戏平台'),
|
|
|
array('game_type', '游戏类型'),
|
|
|
array('start_time', '开服时间'),
|
|
|
array('server_name', '区服名称'),
|
|
|
);
|
|
|
|
|
|
$map['promote_id'] = PID;
|
|
|
$map['status'] = 1;
|
|
|
$server_name = $_REQUEST['server_name'] ? $_REQUEST['server_name'] : '';
|
|
|
$game_name = $_REQUEST['game_name'] ? $_REQUEST['game_name'] : '';
|
|
|
if ($server_name != '') {
|
|
|
$map['server_name'] = array('like', '%' . $server_name . '%');
|
|
|
}
|
|
|
if ($game_name != '') {
|
|
|
$map['game_name'] = array('like', '%' . $game_name . '%');
|
|
|
}
|
|
|
|
|
|
$gamemodel = M('SiteGame', 'tab_');
|
|
|
|
|
|
$game = $gamemodel->field('id,game_name')->distinct(true)->where($map)->select();
|
|
|
|
|
|
foreach ($game as $k => $v) {
|
|
|
if (empty($v['id'])) {
|
|
|
unset($game[$k]);
|
|
|
}
|
|
|
if (!empty($v['id'])) {
|
|
|
$gameName[$k] = $v['id'];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$SiteServer = M('SiteServer', 'tab_');
|
|
|
if (!empty($gameName)) {
|
|
|
$map['game_id'] = array('in', implode(',', $gameName));
|
|
|
}
|
|
|
if (!empty($game)) {
|
|
|
$data = $SiteServer->where($map)->select();
|
|
|
foreach ($data as $k => $v) {
|
|
|
$gamed = $gamemodel->field('game_name,game_type')->distinct(true)->where(['id' => $v['game_id']])->find();
|
|
|
$v['start_time'] = date('Y-m-d H:i', $v['start_time']);
|
|
|
$v['game_type'] = $gamed['game_type'];
|
|
|
$v['game_name'] = $gamed['game_name'];
|
|
|
$v['server_version'] = $v['server_version'] == 1 ? '安卓' : '苹果';
|
|
|
$xlsData[] = $v;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 联盟站点礼包列表
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function sitegift()
|
|
|
{
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('game_name', '游戏名称'),
|
|
|
array('giftbag_version', '游戏平台'),
|
|
|
array('gift_name', '礼包名称'),
|
|
|
array('site_gift_num', '剩余数量'),
|
|
|
array('recommend_status', '推荐状态'),
|
|
|
array('status', '礼包状态'),
|
|
|
array('create_time', '添加时间'),
|
|
|
);
|
|
|
|
|
|
|
|
|
$model = M('SiteGift', 'tab_');
|
|
|
$map['promote_id'] = PID;
|
|
|
$game_name = $_REQUEST['game_name'] ? $_REQUEST['game_name'] : '';
|
|
|
$gift_name = $_REQUEST['gift_name'] ? $_REQUEST['gift_name'] : '';
|
|
|
$recommend_status = $_REQUEST['recommend_status'] ? $_REQUEST['recommend_status'] : '';
|
|
|
|
|
|
if ($game_name != '') {
|
|
|
$map['game_name'] = array('like', '%' . $game_name . '%');
|
|
|
$parameter['game_name'] = $game_name;
|
|
|
}
|
|
|
if ($gift_name != '') {
|
|
|
$map['gift_name'] = array('like', '%' . $gift_name . '%');
|
|
|
$parameter['gift_name'] = $gift_name;
|
|
|
}
|
|
|
if ($recommend_status != '') {
|
|
|
$map['recommend_status'] = array('like', '%' . $recommend_status . '%');;
|
|
|
$parameter['recommend_status'] = $recommend_status;
|
|
|
}
|
|
|
|
|
|
$data = $model->where($map)->order('create_time desc')->page($page, $row)->select();
|
|
|
|
|
|
foreach ($data as $k => $v) {
|
|
|
$v['create_time'] = date('Y-m-d H:i', $v['create_time']);
|
|
|
$v['status'] = get_info_status($v['status'], 26);
|
|
|
$v['site_gift_num'] = get_site_gift_num($v['id']);
|
|
|
$v['recommend_status'] = $v['recommend_status'] ? get_info_status($v['recommend_status'], 1) : '不推荐';
|
|
|
$v['giftbag_version'] = $v['giftbag_version'] == 1 ? '安卓' : '苹果';
|
|
|
$xlsData[] = $v;
|
|
|
}
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 联盟站点广告列表
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function siteadv()
|
|
|
{
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('title', '广告标题'),
|
|
|
array('url', '广告链接'),
|
|
|
array('start_time', '开始时间'),
|
|
|
array('end_time', '结束时间'),
|
|
|
array('target', '打开方式'),
|
|
|
array('status', '展示状态'),
|
|
|
);
|
|
|
|
|
|
|
|
|
$map['promote_id'] = PID;
|
|
|
|
|
|
$data = M('SiteAdv', 'tab_')->where($map)->order('create_time desc')->select();
|
|
|
|
|
|
|
|
|
foreach ($data as $k => $v) {
|
|
|
$v['start_time'] = $v['start_time'] > 0 ? date('Y-m-d H:i', $v['start_time']) : '--';
|
|
|
$v['end_time'] = $v['end_time'] > 0 ? date('Y-m-d H:i', $v['end_time']) : '--';
|
|
|
$v['status'] = get_info_status($v['status']);
|
|
|
$v['target'] = get_target_name($v['target']);
|
|
|
$xlsData[] = $v;
|
|
|
}
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 子渠道结算记录列表
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function son_list()
|
|
|
{
|
|
|
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('promote_account', '子渠道账户'),
|
|
|
array('time', '结算周期'),
|
|
|
array('settlement_number', '结算单号'),
|
|
|
array('sum_money', '总充值'),
|
|
|
array('reg_number', '总注册'),
|
|
|
array('jie_money', '结算金额'),
|
|
|
array('bind_coin_status', '结算范围'),
|
|
|
array('create_time', '结算时间'),
|
|
|
);
|
|
|
|
|
|
|
|
|
if (!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
|
|
|
$map['settlement_start_time'] = array('egt', strtotime($_REQUEST['timestart']));
|
|
|
$map['settlement_end_time'] = array('elt', strtotime($_REQUEST['timeend']) + 86399);
|
|
|
} elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {
|
|
|
$map['settlement_start_time'] = array('egt', strtotime($_REQUEST['timestart']));
|
|
|
$map['settlement_end_time'] = array('elt', time());
|
|
|
} elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
|
|
|
$map['settlement_end_time'] = array('elt', strtotime($_REQUEST['timeend']) + 86399);
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['start']) && !empty($_REQUEST['end'])) {
|
|
|
$start = strtotime($_REQUEST['start']);
|
|
|
$end = strtotime($_REQUEST['end']) + 24 * 60 * 60 - 1;
|
|
|
$map['create_time'] = array('BETWEEN', array($start, $end));
|
|
|
}
|
|
|
|
|
|
if (!empty($_REQUEST['ch_promote_id'])) {
|
|
|
$map['promote_id'] = $_REQUEST['ch_promote_id'];
|
|
|
} else {
|
|
|
|
|
|
$promote = M('Promote', 'tab_')->field('id')->where(['parent_id' => PID])->select();
|
|
|
$zi_p = implode(',', array_column($promote, 'id'));
|
|
|
$map['promote_id'] = array('in', "$zi_p");
|
|
|
}
|
|
|
|
|
|
|
|
|
$data = M('SonSettlement', 'tab_')
|
|
|
->field('settlement_number,
|
|
|
settlement_start_time,
|
|
|
settlement_end_time,
|
|
|
promote_id,
|
|
|
promote_account,
|
|
|
bind_coin_status,
|
|
|
sum(sum_money) as sum_money,
|
|
|
sum(reg_number) as reg_number,
|
|
|
sum(jie_money) as jie_money,
|
|
|
ti_status,
|
|
|
create_time')
|
|
|
->where($map)
|
|
|
->order('create_time desc')
|
|
|
->group('settlement_number,create_time')
|
|
|
->select();
|
|
|
|
|
|
|
|
|
foreach ($data as $k => $v) {
|
|
|
|
|
|
$v['bind_coin_status'] = get_bind_coin_status($v['bind_coin_status']);
|
|
|
$v['jie_money'] = number_format(round($v['jie_money'], 2), 2);
|
|
|
|
|
|
|
|
|
$v['time'] = date('Y-m-d', $v['settlement_start_time']) . '~' . date('Y-m-d', $v['settlement_end_time']);
|
|
|
$v['sum_money'] = !empty($v['sum_money']) ? $v['sum_money'] : 0;
|
|
|
$v['reg_number'] = !empty($v['reg_number']) ? $v['reg_number'] : 0;
|
|
|
|
|
|
$v['create_time'] = date('Y-m-d', $v['create_time']);
|
|
|
$xlsData[] = $v;
|
|
|
}
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 平台币记录列表
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function promotecoin_list()
|
|
|
{
|
|
|
$xlsName = $_REQUEST['xlsname'];
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
array('order_number', '订单号'),
|
|
|
array('promote_account', '充值帐号'),
|
|
|
array('create_time', '充值时间'),
|
|
|
array('num', '平台币数量'),
|
|
|
array('source', '来源'),
|
|
|
array('way', '支付方式'),
|
|
|
);
|
|
|
|
|
|
|
|
|
switch ($_REQUEST['source']) {
|
|
|
case 1:
|
|
|
{/* 后台发放 */
|
|
|
$xlsData = D('PromoteCoin')->grant_all();
|
|
|
};
|
|
|
break;
|
|
|
case 2:
|
|
|
case 3:
|
|
|
case 4:
|
|
|
case 5:
|
|
|
{
|
|
|
$xlsData = D('Balance')->recharge_all($_REQUEST['source'] - 1);
|
|
|
};
|
|
|
break;
|
|
|
default:
|
|
|
{
|
|
|
|
|
|
$xlsData = D('PromoteCoin')->all_coin_all();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
foreach ($xlsData as $k => $v) {
|
|
|
|
|
|
$xlsData[$k]['promote_account'] = is_numeric($v['recharge_id']) ? get_promote_account($v['recharge_id']) : $v['recharge_id'];
|
|
|
$xlsData[$k]['create_time'] = date('Y-m-d H:i:s', $v['create_time']);
|
|
|
$xlsData[$k]['source'] = get_promote_coin_source_name($v['source']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|