getRequest()->getIsPost()) { $data = Yii::$app->getRequest()->post(); $payMethod = isset($data['payMethod']) ? trim($data['payMethod']) : ''; $data['payType'] = $model->getPayTypeByMethod($payMethod); if ($data['payType'] == 1) { $data['bankCode'] = isset($data['huanqiuBankCode']) ? trim($data['huanqiuBankCode']) : ''; } if ($data['payType'] == 2) { $data['bankCode'] = isset($data['payflashBankCode']) ? trim($data['payflashBankCode']) : ''; //支付方式 } if ($data['payType'] == 4) { $data['bankCode'] = isset($data['chuanghuiBankCode']) ? trim($data['chuanghuiBankCode']) : ''; } if ($data['payType'] == 5) { $data['bankCode'] = isset($data['shanfutongBankCode']) ? trim($data['shanfutongBankCode']) : ''; } if ($data['payType'] == 6) { $data['bankCode'] = isset($data['kuaifuBankCode']) ? trim($data['kuaifuBankCode']) : ''; } if ($data['payType'] == 7) { $data['bankCode'] = isset($data['kuaifu2BankCode']) ? trim($data['kuaifu2BankCode']) : ''; } $model->setAttributes($data); if ($model->outPay()) { $result = $model->getOutPayResult(); if ($result['type'] == 'html') { if($data['payType'] == 1){ if($result['html']['code']==200){ $url = $result['html']['data']['url']; header("location:$url"); exit; }else{ echo $result['html']['message']; exit; } } return $result['html']; }else { throw new BadRequestHttpException('支付异常'); } } else { throw new BadRequestHttpException(json_encode($model->getErrors(), 320)); } } throw new BadRequestHttpException('Bad Request'); } public function actionSucceed() { return $this->render('succeed'); } public function actionFailed() { return $this->render('failed'); } public function sandPayHtmlHandler($result) { $jqueryJs = STATIC_URL.'/ui/js/sand/jquery-1.7.2.min.js'; $paymentJs = STATIC_URL.'/ui/js/sand/paymentjs.js'; $html = <<

{$result}

eot; return $html; } }