abstract:<?phpnamespace app\admin\controller;use think\Controller;use app\admin\model\User;use app\admin\model\Sort;use app\admin\model\System;use think\facade\Session;use think\facade\Request;use app\admin
<?php
namespace app\admin\controller;
use think\Controller;
use app\admin\model\User;
use app\admin\model\Sort;
use app\admin\model\System;
use think\facade\Session;
use think\facade\Request;
use app\admin\controller\Commn;
class Systeml extends Commn
{
public function index()
{
$res = System::all();
$this->assign('res',$res);
return $this->fetch();
}
public function add()
{
return $this->fetch();
}
public function add_do()
{
$data = Request::param();
if ($res = System::insert($data)) {
return json(['code'=>1,'msg'=>'添加设置成功']);
}else{
return json(['code'=>2,'msg'=>'添加设置失败']);
}
}
public function del()
{
$data = Request::param();
$id = $data['id'];
if ($res = System::where('id',$id)->delete()) {
return json(['code'=>0,'msg'=>'删除设置成功']);
}else{
return json(['code'=>1,'msg'=>'删除设置失败']);
}
}
}
Correcting teacher:查无此人Correction time:2019-06-17 09:32:05
Teacher's summary:完成的不错。一天做了很多作业,对后台管理应该很熟悉了。继续加油。