menuAction.php 643 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. class menuClassAction extends Action
  3. {
  4. public function dataAjax()
  5. {
  6. $this->rows = array();
  7. $where = $this->rock->covexec($this->post('where'));
  8. $this->getmenu(0, 1, $where);
  9. echo json_encode(array(
  10. 'totalCount'=> 0,
  11. 'rows' => $this->rows
  12. ));
  13. }
  14. private function getmenu($pid, $oi, $wh='')
  15. {
  16. $db = m('menu');
  17. $menu = $db->getall("`pid`='$pid' $wh order by `sort`",'*');
  18. foreach($menu as $k=>$rs){
  19. $sid = $rs['id'];
  20. $rs['level'] = $oi;
  21. $rs['stotal'] = $db->rows("`pid`='$sid' $wh ");
  22. $this->rows[] = $rs;
  23. $this->getmenu($sid, $oi+1, $wh);
  24. }
  25. }
  26. }
粤ICP备19079148号