public function qrcode() { $payQrcodeId = I('get.id'); $m = M('Company_pay_qrcode'); $result = $m->find($payQrcodeId); if ($result) { $companyInfo = $this->getCompanyInfo(); if ($companyInfo) { $options = array('appid' => $companyInfo['weixin_AppId'], 'appsecret' => $companyInfo['weixin_AppSecret'], 'partnerid' => $companyInfo['weixin_PartnerID'], 'partnerkey' => $companyInfo['weixin_PartnerKey'], 'paysignkey' => $companyInfo['weixin_PaySignKey']); $wechat = new \Org\Weixin\Wechat($options); $url = $wechat->createNativeUrl('pay_' . $payQrcodeId); Vendor('phpQrcode.phpqrcode'); $errorCorrectionLevel = "L"; $matrixPointSize = "4"; \QRcode::png($url, false, $errorCorrectionLevel, $matrixPointSize); } } }
public function qrcode() { $orderNo = session('orderId'); $m = M('Company_order'); $result = $m->find($orderNo); if ($result) { if ($result['payType'] == 'wechatpay') { if ($result['sign'] == 0) { $companyInfo = $this->getCompanyInfo(); if ($companyInfo) { $options = array('appid' => $companyInfo['weixin_AppId'], 'appsecret' => $companyInfo['weixin_AppSecret'], 'partnerid' => $companyInfo['weixin_PartnerID'], 'partnerkey' => $companyInfo['weixin_PartnerKey'], 'paysignkey' => $companyInfo['weixin_PaySignKey']); $wechat = new \Org\Weixin\Wechat($options); $url = $wechat->createNativeUrl('order_' . $result['orderNo']); Vendor('phpQrcode.phpqrcode'); $errorCorrectionLevel = "L"; $matrixPointSize = "4"; \QRcode::png($url, false, $errorCorrectionLevel, $matrixPointSize); } } else { } } else { } } }