当前位置:网站首页>Multilingual Wikipedia website source code development part II
Multilingual Wikipedia website source code development part II
2022-07-04 09:05:00 【qq_ thirty-four million four hundred and ninety-three thousand 】
This is multilingual wikipedia Encyclopedia website source code development Second articles , I talked about the first article , Friends in need can see my blog homepage , Cut the crap and go straight to the topic .
This is also the backstage part , It's the administrator section
Dynamic home page
public function index(){
$where = [];
$where[] = ['status','<>',-1];
$username = input('username');
// search criteria
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(' Status modification succeeded ');
}
return $this->error(' Failed to modify the status ');
}
Administrator's add page
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(' Password inconsistency ');
}
$info['password'] = md5($password);
if(d('manager')->insert($info)){
return $this->success(' Add success ');
}
return $this->error(' Add failure ');
}
$where = [];
if(!is_root()){
$where[] = ['id','<>',2];
}
$list = d('role')->where($where)->select();
View::assign([
'list' => $list
]);
return View::fetch();
}
Administrator's add page
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(' Password inconsistency ');
}
if($password != ''){
$info['password'] = md5($password);
}
if(d('manager')->where('id',$id)->update($info)){
return $this->success(' Modification successful ');
}
return $this->error(' Modification failed ');
}
$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' => ' Delete successful ']);
}
return json(['code' => 0, 'msg' => ' Delete failed ']);
}
Administrator menu management
public function index(){
$where = [];
$where[] = ['status','<>',-1];
$username = input('username');
// search criteria
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(' Status modification succeeded ');
}
return $this->error(' Failed to modify the status ');
}
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(' Status modification succeeded ');
}
return $this->error(' Failed to modify the status ');
}
public function sort(){
if(d('menu')->where('id',input('id'))->update(['sort' => input('status')])){
return $this->success(' Modification successful ');
}
return $this->error(' Modification failed ');
}
边栏推荐
- 随机事件的关系与运算
- C語言-入門-基礎-語法-[運算符,類型轉換](六)
- Explain TCP protocol in detail three handshakes and four waves
- In depth research and investment strategy report on China's hydraulic parts industry (2022 Edition)
- Use Alibaba cloud NPM image acceleration
- GoLand environment variable configuration
- Solve the problem of "Chinese garbled MySQL fields"
- Démarrage des microservices: passerelle
- What exactly is DAAS data as a service? Don't be misled by other DAAS concepts
- HMS core helps baby bus show high-quality children's digital content to global developers
猜你喜欢
C语言-入门-基础-语法-[标识符,关键字,分号,空格,注释,输入和输出](三)
Sequence model
【LeetCode 42】501. Mode in binary search tree
ArcGIS application (XXII) ArcMap loading lidar Las format data
Codeforces Round #803 (Div. 2)(A-D)
09 softmax regression + loss function
Explain TCP protocol in detail three handshakes and four waves
Bishi blog (13) -- oral arithmetic test app
Live in a dream, only do things you don't say
Codeforces Round #750 (Div. 2)(A,B,C,D,F1)
随机推荐
Bishi blog (13) -- oral arithmetic test app
Clion console output Chinese garbled code
《网络是怎么样连接的》读书笔记 - 认识网络基础概念(一)
Reading notes on how to connect the network - hubs, routers and routers (III)
awk从入门到入土(9)循环语句
《网络是怎么样连接的》读书笔记 - 集线器、路由器和路由器(三)
C语言-入门-基础-语法-[标识符,关键字,分号,空格,注释,输入和输出](三)
Opencv environment construction (I)
如何编写单元测试用例
C language - Introduction - Foundation - syntax - [variable, constant light, scope] (V)
Dynamic analysis and development prospect prediction report of high purity manganese dioxide in the world and China Ⓡ 2022 ~ 2027
Research Report on the current market situation and development prospects of calcium sulfate whiskers in China (2022 Edition)
Simulate EF dbcontext with MOQ - mocking EF dbcontext with MOQ
Talk about single case mode
AI Winter Olympics | is the future coming? Enter the entrance of the meta universe - virtual digital human
《网络是怎么样连接的》读书笔记 - FTTH
[error record] no matching function for call to 'cacheflush' cacheflush();)
什么是权限?什么是角色?什么是用户?
C语言-入门-基础-语法-[变量,常亮,作用域](五)
What is inner connection and outer connection? What are the uses and benefits