Преглед на файлове

平台后台-订单列表-支持关键字搜索订单数据

Xpy преди 8 месеца
родител
ревизия
1baeefd9fa
променени са 2 файла, в които са добавени 14 реда и са изтрити 1 реда
  1. 13 0
      app/common/dao/store/order/StoreOrderProductDao.php
  2. 1 1
      app/common/repositories/store/order/StoreOrderProductRepository.php

+ 13 - 0
app/common/dao/store/order/StoreOrderProductDao.php

@@ -143,4 +143,17 @@ class StoreOrderProductDao extends BaseDao
143 143
                 $query->where('B.mer_id', $merId);
144 144
             })->where('B.paid', 1)->group('B.mer_id')->limit($limit)->order('total DESC')->select();
145 145
     }
146
+
147
+    /**
148
+     * @param $keyword
149
+     * @return array
150
+     */
151
+    public function getOrderIdListByKeyword($keyword): array
152
+    {
153
+        /** @var StoreOrderProduct $model */
154
+        $model = $this->getModel();
155
+        return $model::getDB()
156
+            ->whereRaw("JSON_UNQUOTE(JSON_EXTRACT(cart_info, '$.product.store_name')) LIKE ?", ["%{$keyword}%"])
157
+            ->column('order_id');
158
+    }
146 159
 }

+ 1 - 1
app/common/repositories/store/order/StoreOrderProductRepository.php

@@ -42,6 +42,6 @@ class StoreOrderProductRepository extends BaseRepository
42 42
      */
43 43
     public function getOrderIdListByKeyword($keyword): array
44 44
     {
45
-        return $this->dao->selectWhere(['cart_info'=> ['like', '%' . $keyword . '%']])->column('order_id');
45
+        return $this->dao->getOrderIdListByKeyword($keyword);
46 46
     }
47 47
 }