Ver código fonte

一些功能

Kirin 4 anos atrás
pai
commit
8714b78290
1 arquivos alterados com 9 adições e 9 exclusões
  1. 9 9
      app/models/store/StoreProduct.php

+ 9 - 9
app/models/store/StoreProduct.php

@@ -193,8 +193,8 @@ class StoreProduct extends BaseModel
         if (!empty($list)) {
             foreach ($list as $k => $v) {
                 if ($store_id) {
-                    $stockinfo = SystemStoreProductStock::where('product_id', $list[$k]['id'])->where('store_id', $store_id)->find();
-                    $item['price'] = $stockinfo ? SystemStoreProductStock::where('product_id', $list[$k]['id'])->where('store_id', $store_id)->min('price') : $list[$k]['price'];
+                    $stockinfo = SystemStoreProductStock::where('product_id', $v['id'])->where('store_id', $store_id)->find();
+                    $list[$k]['price'] = $stockinfo ? SystemStoreProductStock::where('product_id', $v['id'])->where('store_id', $store_id)->min('price') : $v['price'];
                 }
                 $list[$k]['activity'] = self::activity($v['id']);
             }
@@ -219,8 +219,8 @@ class StoreProduct extends BaseModel
         if (!empty($list)) {
             foreach ($list as $k => $v) {
                 if ($store_id) {
-                    $stockinfo = SystemStoreProductStock::where('product_id', $list[$k]['id'])->where('store_id', $store_id)->find();
-                    $item['price'] = $stockinfo ? SystemStoreProductStock::where('product_id', $list[$k]['id'])->where('store_id', $store_id)->min('price') : $list[$k]['price'];
+                    $stockinfo = SystemStoreProductStock::where('product_id', $v['id'])->where('store_id', $store_id)->find();
+                    $list[$k]['price'] = $stockinfo ? SystemStoreProductStock::where('product_id', $v['id'])->where('store_id', $store_id)->min('price') : $v['price'];
                 }
                 $list[$k]['activity'] = self::activity($v['id']);
             }
@@ -270,9 +270,9 @@ class StoreProduct extends BaseModel
                 $list[$k]['activity'] = self::activity($v['id']);
 //                var_dump($store_id);
                 if ($store_id) {
-                    $stockinfo = SystemStoreProductStock::where('product_id', $list[$k]['id'])->where('store_id', $store_id)->find();
-                    var_dump($stockinfo);
-                    $item['price'] = $stockinfo ? SystemStoreProductStock::where('product_id', $list[$k]['id'])->where('store_id', $store_id)->min('price') : $list[$k]['price'];
+                    $stockinfo = SystemStoreProductStock::where('product_id', $v['id'])->where('store_id', $store_id)->find();
+//                    var_dump($stockinfo);
+                    $list[$k]['price'] = $stockinfo ? SystemStoreProductStock::where('product_id', $v['id'])->where('store_id', $store_id)->min('price') : $v['price'];
                 }
             }
         }
@@ -336,8 +336,8 @@ class StoreProduct extends BaseModel
         if (count($data) > 0) {
             foreach ($data as $k => $v) {
                 if ($store_id) {
-                    $stockinfo = SystemStoreProductStock::where('product_id', $data[$k]['id'])->where('store_id', $store_id)->find();
-                    $data['price'] = $stockinfo ? SystemStoreProductStock::where('product_id', $data[$k]['id'])->where('store_id', $store_id)->min('price') : $data[$k]['price'];
+                    $stockinfo = SystemStoreProductStock::where('product_id', $v['id'])->where('store_id', $store_id)->find();
+                    $data[$k]['price'] = $stockinfo ? SystemStoreProductStock::where('product_id', $v['id'])->where('store_id', $store_id)->min('price') : $v['price'];
                 }
                 $data[$k]['activity'] = self::activity($v['id']);
             }