dever 3 rokov pred
rodič
commit
190cd4e00c
3 zmenil súbory, kde vykonal 17 pridanie a 8 odobranie
  1. 1 1
      app/mshop/src/Buy.php
  2. 1 1
      app/mshop/src/Out.php
  3. 15 6
      app/shop/lib/Info.php

+ 1 - 1
app/mshop/src/Buy.php

@@ -11,7 +11,7 @@ class Buy extends Core
     public function getGoods()
     {
         Dever::config('base')->buy = 1;
-        $this->data['data'] = Dever::load('shop/lib/info')->getGoods($this->shop_id, false, '1,2,3', false, 1);
+        $this->data['data'] = Dever::load('shop/lib/info')->getGoods($this->shop_id, false, '1,2,3', false, 1, -1, 2);
 
         return $this->data;
 

+ 1 - 1
app/mshop/src/Out.php

@@ -10,7 +10,7 @@ class Out extends Core
     # 获取所有商品列表
     public function getGoods()
     {
-        $this->data['data'] = Dever::load('shop/lib/info')->getGoods($this->shop_id, false, '1,2,3');
+        $this->data['data'] = Dever::load('shop/lib/info')->getGoods($this->shop_id, false, '1,2,3', false, false, -1, 2);
 
         return $this->data;
     }

+ 15 - 6
app/shop/lib/Info.php

@@ -123,7 +123,7 @@ class Info
     }
 
     # 获取店铺的商品列表
-    public function getGoods($shop, $column = false, $price_type = false, $sell_type = false, $status = false, $uid = -1)
+    public function getGoods($shop, $column = false, $price_type = false, $sell_type = false, $status = false, $uid = -1, $buy_type = 1)
     {
         $table = 'shop/goods';
         $where['shop_id'] = isset($shop['id']) ? $shop['id'] : $shop;
@@ -163,14 +163,23 @@ class Info
             foreach ($data as $k => $v) {
                 $d = $this->getGoodsInfo($where['shop_id'], $v, false, true, true, $uid);
                 if ($d) {
-                    if ($d['total'] <= 0) {
-                        if ($d['sku_type'] == 2) {
-                            $result_2[] = $d;
+                    if ($buy_type == 1) {
+                        if ($d['total'] <= 0) {
+                            if ($d['sku_type'] == 2) {
+                                $result_2[] = $d;
+                            }
+                            // $result_2[] = $d;
+                        } else {
+                            $result_1[] = $d;
                         }
-                        // $result_2[] = $d;
                     } else {
-                        $result_1[] = $d;
+                        if ($d['total'] <= 0) {
+                            $result_2[] = $d;
+                        } else {
+                            $result_1[] = $d;
+                        }
                     }
+                    
                 }
             }