酒店预订平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Tabletemplate.php 1.4 KiB

3 jaren geleden
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace app\admin\controller\example;
  3. use app\common\controller\Backend;
  4. /**
  5. * 表格模板示例
  6. *
  7. * @icon fa fa-table
  8. * @remark 可以通过使用表格模板将表格中的行渲染成一样的展现方式,基于此功能可以任意定制自己想要的展示列表
  9. */
  10. class Tabletemplate extends Backend
  11. {
  12. protected $model = null;
  13. public function _initialize()
  14. {
  15. parent::_initialize();
  16. $this->model = model('AdminLog');
  17. }
  18. /**
  19. * 查看
  20. */
  21. public function index()
  22. {
  23. if ($this->request->isAjax()) {
  24. list($where, $sort, $order, $offset, $limit) = $this->buildparams(null);
  25. $total = $this->model
  26. ->where($where)
  27. ->order($sort, $order)
  28. ->count();
  29. $list = $this->model
  30. ->where($where)
  31. ->order($sort, $order)
  32. ->limit($offset, $limit)
  33. ->select();
  34. $result = array("total" => $total, "rows" => $list);
  35. return json($result);
  36. }
  37. return $this->view->fetch();
  38. }
  39. /**
  40. * 详情
  41. */
  42. public function detail($ids)
  43. {
  44. $row = $this->model->get(['id' => $ids]);
  45. if (!$row) {
  46. $this->error(__('No Results were found'));
  47. }
  48. $this->view->assign("row", $row->toArray());
  49. return $this->view->fetch();
  50. }
  51. }