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'); } } ?>