酒店预订平台
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.

OrderItem.php 2.5 KiB

3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\dao\GroupDao;
  4. use app\common\controller\Backend;
  5. use think\Db;
  6. use think\Exception;
  7. use think\exception\PDOException;
  8. use think\exception\ValidateException;
  9. /**
  10. * 订单-附加项目子订单
  11. *
  12. * @icon fa fa-circle-o
  13. */
  14. class OrderItem extends Backend
  15. {
  16. /**
  17. * OrderItem模型对象
  18. * @var \app\admin\model\OrderItem
  19. */
  20. protected $model = null;
  21. public function _initialize()
  22. {
  23. parent::_initialize();
  24. $this->model = new \app\admin\model\OrderItem;
  25. }
  26. public function import()
  27. {
  28. parent::import();
  29. }
  30. /**
  31. * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
  32. * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
  33. * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
  34. */
  35. /**
  36. * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
  37. * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
  38. * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
  39. */
  40. /**
  41. * 添加
  42. */
  43. public function add()
  44. {
  45. if ($this->request->isPost()) {
  46. $this->error(__('不可新增', ''));
  47. }
  48. return $this->view->fetch();
  49. }
  50. /**
  51. * 查看
  52. */
  53. public function index()
  54. {
  55. //设置过滤方法
  56. $this->request->filter(['strip_tags', 'trim']);
  57. if ($this->request->isAjax()) {
  58. //如果发送的来源是Selectpage,则转发到Selectpage
  59. if ($this->request->request('keyField')) {
  60. return $this->selectpage();
  61. }
  62. $groupDao = new GroupDao();
  63. $group_id = $groupDao->getTopGroup($this->auth->getGroupIds()[0]);
  64. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  65. $list = $this->model
  66. ->where($where)
  67. ->where("group_id",'=',$group_id)
  68. ->order($sort, $order)
  69. ->paginate($limit);
  70. $result = array("total" => $list->total(), "rows" => $list->items());
  71. return json($result);
  72. }
  73. return $this->view->fetch();
  74. }
  75. }