39 lines
778 B
PHP
39 lines
778 B
PHP
<?php
|
|
namespace Westdc\Visual;
|
|
|
|
class Record
|
|
{
|
|
|
|
function __construct($recordType)
|
|
{
|
|
$this->db = \Zend_Registry::get('db');
|
|
}
|
|
|
|
public function makeSql($table,$index,$fieldValue,$fieldTime)
|
|
{
|
|
$sql = "SELECT
|
|
\"$index\" as \"index\", \"$fieldValue\" as \"value\", \"$fieldTime\" as \"time\"
|
|
FROM \"$table\"
|
|
ORDER BY
|
|
extract(year from \"$fieldTime\") ASC,
|
|
extract(month from \"$fieldTime\") ASC,
|
|
extract(day from \"$fieldTime\") ASC,
|
|
extract(hour from \"$fieldTime\") ASC
|
|
";
|
|
|
|
$rs = $this->db->query($sql);
|
|
return $rs;
|
|
}
|
|
|
|
public function prepareData()
|
|
{
|
|
|
|
}
|
|
|
|
public function utcMsTime($time=''){
|
|
if(empty($time))
|
|
return (time()+8*3600)*1000;
|
|
else
|
|
return $time*1000;
|
|
}
|
|
}
|