|
@@ -108,6 +108,18 @@ class LookuserService extends CrudService {
|
|
|
luser.major = user.major;
|
|
|
}
|
|
|
}
|
|
|
+ const lrecords = await this.rmodel.find({ roomid: _luser.roomid, userid: _luser.userid }).sort({ createtime: -1 }).limit(1);
|
|
|
+ if (lrecords.length > 0) {
|
|
|
+ const lrecord = lrecords[0];
|
|
|
+ luser.exittime = lrecord.createtime;
|
|
|
+ const start_date = moment(luser.createtime, 'YYYY-MM-DD HH:mm:ss');
|
|
|
+ const end_date = moment(lrecord.createtime, 'YYYY-MM-DD HH:mm:ss');
|
|
|
+ // 秒
|
|
|
+ const seconds = end_date.diff(start_date, 'seconds');
|
|
|
+ // 分钟
|
|
|
+ const mintus = (seconds / 60);
|
|
|
+ luser.looktime = mintus;
|
|
|
+ }
|
|
|
data.push(luser);
|
|
|
}
|
|
|
return { data, total };
|