Notify.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. return AlipayPaymentService::instance($param)->opvip();
  40. } else {
  41. return 'success';
  42. }
  43. }
  44. /**
  45. * 微信支付商城通知
  46. * @param string $scene 支付场景
  47. * @param string $param 支付参数
  48. * @return string
  49. * @throws \think\admin\Exception
  50. */
  51. public function orderwx(string $scene = 'order', string $param = ''): string
  52. {
  53. if (strtolower($scene) === 'order') {
  54. return WechatPaymentService::instance($param)->payorder();
  55. } else {
  56. return 'success';
  57. }
  58. }
  59. /**
  60. * 支付宝支付商城通知
  61. * @param string $scene 支付场景
  62. * @param string $param 支付参数
  63. * @return string
  64. * @throws \think\admin\Exception
  65. */
  66. public function orderzfb(string $scene = 'order', string $param = ''): string
  67. {
  68. if (strtolower($scene) === 'order') {
  69. return AlipayPaymentService::instance($param)->payorder();
  70. } else {
  71. return 'success';
  72. }
  73. }
  74. /**
  75. * 微信支付通知
  76. * @param string $scene 支付场景
  77. * @param string $param 支付参数
  78. * @return string
  79. * @throws \think\admin\Exception
  80. */
  81. public function wxpay(string $scene = 'order', string $param = ''): string
  82. {
  83. if (strtolower($scene) === 'order') {
  84. return WechatPaymentService::instance($param)->notify2();
  85. } else {
  86. return 'success';
  87. }
  88. }
  89. /**
  90. * 支付宝支付通知
  91. * @param string $scene 支付场景
  92. * @param string $param 支付参数
  93. * @return string
  94. * @throws \think\admin\Exception
  95. */
  96. public function alipay(string $scene = 'order', string $param = ''): string
  97. {
  98. if (strtolower($scene) === 'order') {
  99. return AlipayPaymentService::instance($param)->notify();
  100. } else {
  101. return 'success';
  102. }
  103. }
  104. /**
  105. * 汇聚支付通知
  106. * @param string $scene 支付场景
  107. * @param string $param 支付参数
  108. * @return string
  109. * @throws \think\admin\Exception
  110. */
  111. public function joinpay(string $scene = 'order', string $param = ''): string
  112. {
  113. if (strtolower($scene) === 'order') {
  114. return JoinpayPaymentService::instance($param)->notify();
  115. } else {
  116. return 'success';
  117. }
  118. }
  119. }