酒店预订平台
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

130 řádky
3.5 KiB

  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\dao\GroupDao;
  4. use app\admin\service\ReceiptOrderDao;
  5. use app\admin\service\ReceiptOrderService;
  6. use app\common\controller\Backend;
  7. use think\Db;
  8. use think\exception\PDOException;
  9. use think\exception\ValidateException;
  10. /**
  11. * 收款账单管理
  12. *
  13. * @icon fa fa-circle-o
  14. */
  15. class ReceiptOrder extends Backend
  16. {
  17. protected $noNeedRight = ['save',"getList","setStatus","addOrderMain","removeOrderMain","getOrderMainList","delAll"];
  18. /**
  19. * ReceiptOrder模型对象
  20. * @var \app\admin\model\ReceiptOrder
  21. */
  22. protected $model = null;
  23. public function _initialize()
  24. {
  25. parent::_initialize();
  26. $this->model = new \app\admin\model\ReceiptOrder;
  27. }
  28. public function import()
  29. {
  30. parent::import();
  31. }
  32. /**
  33. * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
  34. * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
  35. * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
  36. */
  37. /**
  38. * 保存记录
  39. * @return \think\response\Json
  40. */
  41. public function save(){
  42. $params=$this->request->post();
  43. $params['create_id']=$this->auth->id;
  44. $groupDao = new GroupDao();
  45. $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupIds()[0]);
  46. $service = new ReceiptOrderService();
  47. $result = $service->save($params);
  48. return json($result);
  49. }
  50. /**
  51. * 获取列表
  52. * @return \think\response\Json
  53. */
  54. public function getList(){
  55. $params=$this->request->post();
  56. $groupDao = new GroupDao();
  57. $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupIds()[0]);
  58. $service = new ReceiptOrderService();
  59. $result = $service->getList($params);
  60. return json($result);
  61. }
  62. /**
  63. * 状态设置
  64. * @return \think\response\Json
  65. */
  66. public function setStatus(){
  67. $params=$this->request->post();
  68. $service = new ReceiptOrderService();
  69. $result = $service->setStatus($params['id'],$params['status']);
  70. return json($result);
  71. }
  72. /**
  73. * 添加到收款单
  74. * @return \think\response\Json
  75. */
  76. public function addOrderMain(){
  77. $params=$this->request->post();
  78. $service = new ReceiptOrderService();
  79. $result = $service->addOrderMain($params['id'],$params['order_id']);
  80. return json($result);
  81. }
  82. /**
  83. * 移除收购单
  84. * @return \think\response\Json
  85. */
  86. public function removeOrderMain(){
  87. $params=$this->request->post();
  88. $service = new ReceiptOrderService();
  89. $result = $service->removeOrderMain($params['order_id']);
  90. return json($result);
  91. }
  92. /**
  93. * 获取订单列表
  94. * @return \think\response\Json
  95. */
  96. public function getOrderMainList(){
  97. $params=$this->request->post();
  98. $groupDao = new GroupDao();
  99. $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupIds()[0]);
  100. $service = new ReceiptOrderService();
  101. $result = $service->getOrderMainList($params);
  102. return json($result);
  103. }
  104. /**
  105. * 删除收款单
  106. */
  107. public function delAll(){
  108. $params=$this->request->post();
  109. $service = new ReceiptOrderService();
  110. $result = $service->delAll($params['id']);
  111. return json($result);
  112. }
  113. }