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.3 KiB
PHTML

2 years ago
<?php
namespace app\admin\controller;
use think\Controller;
use think\Db;
class Hwsb extends Common
{
public function lst($id)
{
$hwsbid= $id;
session('hwsbid',$hwsbid);
$list=Db::query("select * from hwsb where hwsbid= {$hwsbid}");
$this->assign('list',$list);
$this->assign('hwsbid',$hwsbid);
return $this->fetch();
}
public function add($id)
{
if (request()->isPost()){
$data = input('post.');
$data['hwsbid']=$id;
if(db('hwsb')->insert($data)){
return $this->success('添加红外设备信息成功!',url('lst',array('id'=>$id)));
}
else {
return $this->error('添加红外设备信息失败!');
}
}
return $this->fetch();
}
public function edit($id){
$hwsb=db('hwsb')->where('id',$id)->find();
if(request()->ispost()){
$data = input('post.');
$data['hwsbid']=session('hwsbid');
$save=db('hwsb')->where('id',$id)->update($data);
if($save !== false){
$this->success('修改红外设备信息成功!',url('lst',array('id'=>session('hwsbid'))));
}else{
$this->error('修改红外设备信息失败!');
}
}
$this->assign('hwsb',$hwsb);
return $this->fetch();
}
public function del($id){
if(db('hwsb')->delete($id)){
$this->success('删除红外设备信息成功!',url('lst',array('id'=>session('hwsbid'))));
}else{
$this->error('删除红外设备信息失败!');
}
}
}
?>