lrf 2 년 전
부모
커밋
30273d5b9c
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      app/service/user/storeShop.js

+ 2 - 2
app/service/user/storeShop.js

@@ -35,9 +35,9 @@ class StoreShopService extends CrudService {
     const customer = _.get(this.ctx, 'user._id');
     assert(customer, '缺少用户信息');
     const { name, time } = query;
-    const searchPips = { };
+    const searchPips = [];
     const sort = { time: -1 };
-    if (name) searchPips.name = new RegExp(name);
+    if (name) searchPips.push({ $match: { name: new RegExp(name) } });
     if (time) sort.time = parseInt(time) || -1;
 
     const pipline = [{ $match: { customer } }];