首页 热门数据 修改为 最新数据集

This commit is contained in:
cuixin 2017-04-24 11:02:20 +08:00
parent d8adb0aacd
commit 24cc152742
2 changed files with 156 additions and 172 deletions

View File

@ -1,9 +1,7 @@
<?php <?php
class IndexController extends Zend_Controller_Action class IndexController extends Zend_Controller_Action {
{ function preDispatch () {
function preDispatch()
{
$this->view->config = Zend_Registry::get('config'); $this->view->config = Zend_Registry::get('config');
$this->db = Zend_Registry::get('db'); $this->db = Zend_Registry::get('db');
$this->view->theme = new Theme(); $this->view->theme = new Theme();
@ -13,8 +11,7 @@ class IndexController extends Zend_Controller_Action
//$this->view->main_nav_pageID = "index"; //$this->view->main_nav_pageID = "index";
} }
function indexAction() function indexAction () {
{
//统计数据 //统计数据
$sql = "select (select count(*) from users) as usernum,(select count(*) from {$this->submd}) as metanum, $sql = "select (select count(*) from users) as usernum,(select count(*) from {$this->submd}) as metanum,
(select count(distinct d.uuid) from dataorder d left join offlineapp f on d.offlineappid=f.id where d.uuid in (select uuid from meteorologymd) and d.ts_approved is not null and d.status in (0,5) ) as offlinenum, (select count(distinct d.uuid) from dataorder d left join offlineapp f on d.offlineappid=f.id where d.uuid in (select uuid from meteorologymd) and d.ts_approved is not null and d.status in (0,5) ) as offlinenum,
@ -29,15 +26,14 @@ class IndexController extends Zend_Controller_Action
$this->view->metanum=$row['count'];*/ $this->view->metanum=$row['count'];*/
$sql = "select sum(filesize) as sum,datatype from {$this->submd} group by datatype"; $sql = "select sum(filesize) as sum,datatype from {$this->submd} group by datatype";
$rows = $this->db->fetchAll($sql); $rows = $this->db->fetchAll($sql);
foreach($rows as $row) foreach ($rows as $row) {
{ if ($row['datatype']) $this->view->offlinesize = $row['sum']; else
if ($row['datatype'])
$this->view->offlinesize=$row['sum'];
else
$this->view->onlinesize = $row['sum']; $this->view->onlinesize = $row['sum'];
} }
//下载最多数据(top 5) //下载最多数据(top 5)
$sql = "select uuid,title,id from {$this->submd} where id in (select m.id from {$this->submd} m left join dataorder d on m.uuid=d.uuid where m.datatype=0 group by m.id order by count(d.uuid) desc limit 5)"; $sql = "select uuid,title,id from {$this->submd} where id in (select m.id from {$this->submd} m left join dataorder d on m.uuid=d.uuid where m.datatype=0 group by m.id order by count(d.uuid) desc limit 5)";
//最新数据
$sql = "select id,uuid,title,ts_created from {$this->submd} order by ts_created desc limit 5";
$this->db->setFetchMode(Zend_Db::FETCH_BOTH); $this->db->setFetchMode(Zend_Db::FETCH_BOTH);
$this->view->mdtop = $this->db->fetchAll($sql); $this->view->mdtop = $this->db->fetchAll($sql);
$sql = "select uuid,title,id from {$this->submd} where id in (select m.id from {$this->submd} m left join dataorder d on m.uuid=d.uuid where m.datatype=1 group by m.id order by count(d.uuid) desc limit 5)"; $sql = "select uuid,title,id from {$this->submd} where id in (select m.id from {$this->submd} m left join dataorder d on m.uuid=d.uuid where m.datatype=1 group by m.id order by count(d.uuid) desc limit 5)";
@ -58,8 +54,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'];
} }
@ -73,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

@ -4,9 +4,7 @@
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
?> ?>
</div><!-- 结束container容器实现banner全屏展示--> </div>
<!-- Carousel
================================================== -->
<div class="container-fluid1 "> <div class="container-fluid1 ">
<div id="myCarousel" class="carousel slide"> <div id="myCarousel" class="carousel slide">
<div class="carousel-inner"> <div class="carousel-inner">
@ -26,13 +24,11 @@
</div> </div>
</div> </div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev"></a> <a class="right carousel-control" href="#myCarousel" data-slide="next"></a> </div> <a class="left carousel-control" href="#myCarousel" data-slide="prev"></a>
<a class="right carousel-control" href="#myCarousel" data-slide="next"></a></div>
</div> </div>
<!-- /.carousel -->
<div class="container"> <div class="container">
<!-- Three columns of text below the carousel -->
<div class="row-fluid"> <div class="row-fluid">
<div class="span12"> <div class="span12">
<div class="span3"> <div class="span3">
@ -47,36 +43,32 @@
</ul> </ul>
</div> </div>
</div> </div>
<!-- /.span4 -->
<div class="span9"> <div class="span9">
<div class="box"> <div class="box">
<h4 class="box-title">新闻公告</h4> <h4 class="box-title">新闻公告</h4>
<ul> <ul>
<?php foreach ($this->list_news as $k => $v) { ?> <?php foreach ($this->list_news as $k => $v) { ?>
<li> <li>
[<?= date('Y-m-d',strtotime($v['ts_published'])) ?>]<a href="<?= $v['url'] ?>" title="<?= $v['title'] ?>"><i class=" icon-ok-sign"> </i><?= $v['title'] ?></a> [<?= date('Y-m-d', strtotime($v['ts_published'])) ?>]<a href="<?= $v['url'] ?>"
title="<?= $v['title'] ?>"><i
class=" icon-ok-sign"> </i><?= $v['title'] ?></a>
</li> </li>
<?php } ?> <?php } ?>
<span class="pull-right"><a href="/archives/" target="_blank" class="more">更多>></a></span> <span class="pull-right"><a href="/archives/" target="_blank" class="more">更多>></a></span>
</ul> </ul>
</div> </div>
</div> </div>
<!-- /.span4 -->
</div> </div>
<!-- /.row -->
<div style="margin-bottom:20px;"><img src="/sjyportal/img/protect.jpg" class="img-rounded"/></div> <div style="margin-bottom:20px;"><img src="/sjyportal/img/protect.jpg" class="img-rounded"/></div>
<!-- Three columns of text below the carousel -->
<div class="row-fluid"> <div class="row-fluid">
<!-- /.span4 -->
<div class="span4"> <div class="span4">
<div class="box"> <div class="box">
<h4 class="box-title">最新可视化数据</h4> <h4 class="box-title">最新可视化数据</h4>
<ul> <ul>
<?php foreach ($this->visualdata as $k => $v) { ?> <?php foreach ($this->visualdata as $k => $v) { ?>
<li> <li>
<a href="/data/<?= $v['uuid'] ?>" title="<?= $v['title'] ?>"><i class=" icon-map-marker"> </i><?= $v['title'] ?></a> <a href="/data/<?= $v['uuid'] ?>" title="<?= $v['title'] ?>"><i
class=" icon-map-marker"> </i><?= $v['title'] ?></a>
</li> </li>
<?php } ?> <?php } ?>
<span class="pull-right"><a href="/data/visual" target="_blank" class="more">更多>></a></span> <span class="pull-right"><a href="/data/visual" target="_blank" class="more">更多>></a></span>
@ -85,38 +77,36 @@
</div> </div>
<div class="span4"> <div class="span4">
<div class="box"> <div class="box">
<h4 class="box-title">热门在线数据集</h4> <h4 class="box-title">最新数据集</h4>
<ul> <ul>
<?php foreach ($this->mdtop as $k => $v) { ?> <?php foreach ($this->mdtop as $k => $v) { ?>
<li> <li>
<a href="/data/<?= $v['uuid'] ?>" title="<?= $v['title'] ?>"><i class=" icon-map-marker"> </i><?= $v['title'] ?></a> <a href="/data/<?= $v['uuid'] ?>" title="<?= $v['title'] ?>"><i
class=" icon-map-marker"> </i><?= $v['title'] ?></a>
</li> </li>
<?php } ?> <?php } ?>
<span class="pull-right"><a href="/data/onlinelist" target="_blank" class="more">更多>></a></span> <span class="pull-right"><a href="/data/onlinelist" target="_blank" class="more">更多>></a></span>
</ul> </ul>
</div> </div>
</div> </div>
<!-- /.span4 -->
<div class="span4"> <div class="span4">
<div class="box"> <div class="box">
<h4 class="box-title">热门离线数据集</h4> <h4 class="box-title">热门离线数据集</h4>
<ul> <ul>
<?php foreach ($this->offlinemdtop as $k => $v) { ?> <?php foreach ($this->offlinemdtop as $k => $v) { ?>
<li> <li>
<a href="/data/<?= $v['uuid'] ?>" title="<?= $v['title'] ?>"><i class=" icon-map-marker"> </i><?= $v['title'] ?></a> <a href="/data/<?= $v['uuid'] ?>" title="<?= $v['title'] ?>"><i
class=" icon-map-marker"> </i><?= $v['title'] ?></a>
</li> </li>
<?php } ?> <?php } ?>
<span class="pull-right"><a href="/data/offlinelist" target="_blank" class="more">更多>></a></span> <span class="pull-right">
<a href="/data/offlinelist" target="_blank" class="more">更多>></a>
</span>
</ul> </ul>
</div> </div>
</div> </div>
<!-- /.span4 -->
</div> </div>
<!-- /.row -->
</div> </div>
<!-- /.container -->
<script> <script>
!function ($) { !function ($) {
$(function () { $(function () {