|
@@ -35,26 +35,42 @@ module.exports = app => {
|
|
|
* @param {Integer} uid - 查询人id
|
|
|
*/
|
|
|
async getNotice(pid, uid = 0) {
|
|
|
- const noticeList = [];
|
|
|
- for (const type in auditConst.pushType) {
|
|
|
- const wheres = { pid, type: auditConst.pushType[type] };
|
|
|
- if (uid !== 0) {
|
|
|
- wheres.uid = uid;
|
|
|
- }
|
|
|
- let notice = await this.db.select(this.tableName, {
|
|
|
- where: wheres,
|
|
|
- orders: [['create_time', 'desc']],
|
|
|
- limit: 20,
|
|
|
- offset: 0
|
|
|
- });
|
|
|
- notice = notice.map(v => {
|
|
|
- const extra = JSON.parse(v.content);
|
|
|
- delete v.content;
|
|
|
- return { ...v, ...extra };
|
|
|
- });
|
|
|
- noticeList.push(...notice);
|
|
|
+ // const noticeList = [];
|
|
|
+ // for (const type in auditConst.pushType) {
|
|
|
+ // const wheres = { pid, type: auditConst.pushType[type] };
|
|
|
+ // if (uid !== 0) {
|
|
|
+ // wheres.uid = uid;
|
|
|
+ // }
|
|
|
+ // let notice = await this.db.select(this.tableName, {
|
|
|
+ // where: wheres,
|
|
|
+ // orders: [['create_time', 'desc']],
|
|
|
+ // limit: 20,
|
|
|
+ // offset: 0
|
|
|
+ // });
|
|
|
+ // notice = notice.map(v => {
|
|
|
+ // const extra = JSON.parse(v.content);
|
|
|
+ // delete v.content;
|
|
|
+ // return { ...v, ...extra };
|
|
|
+ // });
|
|
|
+ // noticeList.push(...notice);
|
|
|
+ // }
|
|
|
+ // return this._.orderBy(noticeList, ['create_time'], ['desc']);
|
|
|
+ const wheres = { pid };
|
|
|
+ if (uid !== 0) {
|
|
|
+ wheres.uid = uid;
|
|
|
}
|
|
|
- return this._.orderBy(noticeList, ['create_time'], ['desc']);
|
|
|
+ let notice = await this.db.select(this.tableName, {
|
|
|
+ where: wheres,
|
|
|
+ orders: [['create_time', 'desc']],
|
|
|
+ limit: 30,
|
|
|
+ offset: 0
|
|
|
+ });
|
|
|
+ notice = notice.map(v => {
|
|
|
+ const extra = JSON.parse(v.content);
|
|
|
+ delete v.content;
|
|
|
+ return { ...v, ...extra };
|
|
|
+ });
|
|
|
+ return notice;
|
|
|
}
|
|
|
|
|
|
/**
|