|
@@ -11,15 +11,17 @@ export class CarService extends BaseService<modelType> {
|
|
|
model: modelType;
|
|
|
async queryList(filter) {
|
|
|
const { skip = 0, limit, money, year, ...info } = filter;
|
|
|
+ // 处理车龄
|
|
|
+ if (year) info.age = { $lte: year.match(/(\S*)年/)[1] };
|
|
|
// 处理价格
|
|
|
if (money) {
|
|
|
- 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] };
|
|
|
+ if (money.indexOf('下') !== -1) {
|
|
|
+ info.total_money = { $lte: money.match(/(\S*)万/)[1] };
|
|
|
+ } else if (money.indexOf('上') !== -1) {
|
|
|
+ info.total_money = { $gte: 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] };
|
|
|
+ info.total_money = { $gte: mon.match(/(\S*)-/)[1], $lte: mon.match(/-(\S*)/)[1] };
|
|
|
}
|
|
|
}
|
|
|
const pipes: any[] = [
|