浏览代码

获取商品列表-求购商品搜索问题

15313670163 6 天之前
父节点
当前提交
da93651085
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      app/JsonRpc/NewsService.php

+ 2 - 2
app/JsonRpc/NewsService.php

@@ -1629,7 +1629,7 @@ class NewsService implements NewsServiceInterface
             ->select('good.id', 'good.name', 'good.imgurl', 'good.description', 'good.updated_at', 
             'good.catid','good.type_id','good.website_id','good.cat_arr_id','good.created_at','good.city_id')
             ->latest('updated_at');
-            $result['type1_count'] = $query->where('type_id', 1)->count();
+            $result['type1_count'] = $query->clone()->where('type_id', 1)->count();
             // 获取 type_id 为 1 的数据
             $result['type1'] = $this->processGoods(
                 $query->clone()
@@ -1639,7 +1639,7 @@ class NewsService implements NewsServiceInterface
                     ->get(),
                 $data
             );
-            $result['type2_count'] = $query->where('type_id', 2)->count();
+            $result['type2_count'] = $query->clone()->where('type_id', 2)->count();
             // 获取 type_id 为 2 的数据
             $result['type2'] = $this->processGoods(
                 $query->clone()