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

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

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

+ 6 - 3
app/controller/api/store/merchant/Merchant.php

@@ -181,10 +181,13 @@ class Merchant extends BaseController
181 181
             ->field('mer_id')
182 182
             ->select();
183 183
         if ($hasProductMerIdList) {
184
-            $where['mer_id'] = array_column($hasProductMerIdList->toArray(), 'mer_id');
184
+            $hasProductMerIdList = array_column($hasProductMerIdList->toArray(), 'mer_id');
185 185
         }
186
-
187
-        $mer_list = Db::name('merchant')->where($where)->page($page)->limit($limit)->select();
186
+        $query = Db::name('merchant')->where($where);
187
+        if (!empty($hasProductMerIdList) && is_array($hasProductMerIdList)) {
188
+            $query->whereIn('mer_id', $hasProductMerIdList);
189
+        }
190
+        $mer_list = $query->page($page)->limit($limit)->select();
188 191
         $where['is_gift_bag'] = 0;
189 192
         $where['is_used'] = 1;
190 193
         $where['product_type'] = 0;