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.
65 lines
1.2 KiB
PHP
65 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller;
|
|
use think\Controller;
|
|
use think\Db;
|
|
class Jg extends Common
|
|
{
|
|
public function lst()
|
|
{
|
|
$list=Db::query("select * from vw_jg ");
|
|
$this->assign('list',$list);
|
|
return $this->fetch();
|
|
}
|
|
public function add()
|
|
{
|
|
$list=Db::query("select id,mc from bdz ");
|
|
if (request()->isPost()){
|
|
$data = input('post.');
|
|
if(db('jg')->insert($data)){
|
|
return $this->success('ok','lst');
|
|
}
|
|
else {
|
|
return $this->error('false');
|
|
}
|
|
return ;
|
|
}
|
|
$this->assign('bdzs',$list);
|
|
return $this->fetch();
|
|
}
|
|
public function edit(){
|
|
$id=input('id');
|
|
$jgs=db('jg')->find($id);
|
|
$list=Db::query("select id,mc from bdz ");
|
|
if(request()->ispost()){
|
|
$data=[
|
|
'id'=>input('id'),
|
|
'mc'=>input('mc'),
|
|
'bdzid'=>input('bdzid'),
|
|
];
|
|
$save=db('jg')->update($data);
|
|
if($save !== false){
|
|
$this->success('修改设备间隔成功!','lst');
|
|
}else{
|
|
$this->error('修改设备间隔失败!');
|
|
}
|
|
return;
|
|
}
|
|
$this->assign('jgs',$jgs);
|
|
$this->assign('bdzs',$list);
|
|
return $this->fetch();
|
|
}
|
|
public function del(){
|
|
$id=input('id');
|
|
if(db('jg')->delete(input('id'))){
|
|
$this->success('删除设备间隔成功!','lst');
|
|
}else{
|
|
$this->error('删除设备间隔失败!');
|
|
}
|
|
}
|
|
public function logout(){
|
|
session(null);
|
|
$this->success('退出成功!','Login/index');
|
|
}
|
|
}
|
|
?>
|