|
|
@@ -888,7 +888,9 @@ class Wechat
|
|
|
$ticket = isset($qrData['ticket']) ? $qrData['ticket'] : '';
|
|
|
$qrcode = sprintf(self::$apiUrl['getQrcodeByTicket'], $ticket);
|
|
|
$qrData['qrcode'] = Wechat::loadImage($qrcode, 'qrcode');
|
|
|
- return $qrData;
|
|
|
+ if($qrData['qrcode']){
|
|
|
+ return $qrData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (empty($token)) {
|
|
|
@@ -958,15 +960,18 @@ class Wechat
|
|
|
if(empty($qrcode) || $refresh){
|
|
|
$qrcodeContent = file_get_contents($file);
|
|
|
if($qrcodeContent){
|
|
|
- if(!is_dir("upload/{$type}/")){
|
|
|
- mkdir("upload/{$type}/", 0755, true);
|
|
|
+ if(!is_dir("upload/{$type}/weixin/")){
|
|
|
+ mkdir("upload/{$type}/weixin/", 0755, true);
|
|
|
}
|
|
|
- $qrcode = "{$type}/".md5($file).'.jpg';
|
|
|
+ $qrcode = "{$type}/weixin/QR_".md5($file).'.jpg';
|
|
|
file_put_contents("upload/".$qrcode, $qrcodeContent);
|
|
|
PRedis::set($key, $qrcode, 7 * 24 * 3600);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if(!file_exists('upload/'.$qrcode)){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
return cmf_get_image_preview_url($qrcode);
|
|
|
}
|
|
|
@@ -1543,12 +1548,16 @@ class Wechat
|
|
|
if (!is_dir($qrFile)) {
|
|
|
@mkdir('.' . $qrFile, 0755, true);
|
|
|
}
|
|
|
+
|
|
|
$qrFile = $qrFile . 'U_' . strtoupper(md5($str . '_' . $size)) . '.jpg';
|
|
|
if (is_file($qrFile) && !$refresh) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
QRcode::png($str, '.' . $qrFile, 2, $size, $margin);
|
|
|
+ if(!file_exists('.'.$qrFile)){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
return $qrFile;
|
|
|
}
|
|
|
|