Wechatqrcode.php
1.03 KB
<?php
use Action\WebAction;
use Shopping\PaymentModel;
use WebPlugin\Helpers;
class WechatqrcodeController extends WebAction
{
/**
* 微信扫码支付
*
* @param int order_code 订单号
*/
public function indexAction()
{
$this->autoLogin();
$orderCode = $this->get('order_code', $this->get('ordercode'));
$data = PaymentModel::weixinQrcode($orderCode);
if (empty($data['code']) || $data['code'] !== 200) {
$this->helpJsRedirect($data['message']);
}
$this->setSimpleHeader();
// 轮询是否支付成功地址
$data['payHost'] = Helpers::url('/pay/payreturn/wechatcallback', array('ordercode' => $orderCode));
// 支付成功跳转地址
$data['paySuccessUrl'] = Helpers::url('/pay/payreturn/wechatqrcodereturn', array('order_code' => $orderCode));
$this->_view->display('index', array(
'wechatqrcode' => $data,
'wechatqrcodePage' => true
));
}
}