|
@@ -133,23 +133,23 @@ class NoticeService extends CrudService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async query({ skip, limit, ...info }) {
|
|
|
- const total = await this.model.count(info);
|
|
|
- const notices = await this.model.find(info).skip(Number(skip)).limit(Number(limit));
|
|
|
- const res = [];
|
|
|
- for (const _notice of notices) {
|
|
|
- const notice = _.cloneDeep(JSON.parse(JSON.stringify(_notice)));
|
|
|
- const { noticeid, content, notified, meta, _id } = notice;
|
|
|
- const elm = [];
|
|
|
- for (const notified of notice.notified) {
|
|
|
- const _notified = _.cloneDeep(JSON.parse(JSON.stringify(notified)));
|
|
|
- const userinfo = await this.findUserInfo(_notified.notifiedid);
|
|
|
- elm.push({ ...JSON.parse(JSON.stringify(userinfo)), ..._notified });
|
|
|
- }
|
|
|
- res.push({ noticeid, content, meta, notified: elm, _id });
|
|
|
- }
|
|
|
- return { data: res, total };
|
|
|
- }
|
|
|
+ // async query({ skip, limit, ...info }) {
|
|
|
+ // const total = await this.model.count(info);
|
|
|
+ // const notices = await this.model.find(info).skip(Number(skip)).limit(Number(limit));
|
|
|
+ // const res = [];
|
|
|
+ // for (const _notice of notices) {
|
|
|
+ // const notice = _.cloneDeep(JSON.parse(JSON.stringify(_notice)));
|
|
|
+ // const { noticeid, content, notified, meta, _id } = notice;
|
|
|
+ // const elm = [];
|
|
|
+ // for (const notified of notice.notified) {
|
|
|
+ // const _notified = _.cloneDeep(JSON.parse(JSON.stringify(notified)));
|
|
|
+ // const userinfo = await this.findUserInfo(_notified.notifiedid);
|
|
|
+ // elm.push({ ...JSON.parse(JSON.stringify(userinfo)), ..._notified });
|
|
|
+ // }
|
|
|
+ // res.push({ noticeid, content, meta, notified: elm, _id });
|
|
|
+ // }
|
|
|
+ // return { data: res, total };
|
|
|
+ // }
|
|
|
|
|
|
async findUserInfo(userid) {
|
|
|
let userinfo;
|