Notify.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <?php
  2. namespace app\data\controller\api;
  3. use app\data\service\payment\AlipayPaymentService;
  4. use app\data\service\payment\JoinpayPaymentService;
  5. use app\data\service\payment\WechatPaymentService;
  6. use think\admin\Controller;
  7. /**
  8. * 异步通知处理
  9. * Class Notify
  10. * @package app\data\controller\api
  11. */
  12. class Notify extends Controller
  13. {
  14. /**
  15. * 微信支付开通vip通知
  16. * @param string $scene 支付场景
  17. * @param string $param 支付参数
  18. * @return string
  19. * @throws \think\admin\Exception
  20. */
  21. public function opvipwx(string $scene = 'order', string $param = ''): string
  22. {
  23. if (strtolower($scene) === 'order') {
  24. return WechatPaymentService::instance($param)->opvip();
  25. } else {
  26. return 'success';
  27. }
  28. }
  29. /**
  30. * 支付宝开通vip通知
  31. * @param string $scene 支付场景
  32. * @param string $param 支付参数
  33. * @return string
  34. * @throws \think\admin\Exception
  35. */
  36. public function opvipzfb(string $scene = 'order', string $param = ''): string
  37. {
  38. if (strtolower($scene) === 'order') {
  39. echo 2222;die;
  40. return AlipayPaymentService::instance($param)->opvip();
  41. } else {
  42. return 'success';
  43. }
  44. }
  45. /**
  46. * 微信支付商城通知
  47. * @param string $scene 支付场景
  48. * @param string $param 支付参数
  49. * @return string
  50. * @throws \think\admin\Exception
  51. */
  52. public function orderwx(string $scene = 'order', string $param = ''): string
  53. {
  54. if (strtolower($scene) === 'order') {
  55. return WechatPaymentService::instance($param)->payorder();
  56. } else {
  57. return 'success';
  58. }
  59. }
  60. /**
  61. * 支付宝支付商城通知
  62. * @param string $scene 支付场景
  63. * @param string $param 支付参数
  64. * @return string
  65. * @throws \think\admin\Exception
  66. */
  67. public function orderzfb(string $scene = 'order', string $param = ''): string
  68. {
  69. if (strtolower($scene) === 'order') {
  70. return AlipayPaymentService::instance($param)->payorder();
  71. } else {
  72. return 'success';
  73. }
  74. }
  75. /**
  76. * 微信支付通知
  77. * @param string $scene 支付场景
  78. * @param string $param 支付参数
  79. * @return string
  80. * @throws \think\admin\Exception
  81. */
  82. public function wxpay(string $scene = 'order', string $param = ''): string
  83. {
  84. if (strtolower($scene) === 'order') {
  85. return WechatPaymentService::instance($param)->notify2();
  86. } else {
  87. return 'success';
  88. }
  89. }
  90. /**
  91. * 支付宝支付通知
  92. * @param string $scene 支付场景
  93. * @param string $param 支付参数
  94. * @return string
  95. * @throws \think\admin\Exception
  96. */
  97. public function alipay(string $scene = 'order', string $param = ''): string
  98. {
  99. if (strtolower($scene) === 'order') {
  100. return AlipayPaymentService::instance($param)->notify();
  101. } else {
  102. return 'success';
  103. }
  104. }
  105. /**
  106. * 汇聚支付通知
  107. * @param string $scene 支付场景
  108. * @param string $param 支付参数
  109. * @return string
  110. * @throws \think\admin\Exception
  111. */
  112. public function joinpay(string $scene = 'order', string $param = ''): string
  113. {
  114. if (strtolower($scene) === 'order') {
  115. return JoinpayPaymentService::instance($param)->notify();
  116. } else {
  117. return 'success';
  118. }
  119. }
  120. }