|
|
@@ -32,8 +32,31 @@ class GiftCardQrCodeService
|
|
|
$app = Factory::miniProgram($config);
|
|
|
$accessToken = $app->access_token->getToken()['access_token'];
|
|
|
|
|
|
+ $url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={$accessToken}";
|
|
|
+
|
|
|
+ $data = [
|
|
|
+ 'scene' => $scene,
|
|
|
+ 'page' => $page,
|
|
|
+ 'width' => 280,
|
|
|
+ ];
|
|
|
+
|
|
|
+ $ch = curl_init();
|
|
|
+ curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
+ curl_setopt($ch, CURLOPT_POST, true);
|
|
|
+ curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
|
|
|
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
+ curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
|
|
+ 'Content-Type: application/json; charset=utf-8'
|
|
|
+ ]);
|
|
|
+ // 重要:设置二进制传输模式
|
|
|
+ curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
|
|
|
+
|
|
|
+ $response = curl_exec($ch);
|
|
|
+ $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
|
+ curl_close($ch);
|
|
|
+ return $httpCode;
|
|
|
$IMG = getQrCode($accessToken, $page.$scene, 'uploads/qrcode/', $cardPass);
|
|
|
- return $IMG;
|
|
|
+
|
|
|
// $result = $app->app_code->getUnlimited($page = 'pages/index/index', $width = 430);
|
|
|
// try {
|
|
|
// $accessToken = $app->access_token->getToken()['access_token'];
|