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.
60 lines
1.0 KiB
PHP
60 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller;
|
|
use think\Controller;
|
|
use think\Db;
|
|
class Lx extends Common
|
|
{
|
|
public function lst()
|
|
{
|
|
$list=Db::name('lx')->paginate(15);
|
|
$this->assign('list',$list);
|
|
return $this->fetch();
|
|
}
|
|
public function add()
|
|
{
|
|
if (request()->isPost()){
|
|
$data = input('post.');
|
|
if(db('lx')->insert($data)){
|
|
return $this->success('ok','lst');
|
|
}
|
|
else {
|
|
return $this->error('false');
|
|
}
|
|
return ;
|
|
}
|
|
return $this->fetch();
|
|
}
|
|
public function edit(){
|
|
$id=input('id');
|
|
$lxs=db('lx')->find($id);
|
|
if(request()->ispost()){
|
|
$data=[
|
|
'id'=>input('id'),
|
|
'mc'=>input('mc'),
|
|
];
|
|
$save=db('lx')->update($data);
|
|
if($save !== false){
|
|
$this->success('修改设备类型成功!','lst');
|
|
}else{
|
|
$this->error('修改设备类型失败!');
|
|
}
|
|
return;
|
|
}
|
|
$this->assign('lxs',$lxs);
|
|
return $this->fetch();
|
|
}
|
|
public function del(){
|
|
$id=input('id');
|
|
if(db('lx')->delete(input('id'))){
|
|
$this->success('删除设备类型成功!','lst');
|
|
}else{
|
|
$this->error('删除设备类型失败!');
|
|
}
|
|
}
|
|
public function logout(){
|
|
session(null);
|
|
$this->success('退出成功!','Login/index');
|
|
}
|
|
}
|
|
?>
|