Notify.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. namespace app\controller\mini;
  3. use app\extra\basic\Base;
  4. use LinFly\Annotation\Route\Controller;
  5. use LinFly\Annotation\Route\Route;
  6. use support\Request;
  7. use support\Response;
  8. #[Controller(prefix: "/notify")]
  9. class Notify extends Base
  10. {
  11. /**
  12. * 撤销核销通知
  13. * @param Request $request
  14. * @return Response
  15. */
  16. #[Route(path: "cancel",methods: "post")]
  17. public function getCancel(Request $request): Response
  18. {
  19. try {
  20. $param = $request->post();
  21. echo getDateFull()."==撤销核销通知==\n";
  22. print_r($param);
  23. return json([
  24. "err_no" => 0,
  25. "err_tips" => "success"
  26. ]);
  27. } catch (\Throwable $throwable) {
  28. return error($throwable->getMessage());
  29. }
  30. }
  31. /**
  32. * 券核销通知
  33. * @param Request $request
  34. * @return Response
  35. */
  36. #[Route(path: "verify",methods: "post")]
  37. public function getVerify(Request $request): Response
  38. {
  39. try {
  40. $param = $request->post();
  41. echo getDateFull()."==券核销通知==\n";
  42. print_r($param);
  43. return json([
  44. "err_no" => 0,
  45. "err_tips" => "success"
  46. ]);
  47. } catch (\Throwable $throwable) {
  48. return error($throwable->getMessage());
  49. }
  50. }
  51. /**
  52. * 交易系统支付结果通知
  53. * @param Request $request
  54. * @return Response
  55. */
  56. #[Route(path: "pay",methods: "post")]
  57. public function getPay(Request $request): Response
  58. {
  59. try {
  60. $param = $request->post();
  61. echo getDateFull()."==交易系统支付结果通知==\n";
  62. print_r($param);
  63. return json([
  64. "err_no" => 0,
  65. "err_tips" => "success"
  66. ]);
  67. } catch (\Throwable $throwable) {
  68. return error($throwable->getMessage());
  69. }
  70. }
  71. /**
  72. * 交易系统退款通知
  73. * @param Request $request
  74. * @return Response
  75. */
  76. #[Route(path: "refund",methods: "post")]
  77. public function getRefund(Request $request): Response
  78. {
  79. try {
  80. $param = $request->post();
  81. echo getDateFull()."==交易系统退款通知==\n";
  82. print_r($param);
  83. return json([
  84. "err_no" => 0,
  85. "err_tips" => "success"
  86. ]);
  87. } catch (\Throwable $throwable) {
  88. return error($throwable->getMessage());
  89. }
  90. }
  91. }