Appointment.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. /*
  3. * @Author: wang jun
  4. * @Date: 2022-01-18 10:57:14
  5. * @Last Modified by: wang jun
  6. * @Last Modified time: 2022-01-19 10:38:56
  7. * 微信类
  8. */
  9. namespace app\index\controller;
  10. use app\index\logic\appointmentlogic;
  11. use app\index\logic\paylogic;
  12. use app\index\logic\wechatlogic;
  13. use think\Controller;
  14. use think\facade\Log;
  15. class Appointment extends Base
  16. {
  17. /**
  18. * 新建申请
  19. *
  20. * @return void
  21. * @author wj
  22. * @date 2022-07-23
  23. */
  24. public function newinfo()
  25. {
  26. $param = request()->post();
  27. $l_a = new appointmentlogic();
  28. $result = $l_a->newinfo($param);
  29. if (!$result['status']) {
  30. return backjson(0, $result['msg']);
  31. }
  32. return backjson(200, $result['data']);
  33. }
  34. /**
  35. * 获取用户可用数据
  36. *
  37. * @param [type] $arr
  38. * @return void
  39. * @author wj
  40. * @date 2022-07-25
  41. */
  42. public function getuseablelist()
  43. {
  44. $param = request()->post();
  45. $l_a = new appointmentlogic();
  46. $result = $l_a->getuseablelist($param);
  47. if (!$result['status']) {
  48. return backjson(0, $result['msg']);
  49. }
  50. return backjson(200, $result['data']);
  51. }
  52. /**
  53. * 支付核酸检测费用 仅小程序支付
  54. *
  55. * @return void
  56. * @author wj
  57. * @date 2022-07-23
  58. */
  59. public function payorder()
  60. {
  61. $param = request()->post();
  62. $l_p = new paylogic();
  63. $result = $l_p->getappointmentorderforxcx($param);
  64. if (empty($result['status'])) {
  65. return backjson(0, $result['msg']);
  66. }
  67. $orderData = $result['data'];
  68. $l_wechat = new wechatlogic();
  69. $result = $l_wechat->createorder($orderData);
  70. if (empty($result['status'])) {
  71. return backjson(0, $result['msg']);
  72. }
  73. $returnData = $result['data'];
  74. return backjson(200, $returnData);
  75. }
  76. /**
  77. * 后端支付回调
  78. *
  79. * @return void
  80. * @author wj
  81. * @date 2022-07-23
  82. */
  83. public function pay_call_back()
  84. {
  85. $reurnData = [
  86. "return_code" => "SUCCESS",
  87. "return_msg" => "OK",
  88. ];
  89. log::info('into callback');
  90. $data = file_get_contents('php://input');
  91. log::info($data);
  92. $backdata = (array) simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA);
  93. log::info($backdata);
  94. $l_p = new paylogic();
  95. $reulst = $l_p->handleorder($backdata);
  96. if (empty($reulst['status'])) {
  97. $reurnData = [
  98. "return_code" => "FAIL",
  99. "return_msg" => $reulst['msg'],
  100. ];
  101. } else {
  102. $reurnData = [
  103. "return_code" => "SUCCESS",
  104. "return_msg" => $reulst['msg'],
  105. ];
  106. }
  107. $l_wechat = new wechatlogic();
  108. $l_wechat->paybackxml($reurnData);
  109. }
  110. /**
  111. * 前端支付回调
  112. */
  113. public function pay_call_back_front()
  114. {
  115. $param = request()->post();
  116. $l_p = new paylogic();
  117. $result = $l_p->handlefrontorder($param);
  118. if (empty($result['status'])) {
  119. return backjson(0, $result['msg']);
  120. }
  121. $returnData = $result['data'];
  122. return backjson(200, $returnData);
  123. }
  124. }