瀏覽代碼

sunguidong

zhangguidong 2 年之前
父節點
當前提交
f74b26d237
共有 3 個文件被更改,包括 15 次插入1 次删除
  1. 10 0
      app/model/goods/Goods.php
  2. 4 0
      app/shop/controller/Goods.php
  3. 1 1
      app/shop/view/invoice/edit.html

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

@@ -477,6 +477,16 @@ class Goods extends BaseModel
             return $this->error('上传图片上限为五张','上传图片上限为五张');
         }
     }
+    public function goods_sku($sku_data){
+       $sku =  json_decode($sku_data, true);
+       foreach ($sku as $item){
+           if(empty($item['price'])||$item['price']<1) {
+               return $this->error('请正确填写规格信息');
+           }
+       }
+
+
+    }
 	
 	/**
 	 * 获取商品详情

+ 4 - 0
app/shop/controller/Goods.php

@@ -197,6 +197,10 @@ class Goods extends BaseShop
                 $res = $goods_model->count_image($imgae);
                 return $res;
             }
+            if($goods_sku_data){
+                $res = $goods_model->goods_sku($goods_sku_data);
+                return $res;
+            }
 			$data = [
 				'goods_name' => $goods_name,
 				'goods_attr_class' => $goods_attr_class,

+ 1 - 1
app/shop/view/invoice/edit.html

@@ -54,7 +54,7 @@
 		//普通图片上传
 		var uploadInst = upload.render({
 			elem: '#imgUpload',
-			url: ns.url("shop/upload/video"),
+			url: ns.url("shop/upload/image"),
 			done: function (res) {
 				if (res.code >= 0) {
 					file = res.data.pic_path;