Browse Source

sunguidong

sgd521 2 years ago
parent
commit
9c093cb75a
2 changed files with 9 additions and 2 deletions
  1. 6 0
      app/model/goods/Goods.php
  2. 3 2
      app/shop/controller/Goods.php

+ 6 - 0
app/model/goods/Goods.php

@@ -434,6 +434,12 @@ class Goods extends BaseModel
 		$info = model('goods')->getInfo($condition, $field);
 		return $this->success($info);
 	}
+    public function count_image($image){
+        $num  = count($image);
+        if($num>5){
+            return $this->error('上传图片上线为五张');
+        }
+    }
 	
 	/**
 	 * 获取商品详情

+ 3 - 2
app/shop/controller/Goods.php

@@ -191,8 +191,9 @@ class Goods extends BaseShop
 			$weight = input("weight", "");// 重量
 			$volume = input("volume", "");// 体积
             $imgae = explode(',',$goods_image);
-            if(count($imgae)){
-                return $this->error('图片上传数量上限为5张');
+            if(count($imgae)>5){
+                $res = $goods_model->count_image($imgae);
+                return $res;
             }
 			$data = [
 				'goods_name' => $goods_name,