Notify.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. namespace app\controller\api;
  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: "refund",methods: "post")]
  17. public function notifyRefund(Request $request)
  18. {
  19. try {
  20. } catch (\Throwable $throwable) {
  21. return error($throwable->getMessage());
  22. }
  23. }
  24. /**
  25. * 订单支付
  26. */
  27. #[Route(path: "wx",methods: "post")]
  28. public function notifyWx(Request $request)
  29. {
  30. try {
  31. } catch (\Throwable $throwable) {
  32. return error($throwable->getMessage());
  33. }
  34. }
  35. /**
  36. * 充值并支付
  37. */
  38. #[Route(path: "payrecharge",methods: "post")]
  39. public function notifyPayRecharge(Request $request)
  40. {
  41. try {
  42. } catch (\Throwable $throwable) {
  43. return error($throwable->getMessage());
  44. }
  45. }
  46. /**
  47. * 会员卡充值
  48. */
  49. #[Route(path: "recharge",methods: "post")]
  50. public function notifyDataRecharge(Request $request)
  51. {
  52. try {
  53. } catch (\Throwable $throwable) {
  54. return error($throwable->getMessage());
  55. }
  56. }
  57. /**
  58. * 小程序配置
  59. * @return array
  60. */
  61. protected function getWxConfig(): array
  62. {
  63. return [
  64. 'token' => 'test',
  65. 'appid' => sConf("wechat.mini_appid"),
  66. 'appsecret' => sConf("wechat.mini_secret"),
  67. 'encodingaeskey' => 'BJIUzE0gqlWy0GxfPp4J1oPTBmOrNDIGPNav1YFH5Z5',
  68. // 配置商户支付参数(可选,在使用支付功能时需要)
  69. 'mch_id' => sConf("wechat.mch_id"),
  70. 'mch_key' => sConf("wechat.mch_key")
  71. ];
  72. }
  73. }