update latest data

This commit is contained in:
avene 2018-06-27 10:19:14 +08:00
parent b1e8e067d4
commit 8ba677c3dc
2 changed files with 76 additions and 77 deletions

View File

@ -24,8 +24,7 @@ class IndexController extends Zend_Controller_Action
$this->view->metanum=$row['count'];*/ $this->view->metanum=$row['count'];*/
$sql = "select sum(filesize) as sum,datatype from metadata group by datatype"; $sql = "select sum(filesize) as sum,datatype from metadata group by datatype";
$rows = $this->db->fetchAll($sql); $rows = $this->db->fetchAll($sql);
foreach($rows as $row) foreach ($rows as $row) {
{
if ($row['datatype']) if ($row['datatype'])
$this->view->offlinesize = $row['sum']; $this->view->offlinesize = $row['sum'];
else else
@ -40,6 +39,8 @@ class IndexController extends Zend_Controller_Action
$this->view->mdtop = $this->db->fetchAll($sql); $this->view->mdtop = $this->db->fetchAll($sql);
$sql = "select uuid,title,id,description from normalmetadata 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 uuid,title,id,description from normalmetadata 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)";
$this->view->offlinemdtop = $this->db->fetchAll($sql); $this->view->offlinemdtop = $this->db->fetchAll($sql);
$sql = "select uuid,title,id,description from normalmetadata where id in (select m.id from normalmetadata m left join thumbnail t on m.id=t.id where t.data !=''group by m.id order by id desc limit 4)";
$this->view->latestdata = $this->db->fetchAll($sql);
$sql = "select m.uuid,m.title,m.id,m.description from normalmetadata m left join thumbnail t on m.id=t.id where length(t.data)>2 order by random()"; $sql = "select m.uuid,m.title,m.id,m.description from normalmetadata m left join thumbnail t on m.id=t.id where length(t.data)>2 order by random()";
$this->view->mdrandom = $this->db->fetchRow($sql); $this->view->mdrandom = $this->db->fetchRow($sql);
//搜索 //搜索
@ -55,8 +56,7 @@ class IndexController extends Zend_Controller_Action
$sth = $this->db->query($sql); $sth = $this->db->query($sql);
$rows = $sth->fetchAll(PDO::FETCH_BOTH); $rows = $sth->fetchAll(PDO::FETCH_BOTH);
foreach($rows as $k=>$v) foreach ($rows as $k => $v) {
{
$url = $News->getArchiveUrlByCid($v['id']); $url = $News->getArchiveUrlByCid($v['id']);
$rows[$k]['url'] = $url['archive_url']; $rows[$k]['url'] = $url['archive_url'];
} }
@ -68,8 +68,7 @@ class IndexController extends Zend_Controller_Action
$sth = $this->db->query($sql); $sth = $this->db->query($sql);
$rows = $sth->fetchAll(PDO::FETCH_BOTH); $rows = $sth->fetchAll(PDO::FETCH_BOTH);
foreach($rows as $k=>$v) foreach ($rows as $k => $v) {
{
$url = $News->getArchiveUrlByCid($v['id']); $url = $News->getArchiveUrlByCid($v['id']);
$rows[$k]['url'] = $url['archive_url']; $rows[$k]['url'] = $url['archive_url'];
$rows[$k]['type_title'] = $url['type_title']; $rows[$k]['type_title'] = $url['type_title'];

View File

@ -29,7 +29,7 @@ $this->headLink()->appendStylesheet('/static-sanjy-np/css/index.css');
<h6 class="title title1">最新数据</h6> <h6 class="title title1">最新数据</h6>
<a href="/data" class="more">查看更多>></a> <a href="/data" class="more">查看更多>></a>
<div class="row"> <div class="row">
<?php foreach ($this->offlinemdtop as $i => $md) : ?> <?php foreach ($this->latestdata as $i => $md) : ?>
<div class="col-md-3 col-sm-6 col-xs-6 iw4-item"> <div class="col-md-3 col-sm-6 col-xs-6 iw4-item">
<div class="team-wrap text-center"> <div class="team-wrap text-center">
<div class="team-img"> <div class="team-img">