tp6更新到最新版本
目录结构调整
This commit is contained in:
@@ -19,8 +19,9 @@ class Menu extends Admin{
|
||||
public function index(){
|
||||
if($this->request->isAjax()){
|
||||
$menu = new MenuModel();
|
||||
$map = array();
|
||||
|
||||
$res = $menu->select();
|
||||
$res = $menu->where($map)->order('sort asc, id asc')->select();
|
||||
|
||||
$this->data['data'] = $res;
|
||||
return $this->data;
|
||||
@@ -31,14 +32,28 @@ class Menu extends Admin{
|
||||
* @title 编辑菜单
|
||||
*/
|
||||
public function edit(){
|
||||
$menu = new MenuModel();
|
||||
if($this->request->isAjax()){
|
||||
$menu = new MenuModel();
|
||||
$data = $this->request->post();
|
||||
|
||||
$res = $menu->select();
|
||||
|
||||
$this->data['data'] = $res;
|
||||
$result = $menu->where('id', $data['id'])->save($data);
|
||||
if (false !== $result) {
|
||||
$this->data['code'] = 0;
|
||||
$this->data['msg'] = '更新成功!';
|
||||
}else{
|
||||
$this->data['code'] = 1;
|
||||
$this->data['msg'] = '更新失败!';
|
||||
}
|
||||
return $this->data;
|
||||
}else{
|
||||
$id = $this->request->param('id', 0);
|
||||
|
||||
if (!$id) {
|
||||
return $this->error('非法操作!');
|
||||
}
|
||||
$info = $menu->where('id', $id)->find();
|
||||
|
||||
$this->data['data'] = array('info'=>$info);
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
@@ -48,11 +63,6 @@ class Menu extends Admin{
|
||||
*/
|
||||
public function add(){
|
||||
if($this->request->isAjax()){
|
||||
$menu = new MenuModel();
|
||||
|
||||
$res = $menu->select();
|
||||
|
||||
$this->data['data'] = $res;
|
||||
return $this->data;
|
||||
}else{
|
||||
$this->data['template'] = 'edit';
|
||||
@@ -65,11 +75,6 @@ class Menu extends Admin{
|
||||
*/
|
||||
public function remove(){
|
||||
if($this->request->isAjax()){
|
||||
$menu = new MenuModel();
|
||||
|
||||
$res = $menu->select();
|
||||
|
||||
$this->data['data'] = $res;
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user