Wechatqrcode.php
1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
use Action\WebAction;
use Shopping\PayModel;
use WebPlugin\Helpers;
class WechatqrcodeController extends WebAction
{
/**
* 微信扫码支付
*
* @param int order_code 订单号
*/
public function indexAction()
{
$uid = $this->getUid(true);
if (!$uid) {
$this->go(Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER'))));
}
$orderCode = $this->get('order_code', $this->get('ordercode'));
$data = PayModel::weixinQrcode($uid, $orderCode);
if (isset($data['error'])) {
$this->helpJsRedirect($data['message']);
}
$this->setSimpleHeader();
// 轮询是否支付成功地址
$data['payHost'] = Helpers::url('/pay/notice/wechatcallback', array('ordercode' => $orderCode));
// 支付成功跳转地址
$data['paySuccessUrl'] = Helpers::url('/pay/notice/wechatqrcodereturn', array('order_code' => $orderCode));
$this->_view->display('index', array(
'wechatqrcode' => $data,
'wechatqrcodePage' => true
));
}
}