src/Topxia/MobileBundleV2/Controller/MobileAlipayController.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace Topxia\MobileBundleV2\Controller;

use AppBundle\Component\Payment\Payment;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Topxia\MobileBundleV2\Alipay\AlipayNotify;
use Topxia\MobileBundleV2\Alipay\MobileAlipayConfig;
use Topxia\MobileBundleV2\Alipay\MobileAlipayRequest;

class MobileAlipayController extends MobileBaseController
{
    public function payAction(Request $request)
    {
        $alipayRequest = new MobileAlipayRequest($request);

        return new Response($alipayRequest->getRequestForm('edusoho'));
    }

    public function payNotifyAction(Request $request, $name)
    {
        $this->getLogService()->info('notify', 'create', 'paynotify action');
        $alipayNotify = new AlipayNotify(MobileAlipayConfig::getAlipayConfig('edusoho'));
        $verify_result = $alipayNotify->verifyNotify();

        $status = 'fail';

        if ($verify_result) {
            //验证成功
            try {
                $status = $this->doPayNotify($request, $name);
            } catch (\Exception $e) {
                error_log($e->getMessage(), 0);
            }
        } else {
            //验证失败
            $status = 'fail';
            $this->getLogService()->info('notify', 'check_fail', 'paynotify action');
        }

        return new Response($status);
    }

    public function payMerchantAction(Request $request)
    {
        return new Response('<p>请点击返回按钮关闭!</p>');
    }

    public function payCallBackAction(Request $request, $name)
    {
        $status = 'success';
        $callback = "<script type='text/javascript'>window.location='objc://alipayCallback?".$status."';</script>";

        return new Response($callback);
    }

    //支付校验
    protected function doPayNotify(Request $request, $name)
    {

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。