|
@@ -17,6 +17,36 @@ class NoticeService extends Service {
|
|
|
return await model.NoticeModel.find(data, pop).sort({ createTime: -1 }).skip(0).limit(1);
|
|
|
}
|
|
|
|
|
|
+ // PC端发给我的通知
|
|
|
+ async pcListForPage(data,user) {
|
|
|
+ const { model } = this.ctx;
|
|
|
+ const page = data.page;
|
|
|
+ const rows = Number.parseInt(data.rows) || this.app.config.defaultPageSize;
|
|
|
+ delete data.page;
|
|
|
+ delete data.rows;
|
|
|
+
|
|
|
+ const where = {};
|
|
|
+
|
|
|
+ if (!data.searchtitle) {
|
|
|
+ delete data.searchtitle;
|
|
|
+ }else{
|
|
|
+ where.title ={$regex: data.searchtitle}
|
|
|
+ delete data.searchtitle;
|
|
|
+ }
|
|
|
+
|
|
|
+ where.$or = [{ deptId: user.dept1._id }, { deptId: user.dept2._id }, { deptId: user.dept3._id }];
|
|
|
+
|
|
|
+
|
|
|
+ const total = await model.InfoModel.find(where).countDocuments();
|
|
|
+ const result = await model.InfoModel.find(where).skip((page - 1) * rows)
|
|
|
+ .limit(rows)
|
|
|
+ .sort({ createTime: -1 });
|
|
|
+ return {
|
|
|
+ count: total,
|
|
|
+ list: result,
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
module.exports = NoticeService;
|