<?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'=>'删除设置失败']);
}
}
}