You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.6 KiB
PHP
54 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace app\index\controller;
|
|
|
|
use think\Controller;
|
|
use think\Db;
|
|
|
|
class LineEpa2 extends Controller {
|
|
|
|
public function index() {
|
|
if (empty($_GET['id']))
|
|
die('无效的编码');
|
|
$id = $_GET['id'];
|
|
$edate = date("Y-m-d");
|
|
$sdate = date('Y-m-d', strtotime("$edate -1 month"));
|
|
if (!empty($_GET['stime'])) {
|
|
$sdate = $_GET['stime'];
|
|
}
|
|
if (!empty($_GET['etime'])) {
|
|
$edate = substr($_GET['etime'], 0, 10);
|
|
}
|
|
$this->assign('id', $id);
|
|
$this->assign('edate', $edate);
|
|
$this->assign('sdate', $sdate);
|
|
return $this->fetch('line_epa2');
|
|
}
|
|
|
|
public function getjson() {
|
|
$edate = date("Y-m-d");
|
|
$sdate = date('Y-m-d', strtotime("$edate -1 month"));
|
|
if (empty($_GET['sid']))
|
|
return;
|
|
$sid = $_GET['sid'];
|
|
if (!empty($_GET['stime'])) {
|
|
$sdate = date('Y-m-d', strtotime($_GET['stime']));
|
|
}
|
|
if (!empty($_GET['etime'])) {
|
|
$edate = date('Y-m-d', strtotime($_GET['etime']));
|
|
$edate = date('Y-m-d', strtotime("$edate 1 day"));
|
|
}
|
|
$b = Db::query("select d_time,cmbugas,tmp,dew,mstppm from data_epa_h where eqmid='{$sid}' and d_time >'{$sdate}' and d_time<'{$edate}'");
|
|
foreach ($b as $k => $v) {
|
|
foreach ($v as $k1 => $v1) {
|
|
if ($k1 != 'd_time') {
|
|
$b[$k][$k1] = floatval($v1);
|
|
}
|
|
}
|
|
}
|
|
$data = json_encode($b);
|
|
echo $data;
|
|
}
|
|
|
|
}
|