|
@@ -16,10 +16,7 @@ class NoticeService extends CrudService {
|
|
|
async query({ user_id, ...query }, { skip = 0, limit = 0 } = {}) {
|
|
|
const condition = { ...query };
|
|
|
if (user_id) condition.receive_user = { $elemMatch: { user_id } };
|
|
|
- const data = await this.model
|
|
|
- .find(condition)
|
|
|
- .skip(parseInt(skip))
|
|
|
- .limit(parseInt(limit));
|
|
|
+ const data = await this.model.find(condition).skip(parseInt(skip)).limit(parseInt(limit));
|
|
|
if (!data) throw new BusinessError(ErrorCode.DATA_NOT_EXIST);
|
|
|
return data;
|
|
|
}
|
|
@@ -30,29 +27,17 @@ class NoticeService extends CrudService {
|
|
|
if (type !== '3') {
|
|
|
if (type === '0') {
|
|
|
for (const val of userList) {
|
|
|
- body.receive_user.push({
|
|
|
- user_id: val._id,
|
|
|
- user_name: val.nickname,
|
|
|
- status: '0',
|
|
|
- });
|
|
|
+ body.receive_user.push({ user_id: val._id, user_name: val.nickname, status: '0' });
|
|
|
}
|
|
|
} else if (type === '1') {
|
|
|
userList = userList.filter(i => i.type === '1');
|
|
|
for (const val of userList) {
|
|
|
- body.receive_user.push({
|
|
|
- user_id: val._id,
|
|
|
- user_name: val.nickname,
|
|
|
- status: '0',
|
|
|
- });
|
|
|
+ body.receive_user.push({ user_id: val._id, user_name: val.nickname, status: '0' });
|
|
|
}
|
|
|
} else if (type === '2') {
|
|
|
userList = userList.filter(i => i.type === '2');
|
|
|
for (const val of userList) {
|
|
|
- body.receive_user.push({
|
|
|
- user_id: val._id,
|
|
|
- user_name: val.nickname,
|
|
|
- status: '0',
|
|
|
- });
|
|
|
+ body.receive_user.push({ user_id: val._id, user_name: val.nickname, status: '0' });
|
|
|
}
|
|
|
}
|
|
|
}
|