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

136 行
3.9 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\PaymentOrderService;
  7. use app\common\controller\Backend;
  8. /**
  9. * 付款账单管理
  10. *
  11. * @icon fa fa-circle-o
  12. */
  13. class PaymentOrder extends Backend
  14. {
  15. protected $noNeedRight = ['save',"getList","setStatus","addOrderMain","removeOrderMain","getSubOrderList","delAll"];
  16. /**
  17. * PaymentOrder模型对象
  18. * @var \app\admin\model\PaymentOrder
  19. */
  20. protected $model = null;
  21. public function _initialize()
  22. {
  23. parent::_initialize();
  24. $this->model = new \app\admin\model\PaymentOrder;
  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. * 保存记录
  37. * @return \think\response\Json
  38. */
  39. public function save(){
  40. $params=$this->request->post();
  41. $params['create_id']=$this->auth->id;
  42. $groupDao = new GroupDao();
  43. $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupIds()[0]);
  44. $service = new PaymentOrderService();
  45. $result = $service->save($params);
  46. return json($result);
  47. }
  48. /**
  49. * 获取列表
  50. * @return \think\response\Json
  51. */
  52. public function getList(){
  53. $params=$this->request->post();
  54. $groupDao = new GroupDao();
  55. $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupIds()[0]);
  56. $service = new PaymentOrderService();
  57. $result = $service->getList($params);
  58. return json($result);
  59. }
  60. /**
  61. * 状态设置
  62. * @return \think\response\Json
  63. */
  64. public function setStatus(){
  65. $groupIds = $this->auth->getGroupIds();
  66. $authGroup = new AuthGroup();
  67. $cnt = $authGroup->where(["id" => ["in",$groupIds], "finance_flag" => 1])->count("*");
  68. $params=$this->request->post();
  69. $model = new \app\admin\model\PaymentOrder();
  70. $info = $model->where(["id"=>$params['id']])->find();
  71. if ($cnt==0 && ($info['status']==2 || $params['status']==2)) {
  72. return json(Util::returnArrEr("未获取财务部门权限"));
  73. }
  74. $service = new PaymentOrderService();
  75. $result = $service->setStatus($params['id'],$params['status']);
  76. return json($result);
  77. }
  78. /**
  79. * 添加到收款单
  80. * @return \think\response\Json
  81. */
  82. public function addOrderMain(){
  83. $params=$this->request->post();
  84. $service = new PaymentOrderService();
  85. $result = $service->addSubOrder($params);
  86. return json($result);
  87. }
  88. /**
  89. * 移除收购单
  90. * @return \think\response\Json
  91. */
  92. public function removeOrderMain(){
  93. $params=$this->request->post();
  94. $service = new PaymentOrderService();
  95. $result = $service->removeSubOrder($params);
  96. return json($result);
  97. }
  98. /**
  99. * 获取订单列表
  100. * @return \think\response\Json
  101. */
  102. public function getSubOrderList(){
  103. $params=$this->request->post();
  104. $groupDao = new GroupDao();
  105. $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupIds()[0]);
  106. $service = new PaymentOrderService();
  107. $result = $service->getSubOrderList($params);
  108. return json($result);
  109. }
  110. /**
  111. * 删除收款单
  112. */
  113. public function delAll(){
  114. $params=$this->request->post();
  115. $service = new PaymentOrderService();
  116. $result = $service->delAll($params['id']);
  117. return json($result);
  118. }
  119. }