|
@@ -34,7 +34,7 @@ class DistProduct extends Model
|
|
// 静态方法用于查询单个产品
|
|
// 静态方法用于查询单个产品
|
|
public static function getProduct($productId)
|
|
public static function getProduct($productId)
|
|
{
|
|
{
|
|
- return self::where('enabled', 1)->with('images')->find($productId);
|
|
|
|
|
|
+ return self::where('enabled', 1)->where('dist_id', getDistId())->with('images')->find($productId);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -42,12 +42,13 @@ class DistProduct extends Model
|
|
// 静态方法用于查询多个产品
|
|
// 静态方法用于查询多个产品
|
|
public static function getProducts($categoryId = null, $limit = null)
|
|
public static function getProducts($categoryId = null, $limit = null)
|
|
{
|
|
{
|
|
- $dist=app('dist');
|
|
|
|
|
|
+
|
|
|
|
|
|
$query = self::query();
|
|
$query = self::query();
|
|
|
|
|
|
$query->where('enabled', 1);
|
|
$query->where('enabled', 1);
|
|
- $query->where('dist_id', $dist->id);
|
|
|
|
|
|
+
|
|
|
|
+ $query->where('dist_id', getDistId());
|
|
|
|
|
|
// 如果提供了分类 ID,添加过滤条件
|
|
// 如果提供了分类 ID,添加过滤条件
|
|
if ($categoryId) {
|
|
if ($categoryId) {
|