浏览代码

审批通过通知问题

MaiXinRong 2 年之前
父节点
当前提交
5d2dd6445f
共有 1 个文件被更改,包括 18 次插入12 次删除
  1. 18 12
      app/service/stage_audit.js

+ 18 - 12
app/service/stage_audit.js

@@ -406,10 +406,10 @@ module.exports = app => {
                         ...defaultNoticeRecord,
                     });
                 });
-                stage.userAssists.forEach(u => {
+                this.ctx.stage.userAssists.forEach(u => {
                     records.push({ uid: u.ass_user_id, ...defaultNoticeRecord});
                 });
-                stage.auditAssists.forEach(u => {
+                this.ctx.stage.auditAssists.forEach(u => {
                     records.push({ uid: u.ass_user_id, ...defaultNoticeRecord});
                 });
                 await transaction.insert('zh_notice', records);
@@ -620,10 +620,10 @@ module.exports = app => {
                         ...defaultNoticeRecord,
                     });
                 });
-                stage.userAssists.forEach(u => {
+                this.ctx.stage.userAssists.forEach(u => {
                     records.push({ uid: u.ass_user_id, ...defaultNoticeRecord});
                 });
-                stage.auditAssists.forEach(u => {
+                this.ctx.stage.auditAssists.forEach(u => {
                     records.push({ uid: u.ass_user_id, ...defaultNoticeRecord});
                 });
                 await transaction.insert(this.ctx.service.noticePush.tableName, records);
@@ -750,24 +750,30 @@ module.exports = app => {
                 await this._updateTender(transaction);
                 // 添加推送
                 const noticeContent = await this.getNoticeContent(pid, audit.tid, stageId, audit.aid, checkData.opinion);
+                const defaultNoticeRecord = {
+                    pid,
+                    type: pushType.stage,
+                    status: auditConst.status.checkNoPre,
+                    content: noticeContent,
+                };
                 const records = [
                     {
-                        pid,
-                        type: pushType.stage,
                         uid: this.ctx.stage.user_id,
-                        status: auditConst.status.checkNoPre,
-                        content: noticeContent,
+                        ...defaultNoticeRecord
                     },
                 ];
                 auditors2.forEach(audit => {
                     records.push({
-                        pid,
-                        type: pushType.stage,
                         uid: audit.aid,
-                        status: auditConst.status.checkNoPre,
-                        content: noticeContent,
+                        ...defaultNoticeRecord
                     });
                 });
+                this.ctx.stage.userAssists.forEach(u => {
+                    records.push({ uid: u.ass_user_id, ...defaultNoticeRecord});
+                });
+                this.ctx.stage.auditAssists.forEach(u => {
+                    records.push({ uid: u.ass_user_id, ...defaultNoticeRecord});
+                });
 
                 await transaction.insert('zh_notice', records);