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.

67 lines
1.3 KiB
PHP

<?php
namespace app\admin\controller;
use think\Controller;
use think\Db;
class Bdz extends Common
{
public function lst()
{
$list=Db::query("select * from bdz ");
$this->assign('list',$list);
return $this->fetch();
}
public function add()
{
if (request()->isPost()){
$data = input('post.');
if(db('bdz')->insert($data)){
return $this->success('ok','lst','',1);
}
else {
return $this->error('false',null,'',1);
}
return ;
}
return $this->fetch();
}
public function edit(){
$id=input('id');
$bdzs=db('bdz')->find($id);
if(request()->ispost()){
$data=[
'id'=>input('id'),
'mc'=>input('mc'),
'ztjcid'=>input('ztjcid'),
'hascac'=>input('hascac'),
'coordinate'=>input('coordinate'),
'voltagegrade'=>input('voltagegrade'),
'scale'=>input('scale'),
'note'=>input('note'),
'svgurl'=>input('svgurl'),
];
$save=db('bdz')->update($data);
if($save !== false){
$this->success('修改电站成功!','lst','',1);
}else{
$this->error('修改电站失败!',null,'',1);
}
return;
}
$this->assign('bdzs',$bdzs);
return $this->fetch();
}
public function del(){
$id=input('id');
if(db('bdz')->delete(input('id'))){
$this->success('删除电站成功!','lst','',1);
}else{
$this->error('删除电站失败!',null,'',1);
}
}
public function logout(){
session(null);
$this->success('退出成功!','Login/index','',1);
}
}
?>