Ver Fonte

修改查询

zs há 1 ano atrás
pai
commit
8d0befbded
1 ficheiros alterados com 6 adições e 1 exclusões
  1. 6 1
      src/service/car.service.ts

+ 6 - 1
src/service/car.service.ts

@@ -10,7 +10,12 @@ export class CarService extends BaseService<modelType> {
   @InjectEntityModel(Car)
   model: modelType;
   async queryList(filter) {
-    const { skip = 0, limit, ...info } = filter;
+    const { skip = 0, limit, money, ...info } = filter;
+    // 处理价格
+    if (money) {
+      const mon = money.substr(0, money.length - 1);
+      info.total_money = { $gt: mon.match(/(\S*)-/)[1], $lt: mon.match(/-(\S*)/)[1] };
+    }
     const pipes: any[] = [
       { $match: info },
       {