Page.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace app\admin\controller;
  3. use app\common\controller\Backend;
  4. /**
  5. * 单页管理
  6. *
  7. * @icon fa fa-circle-o
  8. * @remark 用于管理普通的单页面,通常用于关于我们、联系我们、商务合作等单一页面
  9. */
  10. class Page extends Backend
  11. {
  12. protected $model = null;
  13. protected $relationSearch = true;
  14. public function _initialize()
  15. {
  16. parent::_initialize();
  17. $this->model = model('Page');
  18. }
  19. /**
  20. * 查看
  21. */
  22. public function index()
  23. {
  24. if ($this->request->isAjax())
  25. {
  26. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  27. $total = $this->model
  28. ->with("category")
  29. ->where($where)
  30. ->order($sort, $order)
  31. ->count();
  32. $list = $this->model
  33. ->with("category")
  34. ->where($where)
  35. ->order($sort, $order)
  36. ->limit($offset, $limit)
  37. ->select();
  38. $result = array("total" => $total, "rows" => $list);
  39. return json($result);
  40. }
  41. return $this->view->fetch();
  42. }
  43. }