共计 3003 个字符,预计需要花费 8 分钟才能阅读完成。
这个是多语言 wikipedia 百科网站源码开发 第二篇,后面讲了第一篇,有须要的敌人能够看我的博客主页就会看到的了,废话少说间接进入主题了。
不明确的能够问我就行。
这篇也是后盾局部的,是管理员板块
动静首页
public function index(){
$where = [];
$where[] = ['status','<>',-1];
$username = input('username');
// 搜寻条件
if (!empty(input('username'))) {$where[] = ['id|username','like',"%{$username}%"];
}
if(!is_root()){$where[] = ['role_id','<>',2];
}
$list = Db::name('manager')->where($where)->paginate(10);
$page = $list->render();
View::assign([
'list' => $list,
'page' => $page
]);
return View::fetch();}
public function status(){if(d('manager')->where('id',input('id'))->update(['status' => input('status')])){return $this->success('状态批改胜利');
}
return $this->error('状态批改失败');
}
管理员的增加页面
public function add(){
if(Request::isAjax()){$info = input('info/a');
$password = input('password');
$confirm_password = input('confirm_password');
if($password != $confirm_password){return $this->error('明码不统一');
}
$info['password'] = md5($password);
if(d('manager')->insert($info)){return $this->success('增加胜利');
}
return $this->error('增加失败');
}
$where = [];
if(!is_root()){$where[] = ['id','<>',2];
}
$list = d('role')->where($where)->select();
View::assign(['list' => $list]);
return View::fetch();}
管理员的增加页面
public function edit(){
if(Request::isAjax()){$id = input('id');
$info = input('info/a');
$password = input('password');
$confirm_password = input('confirm_password');
if($password != $confirm_password){return $this->error('明码不统一');
}
if($password != ''){$info['password'] = md5($password);
}
if(d('manager')->where('id',$id)->update($info)){return $this->success('批改胜利');
}
return $this->error('批改失败');
}
$where = [];
if(!is_root()){$where[] = ['id','<>',2];
}
$id = input('id');
$list = d('role')->where($where)->select();
$info = d('manager')->where('id',$id)->find();
View::assign([
'list' => $list,
'info' => $info
]);
return View::fetch();}
public function del(){$id = input('id');
if(d('manager')->where([['id','=',$id]])->delete(['status' => -1])){return json(['code' => 1, 'msg' => '删除胜利']);
}
return json(['code' => 0, 'msg' => '删除失败']);
}
管理员菜单治理
public function index(){
$where = [];
$where[] = ['status','<>',-1];
$username = input('username');
// 搜寻条件
if (!empty(input('username'))) {$where[] = ['id|username','like',"%{$username}%"];
}
if(!is_root()){$where[] = ['role_id','<>',2];
}
$list = Db::name('manager')->where($where)->paginate(10);
$page = $list->render();
View::assign([
'list' => $list,
'page' => $page
]);
return View::fetch();}
public function status(){if(d('manager')->where('id',input('id'))->update(['status' => input('status')])){return $this->success('状态批改胜利');
}
return $this->error('状态批改失败');
}
public function index(){
$status = input('status','');
$where = [];
$where[] = ['status','<>',-1];
if($status != ''){$where[] = ['status','=',$status];
}
$list = d('menu')->where($where)->order('sort,id asc')->select()->toArray();
$list = Cate::toLevel($list);
View::assign(['list'=>$list]);
return View::fetch();}
public function status(){if(d('menu')->where('id',input('id'))->update(['status' => input('status')])){return $this->success('状态批改胜利');
}
return $this->error('状态批改失败');
}
public function sort(){if(d('menu')->where('id',input('id'))->update(['sort' => input('status')])){return $this->success('批改胜利');
}
return $this->error('批改失败');
}
正文完