修改含沙量数据读取方式

This commit is contained in:
Li Jianxuan 2014-05-28 08:45:29 +00:00
parent 175bd3c5bd
commit 552291bac7
9 changed files with 158 additions and 72 deletions

View File

@ -1,71 +1,71 @@
<?php
//含沙量
//Sediment Concentration
namespace Westdc\Visual\Reader;
use Westdc\Visual\Record;
use Westdc\Visual\RecordInterface;
class Sc extends Record implements RecordInterface
{
function __construct()
{
parent::__construct(__CLASS__);
}
public $subset;
public function switchDataset()
{
if(empty($this->subset))
{
$this->subset = "avg_sand";
return;
}
switch($this->subset){
case "avg":
$this->subset = "avg_sand";
break;
case "max" :
$this->subset = "max_sand";
break;
case "min" :
$this->subset = "min_sand";
break;
}
return;
}
public function getData()
{
$sql = "SELECT * FROM data_sands
ORDER BY
year ASC,
month ASC
";
$rs = $this->db->query($sql);
return $rs;
}
public function outPut()
{
$this->switchDataset();
$rs = $this->getData();
$data = array();
while($row = $rs->fetch())
{
$row['utctime'] = $this->utcMsTime(mktime(0,0,0,$row['month'],0,$row['year']));
$data[] = array($row['utctime'],$row[$this->subset]);
}
return $data;
}
<?php
//含沙量
//Sediment Concentration
namespace Westdc\Visual\Reader;
use Westdc\Visual\Record;
use Westdc\Visual\RecordInterface;
class Sc extends Record implements RecordInterface
{
function __construct()
{
parent::__construct(__CLASS__);
}
public $subset;
public function switchDataset()
{
if(empty($this->subset))
{
$this->subset = "avg_sand";
return;
}
switch($this->subset){
case "avg":
$this->subset = "avg_sand";
break;
case "max" :
$this->subset = "max_sand";
break;
case "min" :
$this->subset = "min_sand";
break;
}
return;
}
public function getData()
{
$sql = "SELECT * FROM data_sands
ORDER BY
year ASC,
month ASC
";
$rs = $this->db->query($sql);
return $rs;
}
public function outPut()
{
$this->switchDataset();
$rs = $this->getData();
$data = array();
while($row = $rs->fetch())
{
$row['utctime'] = $this->utcMsTime(mktime(0,0,0,$row['month'],0,$row['year']));
$data[] = array($row['utctime'],$row[$this->subset]);
}
return $data;
}
}

View File

@ -5,13 +5,15 @@ namespace Westdc\Visual\Reader;
use Westdc\Visual\Record;
use Westdc\Visual\RecordInterface;
class SoilMoisture extends Record implements RecordInterface
abstract class SoilMoisture extends Record implements RecordInterface
{
function __construct()
{
parent::__construct(__CLASS__);
}
public $tablename;
public $subset;
public function switchDataset()
@ -47,7 +49,7 @@ class SoilMoisture extends Record implements RecordInterface
{
$this->switchDataset();
$sql = "SELECT * FROM data_watercontent
$sql = "SELECT * FROM {$this->tablename}
WHERE
$this->subset > 0
ORDER BY

View File

@ -0,0 +1,12 @@
<?php
//土壤水分
namespace Westdc\Visual\Reader;
class SoilMoisture2007 extends SoilMoisture
{
function __construct()
{
parent::__construct();
$this->tablename = "data_watercontent2007";
}
}

View File

@ -0,0 +1,12 @@
<?php
//土壤水分
namespace Westdc\Visual\Reader;
class SoilMoisture2008 extends SoilMoisture
{
function __construct()
{
parent::__construct();
$this->tablename = "data_watercontent2008";
}
}

View File

@ -0,0 +1,12 @@
<?php
//土壤水分
namespace Westdc\Visual\Reader;
class SoilMoisture2009 extends SoilMoisture
{
function __construct()
{
parent::__construct();
$this->tablename = "data_watercontent2009";
}
}

View File

@ -0,0 +1,12 @@
<?php
//土壤水分
namespace Westdc\Visual\Reader;
class SoilMoisture2010 extends SoilMoisture
{
function __construct()
{
parent::__construct();
$this->tablename = "data_watercontent2010";
}
}

View File

@ -0,0 +1,12 @@
<?php
//土壤水分
namespace Westdc\Visual\Reader;
class SoilMoisture2011 extends SoilMoisture
{
function __construct()
{
parent::__construct();
$this->tablename = "data_watercontent2011";
}
}

View File

@ -0,0 +1,12 @@
<?php
//土壤水分
namespace Westdc\Visual\Reader;
class SoilMoisture2012 extends SoilMoisture
{
function __construct()
{
parent::__construct();
$this->tablename = "data_watercontent2012";
}
}

View File

@ -0,0 +1,12 @@
<?php
//土壤水分
namespace Westdc\Visual\Reader;
class SoilMoisture2013 extends SoilMoisture
{
function __construct()
{
parent::__construct();
$this->tablename = "data_watercontent2013";
}
}