wesmiler 1 неделя назад
Родитель
Сommit
5505882046
1 измененных файлов с 5 добавлено и 23 удалено
  1. 5 23
      app/Services/Common/GoodsService.php

+ 5 - 23
app/Services/Common/GoodsService.php

@@ -117,15 +117,15 @@ class GoodsService extends BaseService
             $where['status'] = $status;
         }
 
-        // 企业支持:如果当前登录用户关联了企业信息,则只查询该企业的商品
-        if (isset($params['store_id']) && $params['store_id'] > 0) {
-            $where['store_id'] = $params['store_id'];
-        }
-
         if (isset($params['is_recommend']) && $params['is_recommend'] > 0) {
             $where['is_recommend'] = $params['is_recommend'];
         }
 
+        // 专区类型
+        if (isset($params['zone_type']) && $params['zone_type'] > 0) {
+            $where['zone_type'] = $params['zone_type'];
+        }
+
         // 分类筛选
         $categoryId = isset($params['category_id']) ? intval($params['category_id']) : 0;
         if ($categoryId > 0) {
@@ -142,13 +142,6 @@ class GoodsService extends BaseService
                 $query->where('goods_name', 'like', "%{$goodsName}%");
             }
 
-            // 企业名称搜索(通过关联stores表)
-            $storeName = isset($params['store_name']) ? trim($params['store_name']) : '';
-            if ($storeName) {
-                $query->whereHas('store', function ($q) use ($storeName) {
-                    $q->where('nickname', 'like', "%{$storeName}%");
-                });
-            }
         });
 
         return $model;
@@ -200,17 +193,6 @@ class GoodsService extends BaseService
         }
         $data['content'] = (string)$contentValue;
 
-        // 数据隔离:商户用户添加商品时自动设置 store_id
-        if ($storeId > 0) {
-            // 商户用户:自动设置 store_id
-            $data['store_id'] = $storeId;
-        } else {
-            // 超级管理员:如果没有指定 store_id,默认为 0(平台)
-            if (!isset($data['store_id'])) {
-                $data['store_id'] = 0;
-            }
-        }
-
         // 确保不包含 id 字段(新增不应该有 id)
         unset($data['id']);