Authored by 郝肖肖

weixin openid cookile

... ... @@ -122,7 +122,7 @@ class JsApiPay
//取出openid
$data = json_decode($res, true);
//初始化
if (empty($data)) {
if (empty($data) || empty($data['openid'])) {
$data['access_token'] = false;
$data['openid'] = false;
}
... ...
... ... @@ -982,12 +982,12 @@ class HomeController extends AbstractAction
$hasWxShare = strpos($this->server('HTTP_USER_AGENT', ''), 'MicroMessenger') !== false;
if ($hasWxShare) {
$openId = $this->getCookie('weixinOpenId' . $orderCode);
$openId = $this->getSession('weixinOpenId' . $orderCode);
if (empty($openId)) {
$tools = new JsApiPay();
$openId = $tools->GetOpenid();
if ($openId) {
$this->setCookie('weixinOpenId' . $orderCode, $openId, 600);
$this->setSession('weixinOpenId' . $orderCode, $openId);
}
}
}
... ... @@ -1050,7 +1050,7 @@ class HomeController extends AbstractAction
}
$totalFee = strval($orderDetail['data']['payment_amount'] * 100);
$openId = $this->getCookie('weixinOpenId' . $orderCode);
$openId = $this->getSession('weixinOpenId' . $orderCode);
if (empty($openId)) {
UdpLog::info('【微信支付下单】Session中的weixinOpenId校验','weixinOpenId为空');
break;
... ...
... ... @@ -121,7 +121,7 @@ class PayController extends AbstractAction
}
$totalFee = strval($orderDetail['data']['payment_amount'] * 100);
$openId = $this->getCookie('weixinOpenId' . $orderCode);
$openId = $this->getSession('weixinOpenId' . $orderCode);
if (empty($openId)) {
UdpLog::info('【wechat支付】获取wechat标识为空', 'orderCode:'.$orderCode.'uid:'.$uid.'返回openId:'.$openId);
break;
... ...