|
@@ -66,9 +66,7 @@ class NoticeService extends CrudService {
|
|
|
const elm = [];
|
|
|
for (const notified of notice.notified) {
|
|
|
const _notified = _.cloneDeep(JSON.parse(JSON.stringify(notified)));
|
|
|
- const user = await this.umodel.findOne({ uid: _notified.notifiedid });
|
|
|
- const userinfo = await this.findUserInfo(user);
|
|
|
- console.log({ ...JSON.parse(JSON.stringify(userinfo)), ..._notified });
|
|
|
+ const userinfo = await this.findUserInfo(_notified.notifiedid);
|
|
|
elm.push({ ...JSON.parse(JSON.stringify(userinfo)), ..._notified });
|
|
|
}
|
|
|
res.push({ noticeid, content, meta, notified: elm });
|
|
@@ -76,19 +74,18 @@ class NoticeService extends CrudService {
|
|
|
return { data: res, total };
|
|
|
}
|
|
|
|
|
|
- async findUserInfo(user) {
|
|
|
+ async findUserInfo(userid) {
|
|
|
let userinfo;
|
|
|
- if (user.type === '1') {
|
|
|
- userinfo = await this.heamodel.findById(user.uid);
|
|
|
- } else if (user.type === '2') {
|
|
|
- userinfo = await this.schmodel.findById(user.uid);
|
|
|
- } else if (user.type === '3') {
|
|
|
- userinfo = await this.teamodel.findById(user.uid);
|
|
|
+ userinfo = await this.heamodel.findById(userid);
|
|
|
+ if (!userinfo) {
|
|
|
+ userinfo = await this.schmodel.findById(userid);
|
|
|
+ } if (!userinfo) {
|
|
|
+ userinfo = await this.teamodel.findById(userid);
|
|
|
if (userinfo) {
|
|
|
delete userinfo.status;
|
|
|
}
|
|
|
- } else if (user.type === '4') {
|
|
|
- userinfo = await this.stumodel.findById(user.uid);
|
|
|
+ } if (!userinfo) {
|
|
|
+ userinfo = await this.stumodel.findById(userid);
|
|
|
}
|
|
|
return userinfo;
|
|
|
}
|