Meal.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. namespace app\api\controller;
  3. use app\api\logic\MealLogic;
  4. use app\api\logic\PayLogic;
  5. /**
  6. * 套餐配送
  7. *
  8. * @author wj
  9. * @date 2022-12-03
  10. */
  11. class Meal
  12. {
  13. /**
  14. * 获取套餐中心列表
  15. *
  16. * @return void
  17. * @author wj
  18. * @date 2022-12-03
  19. */
  20. public function getcenterlist()
  21. {
  22. $post = request()->post();
  23. $l_m = new MealLogic();
  24. $result = $l_m->getcenterlist($post);
  25. if (empty($result['status'])) {
  26. return backjson2(0, $result['msg']);
  27. }
  28. return backjson2(200, $result['msg'], $result['data']);
  29. }
  30. /**
  31. * 获取套餐
  32. *
  33. * @return void
  34. * @author wj
  35. * @date 2022-12-03
  36. */
  37. public function getmeals()
  38. {
  39. $post = request()->post();
  40. $l_m = new MealLogic();
  41. $result = $l_m->getmeals($post);
  42. if (empty($result['status'])) {
  43. return backjson2(0, $result['msg']);
  44. }
  45. return backjson2(200, $result['msg'], $result['data']);
  46. }
  47. /**
  48. * 创建订单
  49. *
  50. * @return void
  51. * @author wj
  52. * @date 2022-12-05
  53. */
  54. public function createOrder()
  55. {
  56. $post = request()->post();
  57. $l_m = new MealLogic();
  58. $result = $l_m->createOrder($post);
  59. if (empty($result['status'])) {
  60. return backjson2(0, $result['msg']);
  61. }
  62. return backjson2(200, $result['msg'], $result['data']);
  63. }
  64. /**
  65. * 创建支付单
  66. *
  67. * @return void
  68. * @author wj
  69. * @date 2022-12-05
  70. */
  71. public function paymealorder()
  72. {
  73. $post = request()->post();
  74. $l_p = new PayLogic();
  75. $result = $l_p->createmealorder($post, 'APP');
  76. if (empty($result['status'])) {
  77. return backjson2(0, $result['msg']);
  78. }
  79. return backjson2(200, $result['msg'], $result['data']);
  80. }
  81. /**
  82. * 套餐订购回调
  83. *
  84. * @return void
  85. * @author wj
  86. * @date 2022-12-05
  87. */
  88. public function paycallback_mealorder()
  89. {
  90. $data = file_get_contents('php://input');
  91. $data = xmltoarr($data);
  92. $l_p = new PayLogic();
  93. $result = $l_p->paycallback_mealorder($data);
  94. if (empty($result['status'])) {
  95. return backjson2(0, $result['msg']);
  96. }
  97. return backjson2(200, $result['msg'], $result['data']);
  98. }
  99. /**
  100. * 获取订单列表
  101. *
  102. * @return void
  103. * @author wj
  104. * @date 2022-12-05
  105. */
  106. public function getorderlist()
  107. {
  108. $post = request()->post();
  109. $l_m = new MealLogic();
  110. $result = $l_m->getorderlist($post);
  111. if (empty($result['status'])) {
  112. return backjson2(0, $result['msg']);
  113. }
  114. return backjson2(200, $result['msg'], $result['data']);
  115. }
  116. }