ComplexPayNotify.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * 聚合渠道支付回调接口
  4. *
  5. */
  6. namespace app\api\controller\v1;
  7. use app\api\service\NotifyService;
  8. use app\common\controller\Base;
  9. class ComplexPayNotify extends Base
  10. {
  11. public function notify()
  12. {
  13. $logGet = '';
  14. $logPost = '';
  15. if ($get = request()->get()) {
  16. $logGet = http_build_query($get);
  17. }
  18. if ($post = request()->post()) {
  19. $logPost = json_encode($post);
  20. }
  21. log_message('渠道订单回调: path=' . request()->path() . ' - get=' . $logGet . ' - post=' . $logPost, 'info', LOG_PATH . 'complexPayNotify/');
  22. try {
  23. $postData = input();
  24. if (count($postData) < 3) {
  25. $postInput = request()->getInput();
  26. parse_str($postInput, $postInput);
  27. $postData = array_merge($postData, $postInput);
  28. }
  29. } catch (\Exception $e) {
  30. echo 'errNoData!';
  31. exit();
  32. }
  33. $channel = input('channelqf');
  34. $gameid = input('gameidqf');
  35. if (!$channel || !$gameid) {
  36. echo 'errNoGame';
  37. exit();
  38. }
  39. (new NotifyService())->notify($channel, $postData);
  40. }
  41. }