|
@@ -17,8 +17,24 @@ export class AchievementService extends BaseService<modelType> {
|
|
|
uModel: ReturnModelType<typeof User>;
|
|
|
|
|
|
async list(query) {
|
|
|
- const { skip = 0, limit = 0, ...condition } = query;
|
|
|
- const data = await this.model.find(condition).skip(skip).limit(limit).lean();
|
|
|
+ const { skip = 0, limit = 0, is_use, status, ...condition } = query;
|
|
|
+ const { one, two, thr, four, five, six } = condition;
|
|
|
+ const info: any = { is_use, status };
|
|
|
+ if (one) info.technology = { $in: one };
|
|
|
+ if (two) info.field = { $in: two };
|
|
|
+ if (thr) info.mature = { $in: thr };
|
|
|
+ if (four) info.sell = { $in: four };
|
|
|
+ if (five) {
|
|
|
+ if (five === '1') info.money = '面议';
|
|
|
+ if (five === '2') info.money = { $gte: '1', $lte: '10' };
|
|
|
+ if (five === '3') info.money = { $gte: '10', $lte: '20' };
|
|
|
+ if (five === '4') info.money = { $gte: '20', $lte: '100' };
|
|
|
+ if (five === '5') info.money = { $gte: '100', $lte: '500' };
|
|
|
+ if (five === '6') info.money = { $gte: '500', $lte: '1000' };
|
|
|
+ if (five === '7') info.money = { $gte: '1000' };
|
|
|
+ }
|
|
|
+ if (six) info.area = { $in: six };
|
|
|
+ const data = await this.model.find(info).skip(skip).limit(limit).lean();
|
|
|
for (const val of data) {
|
|
|
if (get(val, 'user')) {
|
|
|
|
|
@@ -26,7 +42,7 @@ export class AchievementService extends BaseService<modelType> {
|
|
|
if (userData) Object.assign(val, { userName: userData.nick_name });
|
|
|
}
|
|
|
}
|
|
|
- const total = await this.model.count(condition);
|
|
|
+ const total = await this.model.count(info);
|
|
|
return { data, total };
|
|
|
}
|
|
|
|