2018-06-27 07:54:38 +00:00
|
|
|
<?php
|
|
|
|
use Helpers\View as view;
|
|
|
|
|
|
|
|
class ObserveController extends Zend_Controller_Action
|
|
|
|
{
|
|
|
|
private $limit=10;
|
|
|
|
|
|
|
|
function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
|
|
|
|
{
|
|
|
|
parent::__construct($request, $response, $invokeArgs);
|
|
|
|
$this->_helper->layout->setLayout('layout-sanji');
|
|
|
|
}
|
|
|
|
|
2018-07-18 09:56:59 +00:00
|
|
|
public function jsonexit($data){
|
|
|
|
$this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-06-27 07:54:38 +00:00
|
|
|
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();
|
|
|
|
$this->view->theme = new Theme();
|
|
|
|
$this->view->main_nav_pageID = "data";
|
|
|
|
|
|
|
|
$this->view->nav = array(
|
|
|
|
array('link'=>'/','title'=>'首页'),
|
|
|
|
array('link'=>'/data','title'=>$this->view->config->title->data),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function indexAction()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2018-07-18 09:56:59 +00:00
|
|
|
|
|
|
|
function dataAction(){
|
|
|
|
$this->_helper->viewRenderer->setNoRender();
|
|
|
|
$this->_helper->layout->disableLayout();
|
|
|
|
$db = Zend_Db::factory($this->view->config->data);
|
|
|
|
|
|
|
|
$variable = $this->_getParam('variable');
|
|
|
|
|
|
|
|
|
|
|
|
$sql = "SELECT \"$variable\", \"date\" FROM guoluo_atomsphere WHERE \"$variable\"!='-99999' ORDER BY date ASC";
|
|
|
|
$stmt = $db->query($sql);
|
|
|
|
$stmt->setFetchMode(Zend_Db::FETCH_NUM);
|
|
|
|
$result = $stmt->fetchAll();
|
|
|
|
|
|
|
|
$this->jsonexit($result);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-06-27 07:54:38 +00:00
|
|
|
}
|