소스 검색

商家首页显示

shish 6 년 전
부모
커밋
2eb93630b5
2개의 변경된 파일15개의 추가작업 그리고 12개의 파일을 삭제
  1. 14 11
      common/components/business.php
  2. 1 1
      console/controllers/UpgradeController.php

+ 14 - 11
common/components/business.php

@@ -5,6 +5,7 @@
  */
 
 namespace common\components;
+
 use Yii;
 use yii\imagine\Image;
 
@@ -61,17 +62,19 @@ class business
 			$smallImg = self::getSmallImg($imgUrl);
 			$small = $prefixImgUrl . $smallImg;
 			$normal = $prefixImgUrl . $imgUrl;
-			//没有小图则生成小图,兼容旧系统
-			if (file_exists($imageRoot . $smallImg) == false) {
-				$preImg = $imageRoot . str_replace('/uploads', '', $imgUrl);
-				$imgInfo = getimagesize($preImg);
-				$width = $imgInfo[0];
-				$height = $imgInfo[1];
-				//生成小图 200px
-				$smallWidth = 200;
-				$smallHeight = ceil((200 * $height) / $width);
-				$smallFullPathFile = $imageRoot . str_replace('/uploads', '', $smallImg);
-				Image::thumbnail($preImg, $smallWidth, $smallHeight)->save($smallFullPathFile, ['quality' => 100]);
+			$preImg = $imageRoot . str_replace('/uploads', '', $imgUrl);
+			if (file_exists($preImg)) {
+				//没有小图则生成小图,兼容旧系统
+				if (file_exists($imageRoot . $smallImg) == false) {
+					$imgInfo = getimagesize($preImg);
+					$width = $imgInfo[0];
+					$height = $imgInfo[1];
+					//生成小图 200px
+					$smallWidth = 200;
+					$smallHeight = ceil((200 * $height) / $width);
+					$smallFullPathFile = $imageRoot . str_replace('/uploads', '', $smallImg);
+					Image::thumbnail($preImg, $smallWidth, $smallHeight)->save($smallFullPathFile, ['quality' => 100]);
+				}
 			}
 			$imgList[] = $normal;
 			$smallImgList[] = $small;

+ 1 - 1
console/controllers/UpgradeController.php

@@ -922,7 +922,7 @@ ALTER TABLE `xhMerchantCapital` MODIFY `io` TINYINT NOT NULL DEFAULT 0 COMMENT '
 		}
 		
 		//更新国兰的菜单分类
-		$sql = "truncate `xhCategory`;insert  into `xhCategory`(`id`,`parentId`,`merchantId`,`categoryName`,`description`,`img`,`goodsNum`,`sold`,`inTurn`,`status`) values (1,0,12358,'花束','唯美花束','',0,0,15,0),(2,0,12358,'花盒','时尚花盒','',0,0,14,0),(3,0,12358,'开业花篮','开业花篮','',0,0,0,0),(4,0,12358,'婚礼用花','婚礼用花','',0,0,0,0),(5,0,12358,'会议用花','会议用花','',0,0,0,0),(9,0,12358,'蝴蝶兰专区','蝴蝶兰','',0,0,4,0),(87,0,12358,'花篮','时尚礼篮','',0,0,4,0),(88,0,12358,'植物-微景观','植物-微景观','',0,0,4,0);";
+		$sql = "truncate `xhCategory`;insert  into `xhCategory`(`id`,`parentId`,`merchantId`,`categoryName`,`description`,`img`,`goodsNum`,`sold`,`inTurn`,`status`) values (1,0,12358,'花束','唯美花束','',0,0,15,1),(2,0,12358,'花盒','时尚花盒','',0,0,14,1),(3,0,12358,'开业花篮','开业花篮','',0,0,0,1),(4,0,12358,'婚礼用花','婚礼用花','',0,0,0,1),(5,0,12358,'会议用花','会议用花','',0,0,0,1),(9,0,12358,'蝴蝶兰专区','蝴蝶兰','',0,0,4,1),(87,0,12358,'花篮','时尚礼篮','',0,0,4,1),(88,0,12358,'植物-微景观','植物-微景观','',0,0,4,1);";
 		Yii::$app->db->createCommand($sql)->execute();
 		
 		//更新菜单与商品对应关系