diff --git a/app/api/controller/order/CartController.php b/app/api/controller/order/CartController.php index c5f07032..302fb8ba 100644 --- a/app/api/controller/order/CartController.php +++ b/app/api/controller/order/CartController.php @@ -29,10 +29,15 @@ class CartController extends BaseApiController //判断起批发价 $branchProduct = StoreBranchProduct::where( [ - 'product_id' => $params['product_id'], - 'store_id' => $params['store_id'] + 'id' => $params['product_id'], ] )->find(); + // $branchProduct = StoreBranchProduct::where( + // [ + // 'product_id' => $params['product_id'], + // 'store_id' => $params['store_id'] + // ] + // )->find(); if (!$branchProduct) { return $this->fail('商品不存在'); } diff --git a/app/api/lists/order/CartList.php b/app/api/lists/order/CartList.php index a16c31e0..7107435f 100644 --- a/app/api/lists/order/CartList.php +++ b/app/api/lists/order/CartList.php @@ -10,6 +10,7 @@ use app\common\lists\ListsExtendInterface; use app\common\model\Config; use app\common\model\dict\DictType; use app\common\model\store_branch_product\StoreBranchProduct; +use app\common\model\store_product\StoreProduct; use app\common\model\store_product_attr_value\StoreProductAttrValue; use app\common\model\store_product_unit\StoreProductUnit; use app\common\model\user\User; @@ -65,14 +66,14 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists ->toArray(); $off_activity = Config::where('name', 'off_activity')->value('value'); $user_ship = User::where('id', $userId)->value('user_ship'); - $field = 'product_id,image,price,cost,store_name,unit,delete_time,vip_price,top_cate_id'; + $field = 'id,image,price,cost,store_name,unit,delete_time,vip_price,top_cate_id'; if (in_array($user_ship, [4, 6, 7])) { - $field = 'product_id,image,cost price,cost,store_name,unit,delete_time,vip_price,top_cate_id'; + $field = 'id,image,cost price,cost,store_name,unit,delete_time,vip_price,top_cate_id'; } $this->user_ship = $user_ship; $this->off_activity = $off_activity; foreach ($list as $key => &$item) { - $find = StoreBranchProduct::where(['product_id' => $item['product_id'], 'store_id' => $item['store_id']]) + $find = StoreProduct::where(['id' => $item['product_id']]) ->field($field) ->find(); if ($find) { diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php index d15d822f..4dfd9ffc 100644 --- a/app/api/lists/product/ProductLists.php +++ b/app/api/lists/product/ProductLists.php @@ -35,7 +35,7 @@ class ProductLists extends BaseApiDataLists implements ListsSearchInterface, Lis public function setSearch(): array { return [ - '=' => ['store_id', 'cate_id', 'top_cate_id', 'two_cate_id'], + '=' => ['cate_id', 'top_cate_id', 'two_cate_id'], '%pipe_like%' => ['store_name' => 'store_name|bar_code'], ]; } @@ -79,7 +79,7 @@ class ProductLists extends BaseApiDataLists implements ListsSearchInterface, Lis } else { $order = [$field => $order]; } - $fields = 'id,product_id,top_cate_id,cate_id,store_name,cost,store_id,vip_price,purchase,price,bar_code,image,sales,store_info,delete_time,unit,batch,top_cate_id,two_cate_id,stock'; + $fields = 'id,top_cate_id,cate_id,store_name,cost,vip_price,purchase,price,bar_code,image,sales,store_info,delete_time,unit,batch,top_cate_id,two_cate_id,stock'; $off_activity = Config::where('name', 'off_activity')->value('value'); if ($off_activity == 1) { $tag = '赠10%品牌礼品券'; @@ -96,18 +96,19 @@ class ProductLists extends BaseApiDataLists implements ListsSearchInterface, Lis if ($uid > 0) { $user_ship = User::where('id', $uid)->value('user_ship'); if (in_array($user_ship, [4, 6, 7])) { - $fields = 'id,product_id,top_cate_id,cate_id,store_name,cost,store_id,vip_price,purchase,cost price,bar_code,image,sales,store_info,delete_time,unit,batch,top_cate_id,two_cate_id,stock'; + $fields = 'id,top_cate_id,cate_id,store_name,cost,vip_price,purchase,cost price,bar_code,image,sales,store_info,delete_time,unit,batch,top_cate_id,two_cate_id,stock'; } } $this->off_activity = $off_activity; - $this->searchWhere[] = ['status', '=', 1]; + $this->searchWhere[] = ['is_show', '=', 1]; // $this->searchWhere[] = ['stock', '>', 0]; - return StoreBranchProduct::where($this->searchWhere) + return StoreProduct::where($this->searchWhere) ->field($fields) ->with(['className', 'unitName']) ->limit($this->limitOffset, $this->limitLength) ->order($order) - ->select()->each(function ($item) use ($tag, $off_activity, $user_ship) { + ->select() + ->each(function ($item) use ($tag, $off_activity, $user_ship) { if ($off_activity == 0 && $user_ship == 5 && $item['top_cate_id'] == 15189) { $item['price'] = $item['cost']; } @@ -126,7 +127,7 @@ class ProductLists extends BaseApiDataLists implements ListsSearchInterface, Lis */ public function count(): int { - return StoreBranchProduct::where($this->searchWhere) + return StoreProduct::where($this->searchWhere) ->count(); } public function extend()