Просмотр исходного кода

客户端-暂时修复商贸区翻页问题

sunxbiao 1 год назад
Родитель
Сommit
50bc2ea364
1 измененных файлов с 13 добавлено и 1 удалено
  1. 13 1
      app/controller/api/store/merchant/Merchant.php

+ 13 - 1
app/controller/api/store/merchant/Merchant.php

@@ -172,7 +172,19 @@ class Merchant extends BaseController
172 172
         $where['is_del'] = 0;
173 173
         $where['status'] = 1;
174 174
         $category_id && $where['category_id'] = $category_id;
175
-        $mer_list = Db::name('merchant')->where($where)->page($page)->limit(100)->select();
175
+
176
+        $hasProductMerIdList = Db::name('store_product')
177
+            ->where('status', '=', 1)
178
+            ->where('is_show', '=', 1)
179
+            ->where('is_del', '=', 0)
180
+            ->group('mer_id')
181
+            ->field('mer_id')
182
+            ->select();
183
+        if ($hasProductMerIdList) {
184
+            $where['mer_id'] = array_column($hasProductMerIdList->toArray(), 'mer_id');
185
+        }
186
+
187
+        $mer_list = Db::name('merchant')->where($where)->page($page)->limit($limit)->select();
176 188
         $where['is_gift_bag'] = 0;
177 189
         $where['is_used'] = 1;
178 190
         $where['product_type'] = 0;