|
@@ -37,6 +37,10 @@ class SysLogService extends Service {
|
|
if (data.state) {
|
|
if (data.state) {
|
|
where.state = data.state;
|
|
where.state = data.state;
|
|
}
|
|
}
|
|
|
|
+ if (data.startTime && data.endTime) {
|
|
|
|
+ where.time = { $gte: data.startTime + ' 00:00:00', $lt: data.endTime + ' 23:59:59' };
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
this.ctx.logger.info('条件', where);
|
|
this.ctx.logger.info('条件', where);
|
|
|
|
|
|
@@ -63,6 +67,21 @@ class SysLogService extends Service {
|
|
select: 'name',
|
|
select: 'name',
|
|
},
|
|
},
|
|
];
|
|
];
|
|
|
|
+
|
|
|
|
+ const nowday = new Date();
|
|
|
|
+ const finalday = nowday.getFullYear()+"-"+(nowday.getMonth()+1)+"-"+nowday.getDate();
|
|
|
|
+ const match ={};
|
|
|
|
+ match.time = { $gte: finalday+ ' 00:00:00', $lt: finalday + ' 23:59:59'};
|
|
|
|
+ const nowdaytotal = await model.SysLogModel.aggregate([
|
|
|
|
+ { $project: {time: { $dateToString: { format: "%Y-%m-%d %H:%M:%S", date: "$time" } },_id:1}},
|
|
|
|
+ { $match : match },
|
|
|
|
+ { $group: { _id: '$_id' } },
|
|
|
|
+ { $count:'total'}
|
|
|
|
+ ]);
|
|
|
|
+ let nowdaynum = 0
|
|
|
|
+ if(nowdaytotal.length>0){
|
|
|
|
+ nowdaynum = nowdaytotal[0].total
|
|
|
|
+ }
|
|
const total = await model.SysLogModel.find(where).populate(pop).countDocuments();
|
|
const total = await model.SysLogModel.find(where).populate(pop).countDocuments();
|
|
const result = await model.SysLogModel.find(where).populate(pop).skip((page - 1) * rows)
|
|
const result = await model.SysLogModel.find(where).populate(pop).skip((page - 1) * rows)
|
|
.limit(rows)
|
|
.limit(rows)
|
|
@@ -70,6 +89,7 @@ class SysLogService extends Service {
|
|
return {
|
|
return {
|
|
count: total,
|
|
count: total,
|
|
list: result,
|
|
list: result,
|
|
|
|
+ nowdaytotal:nowdaynum,
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|