Templatelist.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace app\admin\controller;
  3. use app\common\controller\Backend;
  4. use think\Controller;
  5. use think\Request;
  6. /**
  7. * 模板列管理
  8. *
  9. * @icon fa fa-circle-o
  10. */
  11. class Templatelist extends Backend
  12. {
  13. /**
  14. * Templatelist模型对象
  15. */
  16. protected $model = null;
  17. public function _initialize()
  18. {
  19. parent::_initialize();
  20. $this->model = model('Templatelist');
  21. }
  22. public function index()
  23. {
  24. //设置过滤方法
  25. $this->request->filter(['strip_tags']);
  26. if ($this->request->isAjax()) {
  27. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  28. $total = $this->model
  29. ->where($where)
  30. ->where('admin_id','in',$this->auth->id)
  31. ->order($sort, $order)
  32. ->count();
  33. $list = $this->model
  34. ->where($where)
  35. ->where('admin_id','in',$this->auth->id)
  36. ->order($sort, $order)
  37. ->limit($offset, $limit)
  38. ->select();
  39. $result = array("total" => $total, "rows" => $list);
  40. return json($result);
  41. }
  42. return $this->view->fetch();
  43. }
  44. }