调整数据可视化命名空间内部结构

This commit is contained in:
Li Jianxuan 2014-05-22 02:44:18 +00:00
parent 483da847cd
commit c986d6c535
3 changed files with 22 additions and 11 deletions

View File

@ -40,7 +40,7 @@ class Sc extends Record implements RecordInterface
public function getData() public function getData()
{ {
$sql = "SELECT * FROM datasands $sql = "SELECT * FROM data_sands
ORDER BY ORDER BY
year ASC, year ASC,
month ASC month ASC

View File

@ -52,9 +52,10 @@ class SoilMoisture extends Record implements RecordInterface
WHERE WHERE
$this->subset > 0 $this->subset > 0
ORDER BY ORDER BY
extract(year from \"timestamp\"), extract(year from \"timestamp\") ASC,
extract(month from \"timestamp\"), extract(month from \"timestamp\") ASC,
extract(day from \"timestamp\") extract(day from \"timestamp\") ASC,
extract(hour from \"timestamp\") ASC
"; ";
//exit($sql); //exit($sql);
$rs = $this->db->query($sql); $rs = $this->db->query($sql);

View File

@ -4,9 +4,24 @@ namespace Westdc\Visual;
class Record class Record
{ {
public $db;
function __construct($recordType) function __construct($recordType)
{ {
$this->db = \Zend_Registry::get('db'); $this->initDatabase();
}
public function initDatabase()
{
$config = \Zend_Registry::get('config');
$dsn = "pgsql:host={$config->visual_db->hostname};"
."port={$config->visual_db->port};"
."dbname={$config->visual_db->database};"
."user={$config->visual_db->username};"
."password={$config->visual_db->password}";
$this->db = new \PDO($dsn);
} }
public function makeSql($table,$index,$fieldValue,$fieldTime) public function makeSql($table,$index,$fieldValue,$fieldTime)
@ -24,11 +39,6 @@ class Record
return $rs; return $rs;
} }
public function prepareData()
{
}
public function utcMsTime($time=''){ public function utcMsTime($time=''){
if(empty($time)) if(empty($time))
return (time()+8*3600)*1000; return (time()+8*3600)*1000;