21,893
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
<title><?php if( isset($title) ) echo $title;?></title>
<script src="<?php echo BASE_URL.'app/views/assets/juery/library/jquery-2.1.3.js' ?>" type="text/javascript"></script>
<script src="<?php echo BASE_URL.'app/views/assets/ajax_page.js' ?>" type="text/javascript"></script>
</head>
<body>
<div>
<div>
<h4>当前位置>单服基本数据</h4>
</div>
<hr />
<div>
<?php echo form_open('admin/SignalDataPage'); ?>
开始时间: <input type="text" name="txtStartTime" value="<?php echo set_value('txtStartTime'); ?>" style="width: 180px" onfocus="WdatePicker()" />
结束时间: <input type="text" name="txtEndTime" value="<?php echo set_value('txtEndTime'); ?>" style="width: 180px" onfocus="WdatePicker()" />
渠道权限范围: <select name="ddlist1" style="width:130px;" value="<?php echo set_value('ddlist1'); ?>">
<option>ALL</option>
<option>DUOWAN</option>
</select>
<input id="BtnSearch" type="submit" value="查询"/>
<input id="BtnExport" type="button" value="导出" onclick="window.location='<?php echo site_url("/admin/SignalDataPage/OnExportBtn");?>'"/>
<?php echo form_close(); ?>
</div>
<hr />
<div>
<table border="0" style="border-color:Gray;" cellspacing="0" cellpadding="0" width="100%">
<tr style=" background-color:#87CEFA; height:28px;width:140px; text-align:center;">
<td>日期</td>
<td>新增用户</td>
<td>日均登录次数</td>
<td>DAU</td>
<td>付费渗透率</td>
<td>启动次数</td>
<td>最高在线</td>
<td>平均在线</td>
<td>充值人数</td>
<td>充值次数</td>
<td>单日收入</td>
<td>ARPU</td>
<td>APPPU</td>
</tr>
<?php if(count($page_data) > 0): ?>
<?php $i = 1;?>
<?php foreach($page_data as $row): ?>
<?php if($i%2 === 0): ?>
<tr style="height:26px;background-color:#B0E2FF;text-align:center;">
<?php else: ?>
<tr style="height:26px;background-color:#F2F2F2;text-align:center;">
<?php endif?>
<?php $i++;?>
<td><?php echo $row['DayDate']; ?></td>
<td><?php echo $row['RegCount']; ?></td>
<td><?php echo $row['AverageRepeatLogin']; ?></td>
<td><?php echo $row['DAU']; ?></td>
<td><?php echo $row['PUR']; ?></td>
<td><?php echo $row['ClientOpenTime']; ?></td>
<td><?php echo $row['DayOnlineTop']; ?></td>
<td><?php echo $row['DayAverageOnlineTop']; ?></td>
<td><?php echo $row['PayUserCount']; ?></td>
<td><?php echo $row['PayTatalCount']; ?></td>
<td><?php echo $row['PayMoneySum']; ?></td>
<td><?php echo $row['ARPU']; ?></td>
<td><?php echo $row['ARPPU']; ?></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</table>
<br>
<div style="text-align:center;"> <?php echo $links; ?></div>
</div>
</div>
</body>
</html>
function ajax_page(page){
if(page=='' || page==null || page==undefined){
page = '';
}
content = '';
$.ajax({
type:'GET',
url:"SignalDataPage/index/"+page,
async:false,
success:function(data){
content = data;
}
});
$(".tab1_class").html('');
$(".tab1_class").html(content);
return false;
}
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class SignalDataPage extends MY_AdminController
{
private $strStartDate;
private $strEndDate;
public function __construct()
{
parent::__construct();
$this->load->model('MY_SignalBasicDataModel');
$this->load->model('MY_UserRetainDataModel');
$this->load->library('TableExport');
$this->load->helper('url');
$this->load->library('pagination');
$this->strStartDate = Date('Y-m-d');
$this->strEndDate = Date('Y-m-d');
}
public function SubMenuSelected($subIndex)
{
$this->session->set_userdata('sub_index', $subIndex);
redirect('admin/SignalDataPage');
}
public function index($page=1)
{
echo $page;
$subMenuIndex = 0;
if( isset($this->session->userdata['sub_index']) )
{
$subMenuIndex = $this->session->userdata['sub_index'];
}
$sDate = $this->input->post('txtStartTime');
$eDate = $this->input->post('txtEndTime');
$selectChannel = 'ALL';
if(isset($_POST["ddlist1"]))
$selectChannel = $_POST["ddlist1"];
$offset=intval($this->uri->segment(4));
echo $offset;
if(CheckEmptyString($sDate) != false && CheckEmptyString($eDate) != false)
{
$this->session->set_userdata('start_date', $sDate);
$this->session->set_userdata('end_date', $eDate);
$this->strStartDate = $sDate;
$this->strEndDate = $eDate;
}
else
{
if( isset($this->session->userdata['start_date']) && isset($this->session->userdata['end_date']) )
{
$this->strStartDate = $this->session->userdata['start_date'];
$this->strEndDate = $this->session->userdata['end_date'];
}
}
$tStartData = strtotime($this->strStartDate);
$tEndData = strtotime($this->strEndDate);
if($this->CheckTime($tStartData, $tEndData) === false)
{
return;
}
$rowCount = $this->GetRowCount($tStartData, $tEndData);
$this->InitPageConfig($rowCount, $subMenuIndex);
if($offset > 0)
{
$tStartData = strtotime($offset.' days', $tStartData);
}
else
{
$tStartData = strtotime($offset.' days', $tStartData);
}
if($offset + MAX_ROW_COUNT < $rowCount)
{
$tEndData = strtotime((MAX_ROW_COUNT - 1).' days', $tStartData);
}
$pageData = array();
if($subMenuIndex === '1')
{
$pageData = $this->MY_SignalBasicDataModel->GetSignalBasicDate($tStartData, $tEndData, $selectChannel);
}
else if($subMenuIndex === '2')
{
$pageData = $this->MY_UserRetainDataModel->GetNewUserRetainData($tStartData, $tEndData, $selectChannel);
}
else if($subMenuIndex === '3')
{
$pageData = $this->MY_UserRetainDataModel->GetActiveUserRetainData($tStartData, $tEndData, $selectChannel);
}
if($pageData === false || empty($pageData))
{
show_404();
}
$this->ShowSignalDataPage($pageData, $subMenuIndex);
}
function GetRowCount($itartData, $iEndData)
{
$rowCount = round(($iEndData-$itartData)/3600/24) + 1;
return $rowCount;
}
function CheckTime($tStartData, $tEndData)
{
if($tStartData > $tEndData || $tStartData > strtotime('today') || $tEndData > strtotime('today'))
{
$this->session->unset_userdata("start_date");
$this->session->unset_userdata("end_date");
echo "<script> {window.alert('日期输入错误');location.href='../admin/SignalDataPage'} </script>";
return false;
}
return true;
}
public function InitPageConfig($rowCount, $subMenuIndex)
{
$cfg['base_url'] = site_url('admin/SignalDataPage/send_message');
$cfg['total_rows'] = $rowCount;
$cfg['per_page'] = MAX_ROW_COUNT;
$cfg['cur_tag_open'] = '<a class="current">';
$cfg['cur_tag_close'] = '</a>';
$cfg['first_link'] = '首页';
$cfg['prev_link'] = '上一页';
$cfg['next_link'] = '下一页';
$cfg['last_link'] = '尾页';
$cfg['uri_segment'] = 4;
$this->pagination->initialize($cfg);
}
public function ShowSignalDataPage($pageData = 0, $subMenuIndex)
{
if($pageData === 0)
{
$data['page_data'] = array();
}
else
{
$data['page_data'] = $pageData;
}
$data['links'] = $this->pagination->create_ajax_links();
if($subMenuIndex === '1')
{
$data['title'] = '单服基本数据';
$this->load->view('service/tpl_basicdata', $data);
}
}
public function OnExportBtn()
{
$sDate = $this->strStartDate;
$eDate = $this->strEndDate;
if( isset($this->session->userdata['start_date']) && isset($this->session->userdata['end_date']) )
{
$sDate = $this->session->userdata['start_date'];
$eDate = $this->session->userdata['end_date'];
}
$tStartData = strtotime($sDate);
$tEndData = strtotime($eDate);
$signalBasicData = $this->MY_SignalBasicDataModel->GetSignalBasicDate($tStartData, $tEndData, 'ALL');
$newUserRetainData = $this->MY_UserRetainDataModel->GetNewUserRetainData($tStartData, $tEndData, 'ALL');
$activeUserRetainData = $this->MY_UserRetainDataModel->GetActiveUserRetainData($tStartData, $tEndData, 'ALL');
if($signalBasicData === false || $newUserRetainData === false || $activeUserRetainData === false ||
empty($signalBasicData) || empty($newUserRetainData) || empty($activeUserRetainData))
{
show_404();
}
$pageData = array(
'SignalBasicData' => $signalBasicData,
'NewUserRetainData' => $newUserRetainData,
'ActiveUserRetainData' => $activeUserRetainData
);
$this->tableexport->ExportExcel($pageData, 'SignalData');
}
}
function ajax_page(page){
if(page=='' || page==null || page==undefined){
page = '';
}
var mydata = {
txtStartTime:$("#txtStartTime").val(),
txtEndTime:$("#txtEndTime").val()
};
content = '';
$.ajax({
type:'POST',
url:"SignalDataPage/index/"+page,
data:mydata,
dataType: "json",
async:false,
success:function(data){
content = data;
}
});
$(".tab1_class").html('');
$(".tab1_class").html(content);
return false;
}
function ajax_page(page){
if(page=='' || page==null || page==undefined){
page = '';
}
content = '';
$.ajax({
type:'POST',
url:"SignalDataPage/index/"+page,
async:false,
success:function(data){
content = data;
}
});
$(".tab1_class").html('');
$(".tab1_class").html(content);
return false;
}