DinnerOrders.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\hander\HelpHander;
  5. use think\Db;
  6. class DinnerOrders extends Base
  7. {
  8. // 列表
  9. public function list(){
  10. $ret = model('DinnerOrders')->lists();
  11. HelpHander::success($ret);
  12. }
  13. public function export(){
  14. $ret = model('DinnerOrders')->export();
  15. HelpHander::success($ret);
  16. }
  17. public function apply(){
  18. $ret = model('DinnerOrders')->applys($this->userId);
  19. HelpHander::success($ret);
  20. }
  21. public function applyexport(){
  22. $ret = model('DinnerOrders')->applyexport($this->userId);
  23. HelpHander::success($ret);
  24. }
  25. public function agree(){
  26. $id = input('id/d',0);
  27. model('DinnerOrders')->agree($id,$this->userId);
  28. HelpHander::success([],'操作成功');
  29. }
  30. public function agreeall(){
  31. model('DinnerOrders')->agreeall($this->userId);
  32. HelpHander::success([],'操作成功');
  33. }
  34. // 删除
  35. public function del(){
  36. $id = input('id/d',0);
  37. model('DinnerOrders')->del($id,$this->userId);
  38. HelpHander::success([],'操作成功');
  39. }
  40. // 删除订单商品
  41. public function delgoods(){
  42. $id = input('id/d',0);
  43. model('DinnerOrders')->delgoods($id,$this->userId);
  44. HelpHander::success([],'操作成功');
  45. }
  46. // 修改商品数量
  47. public function editgoods(){
  48. $id = input('id/d',0);
  49. $nums = input('nums/d',0);
  50. model('DinnerOrders')->editgoods($id,$nums,$this->userId);
  51. HelpHander::success([],'操作成功');
  52. }
  53. // 添加商品
  54. public function addgoods(){
  55. $orderId = input('orderId/d',0);
  56. $dinnerId = input('dinnerId/d',0);
  57. $nums = input('nums/d',0);
  58. model('DinnerOrders')->addgoods($orderId,$dinnerId,$nums,$this->userId);
  59. HelpHander::success([],'操作成功');
  60. }
  61. public function goods(){
  62. $orderId = input('orderId/d',0);
  63. $m[] = ['a.order_id','=',$orderId];
  64. $goods = Db::name('dinner_order_goods')
  65. ->alias('a')
  66. ->join('dinner_cate c','c.id = a.cate_id')
  67. ->join('dinner e','e.id = a.dinner_id')
  68. ->where($m)
  69. ->order('a.cate_id asc')
  70. ->field('a.*,c.title as cate_title,e.title as dinner_title,c.color')
  71. ->select();
  72. $goods = $goods?$goods:[];
  73. HelpHander::success($goods,'成功');
  74. }
  75. // 配菜表
  76. public function pclist(){
  77. $ret = model('DinnerOrders')->pclists();
  78. HelpHander::success($ret);
  79. }
  80. // 配菜表导出
  81. public function pcexport(){
  82. $ret = model('DinnerOrders')->pcexport();
  83. HelpHander::success($ret);
  84. }
  85. // 财务报表
  86. public function finance(){
  87. $ret = model('DinnerOrders')->finance();
  88. HelpHander::success($ret);
  89. }
  90. // 财务报表
  91. public function finexport(){
  92. $ret = model('DinnerOrders')->finexport();
  93. HelpHander::success($ret);
  94. }
  95. // 公司财务报表
  96. public function cfinance(){
  97. $ret = model('DinnerOrders')->cfinance($this->userId);
  98. HelpHander::success($ret);
  99. }
  100. // 公司财务报表
  101. public function cfinexport(){
  102. $ret = model('DinnerOrders')->cfinexport($this->userId);
  103. HelpHander::success($ret);
  104. }
  105. }