zs 1 year ago
parent
commit
ebbb9ca46b
1 changed files with 9 additions and 3 deletions
  1. 9 3
      src/service/car.service.ts

+ 9 - 3
src/service/car.service.ts

@@ -10,11 +10,17 @@ export class CarService extends BaseService<modelType> {
   @InjectEntityModel(Car)
   model: modelType;
   async queryList(filter) {
-    const { skip = 0, limit, money, ...info } = filter;
+    const { skip = 0, limit, money, year, ...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] };
+      if (money.includes('下') !== -1) {
+        info.total_money = { $lt: money.match(/(\S*)万/)[1] };
+      } else if (money.includes('上') !== -1) {
+        info.total_money = { $gt: money.match(/(\S*)万/)[1] };
+      } else {
+        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 },