/**
  * 添加菜单 
  */
 public function addmenuAction()
 {
     $request = $this->getRequest();
     $admin_service = new AdminService();
     if ($request->isPost()) {
         $top_id = (int) $request->getParam('top_id');
         $parent_id = (int) $request->getParam('parent_id');
         $menu_name = Star_String::escape($request->getParam('menu_name'));
         $sort = (int) $request->getParam('sort');
         $is_show = (int) $request->getParam('is_show');
         $controller = $request->getParam('controller');
         $action = $request->getParam('action');
         if (empty($menu_name)) {
             return $this->showWarning('对不起,菜单名称不能为空。');
         }
         if ($parent_id == 0) {
             $top_id = 0;
             $controller = '';
             $action = '';
             $menu_level = 1;
             $parent_id = 0;
             $is_show = 1;
         }
         if ($parent_id && $parent_id == $top_id) {
             $menu_info = $admin_service->getMenuByid($parent_id);
             if (!$menu_info) {
                 return $this->showWarning('对不起,上级菜单不存在,请确认数据是否有误。');
             }
             if ($menu_info['menu_level'] != 1) {
                 return $this->showWarning('对不起,上级菜单不是为一级菜单。');
             }
             $is_show = 1;
             $controller = '';
             $action = 0;
             $menu_level = 2;
         }
         if ($parent_id && $parent_id != $top_id) {
             if (empty($controller)) {
                 return $this->showWarning('对不起,Controller不能为空。');
             }
             if (empty($action)) {
                 return $this->showWarning('对不起,Action不能为空。');
             }
             $menu_level = 3;
         }
         $menu_data = array('controller' => $controller, 'action' => $action, 'menu_name' => $menu_name, 'top_id' => $top_id, 'parent_id' => $parent_id, 'menu_level' => $menu_level, 'sort' => $sort, 'is_show' => $is_show, 'add_time' => time(), 'update_time' => time());
         $menu_id = $admin_service->insertMenu($menu_data);
         if ($menu_id) {
             return $this->showMessage('恭喜您,成功添加菜单。');
         } else {
             return $this->showMessage('很遗憾添加菜单失败。');
         }
     }
     $menus = $admin_service->getTopMenu();
     $this->view->assign(array('menus' => $menus, 'menu' => array()));
     $this->render('menuinfo');
 }