212 lines
7.3 KiB
PHP
212 lines
7.3 KiB
PHP
<?php
|
|
class Admin_StatController extends Zend_Controller_Action
|
|
{
|
|
function preDispatch()
|
|
{
|
|
$this->db=Zend_Registry::get('db');
|
|
$this->view->config = Zend_Registry::get('config');
|
|
$this->messenger=$this->_helper->getHelper('FlashMessenger');
|
|
$this->view->messages = $this->messenger->getMessages();
|
|
}
|
|
function postDispatch()
|
|
{
|
|
$this->view->messages = $this->messenger->getMessages();
|
|
}
|
|
function indexAction()
|
|
{
|
|
|
|
//用户总量
|
|
$sql = "select count(id) as num from users";
|
|
$re = $this->db->query($sql);
|
|
$alluser= $re->fetch();
|
|
|
|
$this->view->alluser=$alluser;
|
|
|
|
//所有数据
|
|
$sql = "select count(id) as num from metadata";
|
|
$re = $this->db->query($sql);
|
|
$alldata=$re->fetch();
|
|
|
|
$this->view->alldata=$alldata;
|
|
|
|
//数据下载总量 通过dataorder统计??
|
|
$sql = "select count(id) as num from dataorder";
|
|
$re = $this->db->query($sql);
|
|
$alldown=$re->fetch();
|
|
|
|
$this->view->alldown=$alldown;
|
|
|
|
//已通过的离线申请个数
|
|
$sql = "select count(id) as num from dataorder where offlineappid>0 and status>4";
|
|
$re = $this->db->query($sql);
|
|
$allpass = $re->fetch();
|
|
|
|
$this->view->allpass = $allpass;
|
|
|
|
//未通过的离线申请个数
|
|
$sql="select count(id) as num from dataorder where offlineappid>0 and status<4";
|
|
$re = $this->db->query($sql);
|
|
$nopass = $re->fetch();
|
|
|
|
$this->view->nopass = $nopass;
|
|
|
|
//在线下载点击次数
|
|
$sql="select count(id) as num from onlineapp";
|
|
$re = $this->db->query($sql);
|
|
$onlinedown = $re->fetch();
|
|
|
|
$this->view->onlinedown = $onlinedown;
|
|
|
|
//各单位下载情况
|
|
$sql = "select count(d.id) as num,o.unit from dataorder d
|
|
left join offlineapp o on o.id=d.offlineappid
|
|
where d.offlineappid>0 and o.unit is not null and d.status>4
|
|
group by o.unit";
|
|
$fe = $this->db->query($sql);
|
|
$unitoffline = $fe->fetchAll();
|
|
|
|
$this->view->unitoffline = $unitoffline;
|
|
|
|
//各单位在线下载情况
|
|
$sql = "select count(d.id) as num,o.unit from dataorder d
|
|
left join onlineapp o on o.id=d.onlineappid
|
|
where d.onlineappid>0 and o.unit is not null
|
|
group by o.unit";
|
|
$fe = $this->db->query($sql);
|
|
$unitonline = $fe->fetchAll();
|
|
|
|
$this->view->unitonline = $unitonline;
|
|
|
|
//下载量统计
|
|
$sql = "select sum(num) as num from (select m.filesize/1024 as num,m.title,d.userid from dataorder d left join metadata m on d.uuid=m.uuid where (d.status=0 or d.status=5) and m.filesize>0 group by m.title,d.userid,m.filesize) as t";
|
|
$res = $this->db->query($sql);
|
|
$allsize = $res->fetch();
|
|
$this->view->allsize = $allsize;
|
|
|
|
$sql = "select sum(num) as num from (select m.filesize/1024 as num,m.title,d.userid from dataorder d left join metadata m on d.uuid=m.uuid where d.status=5 and m.filesize>0 group by m.title,d.userid,m.filesize) as t";
|
|
$res = $this->db->query($sql);
|
|
$offlinesize = $res->fetch();
|
|
$this->view->offlinesize = $offlinesize;
|
|
|
|
$sql = "select sum(num) as num from (select m.filesize/1024 as num,m.title,d.userid from dataorder d left join metadata m on d.uuid=m.uuid where d.status=0 and m.filesize>0 group by m.title,d.userid,m.filesize) as t";
|
|
$res = $this->db->query($sql);
|
|
$onlinesize = $res->fetch();
|
|
$this->view->onlinesize = $onlinesize;
|
|
|
|
$sql="select sum(configvalue::real)/1024/1024/1024 as num from g6ftpusersettings where userid in (select id from g6ftpusers where name like 'westdc%' or name='newwestdc') and configname='StatsDownloaded'";
|
|
$res = $this->db->query($sql);
|
|
$onlinesize = $res->fetch();
|
|
$this->view->onlineg6size = $onlinesize;
|
|
|
|
|
|
}//indexAction 首页
|
|
|
|
function unitAction()
|
|
{
|
|
$sql="";
|
|
}//分单位统计
|
|
|
|
function awstatswebAction()
|
|
{
|
|
|
|
}//awstats web 统计
|
|
|
|
function awstatsftpAction()
|
|
{
|
|
|
|
}//awstats ftp 统计
|
|
|
|
function webalizerAction()
|
|
{
|
|
|
|
}//webalizer 统计
|
|
|
|
function waterAction()
|
|
{
|
|
|
|
$sql="select count(k.keyword) as num,d.status,k.keyword from dataorder d left join metadata m on d.uuid=m.uuid
|
|
left join keyword k on m.id=k.id
|
|
where (d.status=5 or d.status=-1) and m.source='0595169a-279e-4b95-819f-129d0ba4280d'
|
|
and (k.keyword='航空遥感' or k.keyword='卫星遥感' or k.keyword='气象水文' or k.keyword='上游寒区水文试验区' or k.keyword='森林水文试验区' or k.keyword='中游干旱区水文试验区')
|
|
group by k.keyword,d.status order by k.keyword desc,d.status desc";
|
|
|
|
$re =$this->db->query($sql);
|
|
$type =$re->fetchAll();//按分类
|
|
|
|
$this->view->type = $type;
|
|
|
|
$sql="select count(extract(month from o.ts_created)) as c,extract(month from o.ts_created) as m,extract(year from o.ts_created) as y
|
|
from offlineapp o left join dataorder d on d.offlineappid=o.id left join metadata m on m.uuid=d.uuid
|
|
where m.source='0595169a-279e-4b95-819f-129d0ba4280d' and (d.status=3 or d.status=5 or d.status=-1)
|
|
group by extract(month from o.ts_created),extract(year from o.ts_created)
|
|
order by extract(year from o.ts_created),extract(month from o.ts_created)";
|
|
|
|
$re=$this->db->query($sql);
|
|
$month=$re->fetchAll();
|
|
|
|
$this->view->month = $month;
|
|
|
|
$sql = "select
|
|
extract(year from o.ts_created) as y,extract(month from o.ts_created) as m,
|
|
count(extract(month from o.ts_created)) as c
|
|
from
|
|
(select distinct(o.id),o.ts_created
|
|
from offlineapp o where o.datalist like '%黑河综合遥感联合试验%') as o
|
|
group by extract(month from o.ts_created),extract(year from o.ts_created)
|
|
order by extract(year from o.ts_created),extract(month from o.ts_created)";
|
|
|
|
$re=$this->db->query($sql);
|
|
$order=$re->fetchAll();
|
|
|
|
$this->view->order = $order;
|
|
|
|
$sql = "select (sum(m.filesize)/1024) as n from dataorder d left join metadata m on d.uuid=m.uuid
|
|
where d.status=5 and m.source='0595169a-279e-4b95-819f-129d0ba4280d'";
|
|
|
|
$re=$this->db->query($sql);
|
|
$num=$re->fetchAll();
|
|
|
|
$this->view->num=$num;
|
|
|
|
|
|
$sql = "select count(lower(o.unit)) as c,lower(o.unit) as u
|
|
from offlineapp o left join dataorder d on d.offlineappid=o.id left join metadata m on m.uuid=d.uuid
|
|
where m.source='0595169a-279e-4b95-819f-129d0ba4280d' and (d.status=5)
|
|
group by lower(o.unit)
|
|
order by lower(o.unit)";
|
|
|
|
$re=$this->db->query($sql);
|
|
$units=$re->fetchAll();
|
|
|
|
$this->view->units=$units;
|
|
|
|
|
|
$sql = "select count(t.unit) as c,t.unit from
|
|
(select distinct(o.id),o.unit
|
|
from offlineapp o left join dataorder d on d.offlineappid=o.id left join metadata m on m.uuid=d.uuid
|
|
where m.source='0595169a-279e-4b95-819f-129d0ba4280d' and (d.status=5)
|
|
) as t
|
|
group by t.unit";
|
|
|
|
$re = $this->db->query($sql);
|
|
$ounit= $re->fetchAll();
|
|
|
|
$this->view->ounit = $ounit;
|
|
|
|
//water 项目按月统计下载量
|
|
$sql = "select (sum(m.filesize)/1024) as n,extract(month from d.ts_created) as m,extract(year from d.ts_created) as y from dataorder d left join metadata m on d.uuid=m.uuid
|
|
where d.status=5 and m.source='0595169a-279e-4b95-819f-129d0ba4280d'
|
|
group by extract(month from d.ts_created),extract(year from d.ts_created)
|
|
order by extract(year from d.ts_created),extract(month from d.ts_created)";
|
|
|
|
$re = $this->db->query($sql);
|
|
$dm = $re->fetchAll();
|
|
|
|
$this->view->dm = $dm;
|
|
|
|
|
|
}//WATER项目
|
|
|
|
}
|
|
|