$sql='select (select count(*) from users) as usernum,(select count(*) from metadata) as metanum,(select count(*) from offlineapp where ts_approved is not null ) as offlinenum';
$sql="select sum(filesize) as sum,datatype from metadata group by datatype";
$rows=$this->db->fetchAll($sql);
foreach($rowsas$row)
{
if($row['datatype'])
$this->view->offlinesize=$row['sum'];
else
$this->view->onlinesize=$row['sum'];
}
//特色推荐
$sql="select * from datafeature order by id desc";
$this->view->feature=$this->db->fetchRow($sql);
//特色数据集
$sql="select * from datasetcd order by id desc";
$this->view->datasetcd=$this->db->fetchRow($sql);
//下载最多数据(top 5)
$sql="select uuid,title,id from metadata where id in (select m.id from metadata m left join dataorder d on m.uuid=d.uuid group by m.id order by count(d.uuid) desc limit 5)";