Notify.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. * 核销工具解决方案-spi
  13. * @param Request $request
  14. * @return Response
  15. */
  16. #[Route(path: "mini",methods: "post")]
  17. public function getSpiData(Request $request): Response
  18. {
  19. try {
  20. $param = $request->post();
  21. echo getDateFull()."=={$param['type']}==\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. * 核销工具解决方案-扩展点-spi
  33. * @param Request $request
  34. * @return Response
  35. */
  36. #[Route(path: "expand",methods: "post")]
  37. public function getExpandData(Request $request): Response
  38. {
  39. try {
  40. $param = $request->post();
  41. switch ($param['type'])
  42. {
  43. case "pre_create_order": // 预下单回调
  44. break;
  45. case "pre_create_refund": // 退款审核回调
  46. break;
  47. }
  48. echo getDateFull()."=={$param['type']}==\n";
  49. print_r($param);
  50. return json([
  51. "err_no" => 0,
  52. "err_tips" => "success"
  53. ]);
  54. } catch (\Throwable $throwable) {
  55. return error($throwable->getMessage());
  56. }
  57. }
  58. }