$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';
$row=$this->db->fetchRow($sql);
$this->view->usernum=$row['usernum'];
$this->view->metanum=$row['metanum'];
$this->view->offlinenum=$row['offlinenum'];
/*$sql='select count(*) from metadata';
$row=$this->db->fetchRow($sql);
$this->view->metanum=$row['count'];*/
$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";
$sql="select uuid,title,id from sjynpmetadata where id in (select m.id from normalmetadata m left join dataorder d on m.uuid=d.uuid group by m.id order by count(d.uuid) desc limit 8)";
$sql="select uuid,title,id,description from sjynpmetadata where id in (select m.id from normalmetadata m left join dataorder d on m.uuid=d.uuid group by m.id order by id desc limit 4)";
$sql="SELECT * FROM archive WHERE is_pub=true AND ts_published<'$time' AND image IS NOT NULL AND image != '' and id in (select ar_catalog.aid from ar_category left join ar_catalog on ar_category.id=ar_catalog.cid where ar_category.code='banner') order by ts_published asc LIMIT 5";
$sql="SELECT * FROM archive WHERE is_pub=true AND ts_published<now() AND image IS NOT NULL AND image != '' and id in (select ar_catalog.aid from ar_catalog left join ar_category on ar_catalog.cid=ar_category.id where ar_category.id in(4,17)) order by ts_published desc LIMIT 12 ";
$sql="select d.*,m.ts_published as publish_year from datadoi d left join sjynpmetadata m on d.uuid=m.uuid where length(d.title)>1 and d.ts_published is not null order by ts_published desc limit 5";