|
@@ -11,6 +11,7 @@ class LookuserService extends CrudService {
|
|
constructor(ctx) {
|
|
constructor(ctx) {
|
|
super(ctx, 'lookuser');
|
|
super(ctx, 'lookuser');
|
|
this.model = this.ctx.model.Lookuser;
|
|
this.model = this.ctx.model.Lookuser;
|
|
|
|
+ this.rmodel = this.ctx.model.Roomuser;
|
|
}
|
|
}
|
|
|
|
|
|
async create(data) {
|
|
async create(data) {
|
|
@@ -21,6 +22,23 @@ class LookuserService extends CrudService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ async query({ skip, limit, ...info }) {
|
|
|
|
+ const total = await this.model.count(info);
|
|
|
|
+ const lookuser = await this.model
|
|
|
|
+ .find(info)
|
|
|
|
+ .skip(Number(skip))
|
|
|
|
+ .limit(Number(limit));
|
|
|
|
+ const data = [];
|
|
|
|
+ for (const _lookuser of lookuser) {
|
|
|
|
+ const lu = JSON.parse(JSON.stringify(_lookuser));
|
|
|
|
+ const ruser = await this.rmodel.findById(_lookuser.userid);
|
|
|
|
+ const _ruser = JSON.parse(JSON.stringify(ruser));
|
|
|
|
+ const newdata = { ...lu, ..._ruser };
|
|
|
|
+ data.push(newdata);
|
|
|
|
+ }
|
|
|
|
+ return { data, total };
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|