shish 4 years ago
parent
commit
5ad263e5fe
1 changed files with 6 additions and 29 deletions
  1. 6 29
      common/components/business.php

+ 6 - 29
common/components/business.php

@@ -39,49 +39,26 @@ class business
     {
         $shopImg = isset($info['shopImg']) ? $info['shopImg'] : [];
         unset($info['shopImg']);
-        //没有保存图片返回空
         if (empty($shopImg)) {
-            $info['shortImgList'] = [];
-            $info['imgList'] = [];
-            $info['smallImgList'] = [];
+            $info['shortImgList'] = ['/hhb_small.png'];
+            $info['imgList'] = [imgUtil::groupImg('')];
+            $info['smallImgList'] = [imgUtil::groupImg('')];
             return $info;
         }
         $arr = json_decode($shopImg, true);
-        //图片内容转化失败返回空
         if (is_array($arr) == false) {
-            $info['shortImgList'] = [];
-            $info['imgList'] = [];
-            $info['smallImgList'] = [];
+            $info['shortImgList'] = ['/hhb_small.png'];
+            $info['imgList'] = [imgUtil::groupImg('')];
+            $info['smallImgList'] = [imgUtil::groupImg('')];
             return $info;
         }
         $imgList = [];
         $smallImgList = [];
         $prefixImgUrl = imgUtil::getPrefix();
-        $imageRoot = dirUtil::getImgUploadDir();
         foreach ($arr as $imgUrl) {
             $smallImg = self::getSmallImg($imgUrl);
             $small = $prefixImgUrl . $smallImg;
             $normal = $prefixImgUrl . $imgUrl;
-
-            /*
-            $preImg = $imageRoot . str_replace('/uploads', '', $imgUrl);
-            if (file_exists($preImg)) {
-                //没有小图则生成小图,兼容旧系统
-                if (file_exists($imageRoot . $smallImg) == false) {
-                    $imgInfo = getimagesize($preImg);
-                    $width = isset($imgInfo[0]) ? $imgInfo[0] : 0;
-                    $height = isset($imgInfo[1]) ? $imgInfo[1] : 0;
-                    if ($width > 0) {
-                        //生成小图 300px
-                        $smallWidth = 300;
-                        $smallHeight = ceil((300 * $height) / $width);
-                        $smallFullPathFile = $imageRoot . str_replace('/uploads', '', $smallImg);
-                        Image::thumbnail($preImg, $smallWidth, $smallHeight)->save($smallFullPathFile, ['quality' => 100]);
-                    }
-                }
-            }
-            */
-
             $imgList[] = $normal;
             $smallImgList[] = $small;
         }