更新计划内数据服务情况统计
This commit is contained in:
parent
9ca9d659f6
commit
582f7054ad
|
@ -3780,10 +3780,6 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
//统计
|
||||
if($ac == 'status')
|
||||
{
|
||||
$this->_helper->viewRenderer('project-status');
|
||||
|
||||
$this->view->projects = $heihe->fetch();
|
||||
|
||||
$status = new \Heihe\Status;
|
||||
|
||||
$fund_id = $this->_getParam('fund_id');
|
||||
|
@ -3795,6 +3791,17 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
$status->fund_id = $fund_id;
|
||||
}
|
||||
|
||||
if(view::isXmlHttpRequest())
|
||||
{
|
||||
echo $status->fileCount();
|
||||
exit();
|
||||
}
|
||||
|
||||
$this->_helper->viewRenderer('project-status');
|
||||
|
||||
$this->view->projects = $heihe->fetch();
|
||||
|
||||
|
||||
$this->view->projectsCount = $status->projectsCount();
|
||||
|
||||
$this->view->dataCount = $status->dataCount();
|
||||
|
@ -3807,7 +3814,13 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
|
||||
$this->view->applyTimesDistanct = $status->applyTimesDistinct();
|
||||
|
||||
$this->view->fileCount = $status->fileCount();
|
||||
//$this->view->fileCount = $status->fileCount();
|
||||
|
||||
$this->view->offlineServiceTimes = $status->serviceTimes('offline');
|
||||
$this->view->onlineServiceTimes = $status->serviceTimes('online');
|
||||
|
||||
$this->view->offlineServiceSize = $status->serviceFilesize('offline');
|
||||
$this->view->onlineServiceSize = $status->serviceFilesize('online');
|
||||
|
||||
}//status
|
||||
|
||||
|
|
|
@ -21,13 +21,23 @@
|
|||
<h2>统计信息</h2>
|
||||
<hr />
|
||||
|
||||
<h4>数据:</h4>
|
||||
<p>项目个数:<?= $this->projectsCount ?></p>
|
||||
<p>数据条数:<?= $this->dataCount ?></p>
|
||||
<p>总数据量:<?= round($this->dataFileSize / 1024 , 2) . 'GB' ?></p>
|
||||
<p>文件个数:<?= $this->fileCount ?></p>
|
||||
<p>文件个数:<a href="javascript:void(0);" id="fileCount">点击查看</a></p>
|
||||
<p>服务次数(人/次):<a href="/admin/data/project/ac/userdown"><?= $this->applyTimes ?></a></p>
|
||||
<p>服务次数(人/合并次,单个用户多次申请算作一次服务): <?= $this->applyTimesDistanct ?></p>
|
||||
<p>服务次数(人/数据):<?= $this->dataApplyTimes ?></p>
|
||||
<p>服务次数(数据条/次):<?= $this->dataApplyTimes ?></p>
|
||||
|
||||
|
||||
<h4>项目服务情况</h4>
|
||||
<p>为黑河计划项目服务的次数-离线:<?= $this->offlineServiceTimes ?></p>
|
||||
<p>为黑河计划项目服务的数据量-离线:<?= round($this->offlineServiceSize,2) ?>GB</p>
|
||||
<p>为黑河计划项目服务的次数-在线:<?= $this->onlineServiceTimes ?></p>
|
||||
<p>为黑河计划项目服务的数据量-在线:<?= round($this->onlineServiceSize ,2) ?>GB</p>
|
||||
<p>为黑河计划项目服务的次数-总数:<?= $this->onlineServiceTimes + $this->offlineServiceTimes ?></p>
|
||||
<p>为黑河计划项目服务的数据量-总数:<?= round($this->onlineServiceSize + $this->offlineServiceSize ,2)?>GB</p>
|
||||
|
||||
<h3>选择项目进行统计</h3>
|
||||
|
||||
|
@ -44,4 +54,21 @@
|
|||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php $query = isset($_GET) && count($_GET) ? "?".http_build_query($_GET) :"" ; ?>
|
||||
<script>
|
||||
$('#fileCount').click(function(){
|
||||
$.ajax({
|
||||
'type': "POST",
|
||||
'url': "<?= $query ?>",
|
||||
'data': '',
|
||||
'success': function(data){
|
||||
$('#fileCount').after(data);
|
||||
$('#fileCount').remove();
|
||||
},
|
||||
'beforeSend':function(){
|
||||
$('#fileCount').html('正在加载...');
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
|
@ -572,4 +572,88 @@ class Status{
|
|||
return $rs->fetchAll();
|
||||
}
|
||||
|
||||
//为黑河计划项目服务的情况
|
||||
public function serviceTimes($type = "offline")
|
||||
{
|
||||
if($type == 'offline')
|
||||
{
|
||||
$arr = ['ts_approved IS NOT NULL'];
|
||||
}else{
|
||||
$arr = [];
|
||||
}
|
||||
|
||||
$fund = $this->makeConditionFound("project_id");
|
||||
if(!empty($fund))
|
||||
{
|
||||
$arr[] = $fund;
|
||||
}else{
|
||||
$select = "SELECT DISTINCT code FROM heiheproject";
|
||||
|
||||
$rs = $this->db->query($select);
|
||||
|
||||
$code_statck = [];
|
||||
|
||||
while($row = $rs->fetch())
|
||||
{
|
||||
$code_statck[] = $row['code'];
|
||||
}
|
||||
|
||||
$arr[] = " project_id IN ('".join("','" , $code_statck)."')";
|
||||
}
|
||||
|
||||
$wheresql = $this->makeWhereSql($arr);
|
||||
|
||||
|
||||
if($type == 'offline')
|
||||
$sql = "SELECT count(id) FROM offlineapp $wheresql";
|
||||
else
|
||||
$sql = "SELECT count(id) FROM onlineapp $wheresql";
|
||||
|
||||
$rs = $this->db->query($sql);
|
||||
|
||||
return $rs->fetchColumn(0);
|
||||
}
|
||||
|
||||
|
||||
//服务数据大小
|
||||
public function serviceFilesize($type = "offline")
|
||||
{
|
||||
if($type == 'offline')
|
||||
{
|
||||
$arr = ['off.ts_approved IS NOT NULL'];
|
||||
}else{
|
||||
$arr = [];
|
||||
}
|
||||
|
||||
$fund = $this->makeConditionFound("off.project_id");
|
||||
if(!empty($fund))
|
||||
{
|
||||
$arr[] = $fund;
|
||||
}else{
|
||||
$select = "SELECT DISTINCT code FROM heiheproject";
|
||||
|
||||
$rs = $this->db->query($select);
|
||||
|
||||
$code_statck = [];
|
||||
|
||||
while($row = $rs->fetch())
|
||||
{
|
||||
$code_statck[] = $row['code'];
|
||||
}
|
||||
|
||||
$arr[] = " off.project_id IN ('".join("','" , $code_statck)."')";
|
||||
}
|
||||
|
||||
$wheresql = $this->makeWhereSql($arr);
|
||||
|
||||
$sql = "SELECT SUM(md.filesize) /1024 as size FROM metadata md
|
||||
LEFT JOIN dataorder o ON o.uuid=md.uuid
|
||||
LEFT JOIN offlineapp off ON off.id = o.offlineappid
|
||||
$wheresql";
|
||||
|
||||
$rs = $this->db->query($sql);
|
||||
|
||||
return $rs->fetchColumn(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue