Browse Source

Wesmiler 时光单身NN2019120501项目迁移

wesmiler 5 years ago
parent
commit
29361c55e4

+ 2 - 2
app/api/controller/MarketController.php

@@ -84,8 +84,8 @@ class MarketController extends MarketBaseController
             if ($type == 2) {
                 // 团队邀请二维码
                 $inviteUrl = url('/weixin/market/entry?sid='.$userId, '', '', true);
-                $qrcodeData = Wechat::makeNormalQrcode($inviteUrl);
-                $memberInfo['team_qrcode'] = isset($qrcodeData['qrcode']) ? $qrcodeData['qrcode'] : '';
+                $qrcode = Wechat::makeNormalQrcode($inviteUrl);
+                $memberInfo['team_qrcode'] = $qrcode ? $qrcode : '';
 
                 // 会员邀请二维码
                 $qrcodeData = Wechat::makeQrcode($userId, $userId);

+ 13 - 4
app/weixin/model/Wechat.php

@@ -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;
     }
 

+ 0 - 10
public/themes/default/weixin/public/assets/js/market-invite.js

@@ -30,16 +30,6 @@ var app = new Vue({
         var _this = this;
         _this.getSiteInfo();
         _this.getInfo(0);
-
-        _this.timerId = setInterval(function(){
-            if(_this.count < 100){
-                _this.getInfo(1);
-                _this.count++;
-            }else{
-                clearInterval(_this.timerId);
-            }
-
-        }, 8000);
     },
     methods: {
         // 获取用户信息