src/PHPDish/Bundle/PaymentBundle/Controller/PaymentController.php
public function notifyAction(Request $request)
    {
        $youZanPay = $this->get('phpdish.payment_gateway.youzan');
        try {
            $result = $youZanPay->verifyWebhook($request);
            $trade = $youZanPay->getTrade($result['id']);
            if ($trade) { //如果支付成功，则通知
                $this->getPaymentManager()->notifyPayment($trade->getQrId());
                $return = [
                    'result' => 'success'
                ];
            } else {
                $return = [
                    'result' => 'error',
                ];
            }
        } catch (\InvalidArgumentException $exception) {
            $return = [
                'result' => 'error',
                'message' => $exception->getMessage()
            ];
        }
        $this->get('monolog.logger.notes')->debug(print_r($return, true));
        $this->get('monolog.logger.notes')->debug($request->getContent());
        return $this->json($return);
    }
public function notifyAction(Request $request)
    {
        $youZanPay = $this->get('phpdish.payment_gateway.youzan');
        try {
            $result = $youZanPay->verifyWebhook($request);
            $trade = $youZanPay->getTrade($result['id']);
            if ($trade) { //如果支付成功，则通知
                $this->getPaymentManager()->notifyPayment($trade->getQrId());
                $return = [
                    'result' => 'success'
                ];
            } else {
                $return = [
                    'result' => 'error',
                ];
            }
        } catch (\InvalidArgumentException $exception) {
            $return = [
                'result' => 'error',
                'message' => $exception->getMessage()
            ];
        }
        $this->get('monolog.logger.notes')->debug(print_r($return, true));
        $this->get('monolog.logger.notes')->debug($request->getContent());
        return $this->json($return);
    }
处理消息推送
@Route("/payments/notify", name="payment_notify")
@param Request $request
@return Response