Warning.php
2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
namespace app\equipment\controller;
use app\common\controller\Frontend;
use \think\Request;
use think\Db;
class Warning extends Frontend
{
protected $noNeedLogin = [];
protected $noNeedRight = '*';
protected $layout = '';
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\reservoir\hkws\Warning();
}
public function list()
{
$res = \think\Db::name('reservoir_threshold')->select();
$this->view->assign('list',$res);
return $this->view->fetch();
}
public function edit()
{
if($this->request->isPost()){
$data =[
"waterrain" => Request::instance()->post('waterrain'),
"waterlevel" => Request::instance()->post('waterlevel'),
"waterstorage" => Request::instance()->post('waterstorage'),
"waterput" => Request::instance()->post('waterput'),
"waterout" => Request::instance()->post('waterout'),
"damhd" => Request::instance()->post('damhd'),
"damvd" => Request::instance()->post('damvd'),
"damsd" => Request::instance()->post('damsd'),
"damleakage" => Request::instance()->post('damleakage'),
"dampressure" => Request::instance()->post('dampressure')
];
$result = Db::name('reservoir_threshold')->where('id', 0)->update($data);
if(!$result){
$this->error('数据没有更新');
}
$this->success('添加成功');
}
}
public function record()
{
$name =Request::instance()->param('name');
$list = $this->model
->alias('w')
->field('w.scode,w.createtime,w.type,r.name as rname,r.user_name,h.type as htype,h.name as hname')
->join('reservoir_list r','r.id=w.reservoir_id','LEFT')
->join('reservoir_hkws_hardware h','h.scode=w.scode','LEFT')
->where('h.name','like','%'.$name.'%')
->paginate();
$this->view->assign('list',$list);
return $this->view->fetch();
}
}