酒店预订平台
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

141 行
4.1 KiB

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