Forráskód Böngészése

Merge branch 'master' of ssh://git.dever.cc:10022/dever-product/churen

rabin 2 éve
szülő
commit
fede5b1862
2 módosított fájl, 40 hozzáadás és 30 törlés
  1. 9 5
      app/shop/lib/Sell.php
  2. 31 25
      app/shop/src/Buy.php

+ 9 - 5
app/shop/lib/Sell.php

@@ -850,12 +850,16 @@ class Sell
             # 2是库存不足
             $data['list'][$k]['ku_state'] = 1;
 
-            # 验证是否有货
-            $total = Dever::load('shop/lib/info')->checkTotal($n, $v, $data['shop']['id'], $s);
+            if ($data['list'][$k]['status'] == 2) {
+                $total = 0;
+            } else {
+                # 验证是否有货
+                $total = Dever::load('shop/lib/info')->checkTotal($n, $v, $data['shop']['id'], $s);
 
-            if (isset($data['list'][$k]['min']) && $data['list'][$k]['min'] > 0) {
-                if ($total < $data['list'][$k]['min']) {
-                    $total = 0;
+                if (isset($data['list'][$k]['min']) && $data['list'][$k]['min'] > 0) {
+                    if ($total < $data['list'][$k]['min']) {
+                        $total = 0;
+                    }
                 }
             }
 

+ 31 - 25
app/shop/src/Buy.php

@@ -98,34 +98,40 @@ class Buy extends Core
 		$where['uid'] = $this->uid;
 		$where['shop_id'] = $this->shop_id;
 
-		$this->data['cart'] = Dever::db('shop/cart')->select($where);
-
-		if ($this->data['cart']) {
-			foreach ($this->data['cart'] as $k => $v) {
-				$this->data['cart'][$k]['goods'] = Dever::load('goods/lib/info')->getPayInfo($v['goods_id'], $v['sku_id']);
-
-				$w = array();
-	            $w['goods_id'] = $v['goods_id'];
-	            $w['sku_id'] = $v['sku_id'];
-	            $w['shop_id'] = $this->shop_id;
-	            $goods_sku = Dever::db('shop/goods_sku')->find($w);
-	            if ($goods_sku) {
-	                if (isset($goods_sku['price_id']) && $goods_sku['price_id'] > 0) {
-	                    $price_template = Dever::load('price/lib/data')->get($v['goods_id'], $v['sku_id'], $goods_sku['price_id']);
-	                    if ($price_template) {
-	                        if ($price_template['price_sell'] && $price_template['price_sell'] > 0) {
-	                            $this->data['cart'][$k]['goods']['price'] = $price_template['price_sell'];
-	                        }
-	                    }
-	                }
-	            }
-
-				if (isset($this->data['cart'][$k]['goods']['sku_id'])) {
-					$this->data['cart'][$k]['price_id'] = $this->data['cart'][$k]['goods']['sku_id'];
+		$cart = Dever::db('shop/cart')->select($where);
+
+		$this->data['cart'] = array();
+		$i = 0;
+		if ($cart) {
+			foreach ($cart as $k => $v) {
+				$goods = Dever::load('goods/lib/info')->getPayInfo($v['goods_id'], $v['sku_id']);
+				if ($goods && $goods['status'] == 1) {
+					$this->data['cart'][$i] = $v;
+					$this->data['cart'][$i]['goods'] = $goods;
+
+					$w = array();
+		            $w['goods_id'] = $v['goods_id'];
+		            $w['sku_id'] = $v['sku_id'];
+		            $w['shop_id'] = $this->shop_id;
+		            $goods_sku = Dever::db('shop/goods_sku')->find($w);
+		            if ($goods_sku) {
+		                if (isset($goods_sku['price_id']) && $goods_sku['price_id'] > 0) {
+		                    $price_template = Dever::load('price/lib/data')->get($v['goods_id'], $v['sku_id'], $goods_sku['price_id']);
+		                    if ($price_template) {
+		                        if ($price_template['price_sell'] && $price_template['price_sell'] > 0) {
+		                            $this->data['cart'][$i]['goods']['price'] = $price_template['price_sell'];
+		                        }
+		                    }
+		                }
+		            }
+
+					if (isset($this->data['cart'][$i]['goods']['sku_id'])) {
+						$this->data['cart'][$i]['price_id'] = $this->data['cart'][$i]['goods']['sku_id'];
+					}
+					$i++;
 				}
 			}
 		}
-
 		return $this->data['cart'];
 	}