frontend\controllers\OrderController::actionPay PHP Method

actionPay() public method

public actionPay ( $order )
    public function actionPay($order)
    {
        $this->layout = 'column2';
        try {
            $payOrderForm = new PayOrderForm($order);
        } catch (InvalidParamException $e) {
            throw new BadRequestHttpException($e->getMessage());
        }
        if ($payOrderForm->order->status !== Order::STATUS_UNPAID) {
            return $this->redirect(['/order/detail', 'order' => $order]);
        }
        if ($payOrderForm->load(Yii::$app->request->post())) {
            if ($result = $payOrderForm->pay()) {
                Yii::info("用户请求支付订单成功!订单号:{$order},支付平台:{$payOrderForm->platform}");
                $this->layout = false;
                return $result;
            } else {
                Yii::error("用户请求支付订单失败!订单号:{$order},支付平台:{$payOrderForm->platform}");
            }
        }
        return $this->render('pay', ['model' => $payOrderForm, 'order' => $payOrderForm->order]);
    }