Browse Source

refactor: 首页待关注功能重构

lanjianrong 5 years ago
parent
commit
33aeeb574c

+ 1 - 1
app/controller/change_controller.js

@@ -565,7 +565,7 @@ module.exports = app => {
                         result = await ctx.service.change.approvalBack(pid, ctx.request.body, changeData);
                         result = await ctx.service.change.approvalBack(pid, ctx.request.body, changeData);
                         break;
                         break;
                     case 6:// 审批退回到上一个审批人
                     case 6:// 审批退回到上一个审批人
-                        result = await ctx.service.change.approvalBackNew(ctx.request.body, changeData);
+                        result = await ctx.service.change.approvalBackNew(pid, ctx.request.body, changeData);
                         break;
                         break;
                     default:break;
                     default:break;
                 }
                 }

+ 3 - 5
app/controller/dashboard_controller.js

@@ -35,6 +35,7 @@ module.exports = app => {
             const noticeChange = await ctx.service.changeAudit.getNoticeChange(ctx.session.sessionProject.id, pa.id, lastNotice);
             const noticeChange = await ctx.service.changeAudit.getNoticeChange(ctx.session.sessionProject.id, pa.id, lastNotice);
             const noticeRevise = await ctx.service.reviseAudit.getNoticeRevise(ctx.session.sessionProject.id, pa.id, lastNotice);
             const noticeRevise = await ctx.service.reviseAudit.getNoticeRevise(ctx.session.sessionProject.id, pa.id, lastNotice);
             const noticeMaterial = await ctx.service.materialAudit.getNoticeMaterial(ctx.session.sessionProject.id, pa.id, lastNotice);
             const noticeMaterial = await ctx.service.materialAudit.getNoticeMaterial(ctx.session.sessionProject.id, pa.id, lastNotice);
+            const noticeList = [...noticeLedger, ...noticeStage, ...noticeChange, ...noticeRevise, ...noticeMaterial].sort((a, b) => a.create_time - b.create_time);
             // const noticeLedger = [];
             // const noticeLedger = [];
             // const noticeStage = [];
             // const noticeStage = [];
             // const noticeChange = [];
             // const noticeChange = [];
@@ -67,11 +68,8 @@ module.exports = app => {
                 acChange: auditConst.flow,
                 acChange: auditConst.flow,
                 acRevise: auditConst.revise,
                 acRevise: auditConst.revise,
                 acMaterial: auditConst.material,
                 acMaterial: auditConst.material,
-                noticeLedger,
-                noticeStage,
-                noticeChange,
-                noticeRevise,
-                noticeMaterial,
+                noticeList,
+                pushType: auditConst.pushType,
                 projectData,
                 projectData,
                 salesmanData,
                 salesmanData,
                 officeName,
                 officeName,

+ 6 - 6
app/public/js/dashboard.js

@@ -54,10 +54,10 @@ $(document).ready(() => {
         $('#user_permission').html('');
         $('#user_permission').html('');
     })
     })
 
 
-    $('#notice').on('click', 'li a', function() {
-        const id = $(this).data('id')
-        postData(window.location.pathname + '/push', {id}, function() {
-            return
-        })
-    })
+    // $('#notice').on('click', 'li a', function() {
+    //     const id = $(this).data('id')
+    //     postData(window.location.pathname + '/push', {id}, function() {
+    //         return
+    //     })
+    // })
 });
 });

+ 1 - 1
app/router.js

@@ -44,7 +44,7 @@ module.exports = app => {
     app.get('/dashboard/msg/del/:id', sessionAuth, 'dashboardController.msgDelete');
     app.get('/dashboard/msg/del/:id', sessionAuth, 'dashboardController.msgDelete');
 
 
     // 推送相关
     // 推送相关
-    app.post('/dashboard/push', sessionAuth, 'dashboardController.pushSet');
+    // app.post('/dashboard/push', sessionAuth, 'dashboardController.pushSet');
     /**
     /**
      * 项目设置
      * 项目设置
      */
      */

+ 31 - 3
app/service/change.js

@@ -482,6 +482,16 @@ module.exports = app => {
             this.transaction = await this.db.beginTransaction();
             this.transaction = await this.db.beginTransaction();
             let result = false;
             let result = false;
             try {
             try {
+                // 获取所有审核人列表
+                const auditors = await this.ctx.service.changeAudit.getAllAuditors(changeData.tid);
+                // 添加到消息推送表
+                const noticeContent = await this.getNoticeContent(pid, changeData.tid, changeData.cid, postData.audit_id);
+                const records = [{ pid, type: pushType.change, uid: changeData.uid, status: audit.flow.status.checked, content: noticeContent }];
+                auditors.forEach(auditor => {
+                    records.push({ pid, type: pushType.change, uid: auditor.uid, status: audit.flow.status.checked, content: noticeContent });
+                });
+                await this.transaction.insert('zh_notice', records);
+
                 // 设置审批人通过
                 // 设置审批人通过
                 const audit_update = {
                 const audit_update = {
                     id: postData.audit_id,
                     id: postData.audit_id,
@@ -645,12 +655,18 @@ module.exports = app => {
          */
          */
         async approvalBack(pid, postData, changeData) {
         async approvalBack(pid, postData, changeData) {
             // 初始化事务
             // 初始化事务
-            const noticeContent = await this.getNoticeContent(pid, changeData.tid, changeData.cid);
             this.transaction = await this.db.beginTransaction();
             this.transaction = await this.db.beginTransaction();
             let result = false;
             let result = false;
             try {
             try {
+                // 获取所有审核人列表
+                const auditors = await this.ctx.service.changeAudit.getAllAuditors(changeData.tid);
                 // 添加到消息推送表
                 // 添加到消息推送表
-                await this.transaction.insert('zh_notice', { pid, type: pushType.change, uid: changeData.uid, status: audit.flow.status.back, is_read: 0, content: noticeContent });
+                const noticeContent = await this.getNoticeContent(pid, changeData.tid, changeData.cid, postData.audit_id);
+                const records = [{ pid, type: pushType.change, uid: changeData.uid, status: audit.flow.status.backnew, content: noticeContent }];
+                auditors.forEach(auditor => {
+                    records.push({ pid, type: pushType.change, uid: auditor.uid, status: audit.flow.status.backnew, content: noticeContent });
+                });
+                await this.transaction.insert('zh_notice', records);
                 const changeInfo = await this.getDataByCondition({ cid: postData.change_id });
                 const changeInfo = await this.getDataByCondition({ cid: postData.change_id });
                 const tenderInfo = await this.ctx.service.tenderInfo.getTenderInfo(changeInfo.tid);
                 const tenderInfo = await this.ctx.service.tenderInfo.getTenderInfo(changeInfo.tid);
                 // 设置审批人退回
                 // 设置审批人退回
@@ -742,15 +758,27 @@ module.exports = app => {
 
 
         /**
         /**
          * 审批退回到上一个审批人
          * 审批退回到上一个审批人
+         * @param {Number} pid 项目id
          * @param {int} postData - 表单提交的数据
          * @param {int} postData - 表单提交的数据
          * @param {int} changeData - 变更令的数据
          * @param {int} changeData - 变更令的数据
          * @return {void}
          * @return {void}
          */
          */
-        async approvalBackNew(postData, changeData) {
+        async approvalBackNew(pid, postData, changeData) {
             // 初始化事务
             // 初始化事务
             this.transaction = await this.db.beginTransaction();
             this.transaction = await this.db.beginTransaction();
             let result = false;
             let result = false;
             try {
             try {
+                // 获取所有审核人列表
+                const auditors = await this.ctx.service.changeAudit.getAllAuditors(changeData.tid);
+                // 添加到消息推送表
+                const noticeContent = await this.getNoticeContent(pid, changeData.tid, changeData.cid, postData.audit_id);
+                const records = [{ pid, type: pushType.change, uid: changeData.uid, status: audit.flow.status.back, content: noticeContent }];
+                auditors.forEach(auditor => {
+                    records.push({ pid, type: pushType.change, uid: auditor.uid, status: audit.flow.status.back, content: noticeContent });
+                });
+                await this.transaction.insert('zh_notice', records);
+
+
                 const changeInfo = await this.getDataByCondition({ cid: postData.change_id });
                 const changeInfo = await this.getDataByCondition({ cid: postData.change_id });
                 const tenderInfo = await this.ctx.service.tenderInfo.getTenderInfo(changeInfo.tid);
                 const tenderInfo = await this.ctx.service.tenderInfo.getTenderInfo(changeInfo.tid);
                 // 设置审批人退回
                 // 设置审批人退回

+ 3 - 1
app/service/change_audit.js

@@ -309,7 +309,9 @@ module.exports = app => {
             // const sqlParam = [this.ctx.service.tender.tableName, uid, this.tableName, uid, this.ctx.service.change.tableName, this.tableName, pid, time, audit.flow.status.checking];
             // const sqlParam = [this.ctx.service.tender.tableName, uid, this.tableName, uid, this.ctx.service.change.tableName, this.tableName, pid, time, audit.flow.status.checking];
             // return await this.db.query(sql, sqlParam);
             // return await this.db.query(sql, sqlParam);
             let notice =  await this.db.select('zh_notice', {
             let notice =  await this.db.select('zh_notice', {
-                where: { pid, type: pushType.change, uid, is_read: 0 },
+                where: { pid, type: pushType.change, uid },
+                orders: [['create_time', 'desc']],
+                limit: 10, offset: 0
             });
             });
             notice = notice.map(v => {
             notice = notice.map(v => {
                 const extra = JSON.parse(v.content)
                 const extra = JSON.parse(v.content)

+ 19 - 9
app/service/ledger_audit.js

@@ -249,6 +249,17 @@ module.exports = app => {
                 if (!audit) {
                 if (!audit) {
                     throw '审核数据错误';
                     throw '审核数据错误';
                 }
                 }
+
+                // 获取审核人列表
+                const auditList = await this.getAuditors(tenderId, times);
+
+                // 添加推送
+                const noticeContent = await this.getNoticeContent(audit.tender_id, pid, audit.aid)
+                const records = [{ pid, type: pushType.ledger, uid: this.ctx.tender.data.user_id, status: auditConst.status.checked, content: noticeContent }]
+                auditList.forEach( audit => {
+                    records.push({ pid, type: pushType.ledger, uid: audit.aid, status: auditConst.status.checked, content: noticeContent })
+                })
+                await transaction.insert('zh_notice', records);
                 // 更新当前审核流程
                 // 更新当前审核流程
                 await transaction.update(this.tableName, { id: audit.id, status: checkType, opinion, end_time: time });
                 await transaction.update(this.tableName, { id: audit.id, status: checkType, opinion, end_time: time });
                 if (checkType === auditConst.status.checked) {
                 if (checkType === auditConst.status.checked) {
@@ -292,7 +303,6 @@ module.exports = app => {
                         //     const content = '【纵横计量支付】' + ptmsg + '台账审批通过,请登录系统处理。';
                         //     const content = '【纵横计量支付】' + ptmsg + '台账审批通过,请登录系统处理。';
                         //     sms.send(mobile_array, content);
                         //     sms.send(mobile_array, content);
                         // }
                         // }
-                        const auditList = await this.getAuditors(tenderId, times);
                         const users = this._.pull(this._.map(auditList, 'audit_id'), audit.id);
                         const users = this._.pull(this._.map(auditList, 'audit_id'), audit.id);
                         // await this.ctx.helper.sendUserSms(users, smsTypeConst.const.TZ,
                         // await this.ctx.helper.sendUserSms(users, smsTypeConst.const.TZ,
                         //     smsTypeConst.judge.result.toString(), '台账审批通过,请登录系统处理。');
                         //     smsTypeConst.judge.result.toString(), '台账审批通过,请登录系统处理。');
@@ -343,15 +353,12 @@ module.exports = app => {
                     //     const content = '【纵横计量支付】' + ptmsg + '台账审批退回,请登录系统处理。';
                     //     const content = '【纵横计量支付】' + ptmsg + '台账审批退回,请登录系统处理。';
                     //     sms.send(mobile_array, content);
                     //     sms.send(mobile_array, content);
                     // }
                     // }
-                    const auditList = await this.getAuditors(tenderId, times);
                     const users = this._.pull(this._.map(auditList, 'audit_id'), audit.id);
                     const users = this._.pull(this._.map(auditList, 'audit_id'), audit.id);
                     // await this.ctx.helper.sendUserSms(users, smsTypeConst.const.TZ,
                     // await this.ctx.helper.sendUserSms(users, smsTypeConst.const.TZ,
                     //     smsTypeConst.judge.result.toString(), '台账审批退回,请登录系统处理。');
                     //     smsTypeConst.judge.result.toString(), '台账审批退回,请登录系统处理。');
                     await this.ctx.helper.sendAliSms(users, smsTypeConst.const.TZ,
                     await this.ctx.helper.sendAliSms(users, smsTypeConst.const.TZ,
                         smsTypeConst.judge.result.toString(), SmsAliConst.template.ledger_result, { status: SmsAliConst.status.back });
                         smsTypeConst.judge.result.toString(), SmsAliConst.template.ledger_result, { status: SmsAliConst.status.back });
-                    // 添加到消息推送表
-                    const noticeContent = await this.getNoticeContent(audit.tender_id, pid)
-                    await transaction.insert('zh_notice', { pid, type: pushType.ledger, uid: this.ctx.tender.data.user_id, status: auditConst.status.checkNo, is_read: 0, content: noticeContent });
+
                 }
                 }
 
 
                 await transaction.commit();
                 await transaction.commit();
@@ -397,7 +404,9 @@ module.exports = app => {
 
 
 
 
             let notice =  await this.db.select('zh_notice', {
             let notice =  await this.db.select('zh_notice', {
-                where: { pid, type: pushType.ledger, uid, is_read: 0 },
+                where: { pid, type: pushType.ledger, uid },
+                orders: [['create_time', 'desc']],
+                limit: 10, offset: 0
             });
             });
             notice = notice.map(v => {
             notice = notice.map(v => {
                 const extra = JSON.parse(v.content)
                 const extra = JSON.parse(v.content)
@@ -411,14 +420,15 @@ module.exports = app => {
          * 用于添加推送所需的content内容
          * 用于添加推送所需的content内容
          * @param {Number} id 台账id
          * @param {Number} id 台账id
          * @param {Number} pid 项目id
          * @param {Number} pid 项目id
+         * @param {Number} uid 审核人id
          */
          */
-        async getNoticeContent(id, pid) {
+        async getNoticeContent(id, pid, uid) {
             const noticeSql = 'SELECT * FROM (SELECT ' +
             const noticeSql = 'SELECT * FROM (SELECT ' +
                 '  t.`id` As `tid`, t.`name`,  pa.`name` As `su_name`, pa.role As `su_role`' +
                 '  t.`id` As `tid`, t.`name`,  pa.`name` As `su_name`, pa.role As `su_role`' +
                 '  FROM (SELECT * FROM ?? WHERE `id` = ? ) As t' +
                 '  FROM (SELECT * FROM ?? WHERE `id` = ? ) As t' +
-                '  LEFT JOIN ?? As pa ON t.`user_id` = pa.`id`' +
+                '  LEFT JOIN ?? As pa ON pa.`id` = ?' +
                 '  WHERE  t.`project_id` = ? ) as new_t GROUP BY new_t.`tid`';
                 '  WHERE  t.`project_id` = ? ) as new_t GROUP BY new_t.`tid`';
-            const noticeSqlParam = [this.ctx.service.tender.tableName, id, this.ctx.service.projectAccount.tableName, pid];
+            const noticeSqlParam = [this.ctx.service.tender.tableName, id, this.ctx.service.projectAccount.tableName, uid, pid];
             const content = await this.db.query(noticeSql, noticeSqlParam);
             const content = await this.db.query(noticeSql, noticeSqlParam);
             return content.length ? JSON.stringify(content[0]) : '';
             return content.length ? JSON.stringify(content[0]) : '';
         }
         }

+ 42 - 12
app/service/material_audit.js

@@ -247,29 +247,47 @@ module.exports = app => {
 
 
         async _checked(pid, materialId, checkData, times) {
         async _checked(pid, materialId, checkData, times) {
             const time = new Date();
             const time = new Date();
+
             // 整理当前流程审核人状态更新
             // 整理当前流程审核人状态更新
             const audit = await this.getDataByCondition({ mid: materialId, times, status: auditConst.status.checking });
             const audit = await this.getDataByCondition({ mid: materialId, times, status: auditConst.status.checking });
             if (!audit) {
             if (!audit) {
                 throw '审核数据错误';
                 throw '审核数据错误';
             }
             }
+
+            // 获取审核人列表
+            const sql = 'SELECT `tid`, `mid`, `aid`, `order` FROM ?? WHERE `mid` = ? and `times` = ? GROUP BY `aid` ORDER BY `id` ASC';
+            const sqlParam = [this.tableName, materialId, times];
+            const auditors = await this.db.query(sql, sqlParam);
+
             const nextAudit = await this.getDataByCondition({ mid: materialId, times, order: audit.order + 1 });
             const nextAudit = await this.getDataByCondition({ mid: materialId, times, order: audit.order + 1 });
 
 
+
             const transaction = await this.db.beginTransaction();
             const transaction = await this.db.beginTransaction();
             try {
             try {
                 await transaction.update(this.tableName, { id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time });
                 await transaction.update(this.tableName, { id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time });
+
+                // 获取推送必要信息
+                const noticeContent = await this.getNoticeContent(pid, audit.tid, materialId, audit.aid)
+                // 添加推送
+                const records = [{ pid, type: pushType.material, uid: this.ctx.material.user_id, status: auditConst.status.checked, content: noticeContent }]
+                auditors.forEach(audit => {
+                    records.push({ pid, type: pushType.material, uid: audit.aid, status: auditConst.status.checked, content: noticeContent })
+                })
+                await transaction.insert('zh_notice', records);
                 // 无下一审核人表示,审核结束
                 // 无下一审核人表示,审核结束
                 if (nextAudit) {
                 if (nextAudit) {
                     // 复制一份下一审核人数据
                     // 复制一份下一审核人数据
                     // await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times, nextAudit.order, transaction);
                     // await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times, nextAudit.order, transaction);
                     // 流程至下一审批人
                     // 流程至下一审批人
                     await transaction.update(this.tableName, { id: nextAudit.id, status: auditConst.status.checking, begin_time: time });
                     await transaction.update(this.tableName, { id: nextAudit.id, status: auditConst.status.checking, begin_time: time });
-                    // 添加记录到推送表
 
 
                     // 同步 期信息
                     // 同步 期信息
                     await transaction.update(this.ctx.service.material.tableName, {
                     await transaction.update(this.ctx.service.material.tableName, {
                         id: materialId, status: auditConst.status.checking,
                         id: materialId, status: auditConst.status.checking,
                     });
                     });
 
 
+
+
                     // 添加短信通知-需要审批提醒功能
                     // 添加短信通知-需要审批提醒功能
                     // const smsUser = await this.ctx.service.projectAccount.getDataById(nextAudit.aid);
                     // const smsUser = await this.ctx.service.projectAccount.getDataById(nextAudit.aid);
                     // if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
                     // if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
@@ -294,9 +312,6 @@ module.exports = app => {
                     await transaction.update(this.ctx.service.material.tableName, {
                     await transaction.update(this.ctx.service.material.tableName, {
                         id: materialId, status: checkData.checkType,
                         id: materialId, status: checkData.checkType,
                     });
                     });
-                    const noticeContent = await this.getNoticeContent(pid, audit.tid, materialId)
-                    // 审核结束,将原报添加到推送表
-                    await transaction.insert('zh_notice', { pid, type: pushType.material, uid: this.ctx.material.user_id, status: auditConst.status.checked, is_read: 0, content: noticeContent });
 
 
                     // 添加短信通知-审批通过提醒功能
                     // 添加短信通知-审批通过提醒功能
                     // const mobile_array = [];
                     // const mobile_array = [];
@@ -354,8 +369,12 @@ module.exports = app => {
             try {
             try {
                 await transaction.update(this.tableName, { id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time });
                 await transaction.update(this.tableName, { id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time });
                 // 添加到消息推送表
                 // 添加到消息推送表
-                const noticeContent = await this.getNoticeContent(pid, audit.tid, materialId)
-                await transaction.insert('zh_notice', { pid, type: pushType.material, uid: this.ctx.material.user_id, status: auditConst.status.checkNo, is_read: 0, content: noticeContent });
+                const noticeContent = await this.getNoticeContent(pid, audit.tid, materialId, audit.aid)
+                const records = [{ pid, type: pushType.material, uid: this.ctx.material.user_id, status: auditConst.status.checkNo, content: noticeContent }]
+                auditors.forEach( audit => {
+                    records.push({ pid, type: pushType.material, uid: audit.aid, status: auditConst.status.checkNo, content: noticeContent })
+                })
+                await transaction.insert('zh_notice', records);
                 // 同步期信息
                 // 同步期信息
                 await transaction.update(this.ctx.service.material.tableName, {
                 await transaction.update(this.ctx.service.material.tableName, {
                     id: materialId, status: checkData.checkType,
                     id: materialId, status: checkData.checkType,
@@ -409,7 +428,7 @@ module.exports = app => {
             }
             }
         }
         }
 
 
-        async _checkNoPre(materialId, checkData, times) {
+        async _checkNoPre(pid, materialId, checkData, times) {
             const time = new Date();
             const time = new Date();
             // 整理当前流程审核人状态更新
             // 整理当前流程审核人状态更新
             const audit = await this.getDataByCondition({ mid: materialId, times, status: auditConst.status.checking });
             const audit = await this.getDataByCondition({ mid: materialId, times, status: auditConst.status.checking });
@@ -422,8 +441,15 @@ module.exports = app => {
                 return item.aid === audit.aid;
                 return item.aid === audit.aid;
             });
             });
             const preAuditor = auditors2[auditorIndex - 1];
             const preAuditor = auditors2[auditorIndex - 1];
+            const noticeContent = await this.getNoticeContent(pid, audit.tid, materialId, audit.aid)
             const transaction = await this.db.beginTransaction();
             const transaction = await this.db.beginTransaction();
             try {
             try {
+                // 添加到消息推送表
+                const records = [{ pid, type: pushType.material, uid: this.ctx.material.user_id, status: auditConst.status.checkNoPre, content: noticeContent }]
+                auditors2.forEach( audit => {
+                    records.push({ pid, type: pushType.material, uid: audit.aid, status: auditConst.status.checkNoPre, content: noticeContent })
+                })
+                await transaction.insert('zh_notice', records);
                 await transaction.update(this.tableName, { id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time });
                 await transaction.update(this.tableName, { id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time });
                 // 顺移气候审核人流程顺序
                 // 顺移气候审核人流程顺序
                 this.initSqlBuilder();
                 this.initSqlBuilder();
@@ -471,7 +497,7 @@ module.exports = app => {
                     await this._checkNo(pid, materialId, checkData, times);
                     await this._checkNo(pid, materialId, checkData, times);
                     break;
                     break;
                 case auditConst.status.checkNoPre:
                 case auditConst.status.checkNoPre:
-                    await this._checkNoPre(materialId, checkData, times);
+                    await this._checkNoPre(pid, materialId, checkData, times);
                     break;
                     break;
                 default:
                 default:
                     throw '无效审批操作';
                     throw '无效审批操作';
@@ -483,16 +509,17 @@ module.exports = app => {
          * @param {Number} pid 项目id
          * @param {Number} pid 项目id
          * @param {Number} tid 台账id
          * @param {Number} tid 台账id
          * @param {Number} mid 期id
          * @param {Number} mid 期id
+         * @param {Number} uid 审批人id
          */
          */
-        async getNoticeContent(pid, tid, mid) {
+        async getNoticeContent(pid, tid, mid, uid) {
             const noticeSql = 'SELECT * FROM (SELECT ' +
             const noticeSql = 'SELECT * FROM (SELECT ' +
                 '  t.`id` As `tid`, ma.`mid`, t.`name`, m.`order`, pa.`name` As `su_name`, pa.role As `su_role`' +
                 '  t.`id` As `tid`, ma.`mid`, t.`name`, m.`order`, pa.`name` As `su_name`, pa.role As `su_role`' +
                 '  FROM (SELECT * FROM ?? WHERE `id` = ? ) As t' +
                 '  FROM (SELECT * FROM ?? WHERE `id` = ? ) As t' +
                 '  LEFT JOIN ?? As m On t.`id` = m.`tid` AND m.`id` = ?' +
                 '  LEFT JOIN ?? As m On t.`id` = m.`tid` AND m.`id` = ?' +
                 '  LEFT JOIN ?? As ma ON m.`id` = ma.`mid`' +
                 '  LEFT JOIN ?? As ma ON m.`id` = ma.`mid`' +
-                '  LEFT JOIN ?? As pa ON t.`user_id` = pa.`id`' +
+                '  LEFT JOIN ?? As pa ON pa.`id` = ?' +
                 '  WHERE  t.`project_id` = ? ) as new_t GROUP BY new_t.`tid`';
                 '  WHERE  t.`project_id` = ? ) as new_t GROUP BY new_t.`tid`';
-            const noticeSqlParam = [this.ctx.service.tender.tableName, tid, this.ctx.service.material.tableName, mid, this.tableName, this.ctx.service.projectAccount.tableName, pid];
+            const noticeSqlParam = [this.ctx.service.tender.tableName, tid, this.ctx.service.material.tableName, mid, this.tableName, this.ctx.service.projectAccount.tableName, uid, pid];
             const content = await this.db.query(noticeSql, noticeSqlParam);
             const content = await this.db.query(noticeSql, noticeSqlParam);
             return content.length ? JSON.stringify(content[0]) : '';
             return content.length ? JSON.stringify(content[0]) : '';
         }
         }
@@ -598,13 +625,16 @@ module.exports = app => {
             //     this.ctx.service.projectAccount.tableName, time, pid];
             //     this.ctx.service.projectAccount.tableName, time, pid];
             // return await this.db.query(sql, sqlParam);
             // return await this.db.query(sql, sqlParam);
             let notice =  await this.db.select('zh_notice', {
             let notice =  await this.db.select('zh_notice', {
-                where: { pid, type: pushType.material, uid, is_read: 0 },
+                where: { pid, type: pushType.material, uid},
+                orders: [['create_time', 'desc']],
+                limit: 10, offset: 0
             });
             });
             notice = notice.map(v => {
             notice = notice.map(v => {
                 const extra = JSON.parse(v.content)
                 const extra = JSON.parse(v.content)
                 delete v.content
                 delete v.content
                 return { ...v, ...extra }
                 return { ...v, ...extra }
             })
             })
+            console.log('notice', notice)
             return notice;
             return notice;
         }
         }
 
 

+ 3 - 1
app/service/revise_audit.js

@@ -431,7 +431,9 @@ module.exports = app => {
             // const sqlParam = [this.ctx.service.tender.tableName, auditorId, this.tableName, auditorId, noticeTime, projectId];
             // const sqlParam = [this.ctx.service.tender.tableName, auditorId, this.tableName, auditorId, noticeTime, projectId];
             // return await this.db.query(sql, sqlParam);
             // return await this.db.query(sql, sqlParam);
             let notice =  await this.db.select('zh_notice', {
             let notice =  await this.db.select('zh_notice', {
-                where: { pid, type: pushType.revise, uid, is_read: 0 },
+                where: { pid, type: pushType.revise, uid },
+                orders: [['create_time', 'desc']],
+                limit: 10, offset: 0
             });
             });
             notice = notice.map(v => {
             notice = notice.map(v => {
                 const extra = JSON.parse(v.content)
                 const extra = JSON.parse(v.content)

+ 35 - 11
app/service/stage_audit.js

@@ -287,8 +287,18 @@ module.exports = app => {
             const nextAudit = await this.getDataByCondition({ sid: stageId, times, order: audit.order + 1 });
             const nextAudit = await this.getDataByCondition({ sid: stageId, times, order: audit.order + 1 });
             const tpData = await this.ctx.service.stageBills.getSumTotalPrice(this.ctx.stage);
             const tpData = await this.ctx.service.stageBills.getSumTotalPrice(this.ctx.stage);
 
 
+
             const transaction = await this.db.beginTransaction();
             const transaction = await this.db.beginTransaction();
+
             try {
             try {
+                // 添加推送
+                const noticeContent = await this.getNoticeContent(pid, audit.tid, stageId)
+                const records = [{ pid, type: pushType.stage, uid: this.ctx.stage.user_id, status: auditConst.status.checkNo, content: noticeContent }]
+                ctx.stage.auditors.forEach( audit => {
+                    records.push({ pid, type: pushType.stage, uid: audit.aid, status: auditConst.status.checkNo, content: noticeContent })
+                })
+                await transaction.insert('zh_notice', records);
+
                 await transaction.update(this.tableName, { id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time });
                 await transaction.update(this.tableName, { id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time });
                 // 计算并合同支付最终数据
                 // 计算并合同支付最终数据
                 const [yfPay, sfPay] = await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
                 const [yfPay, sfPay] = await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
@@ -390,9 +400,6 @@ module.exports = app => {
                     const users = this._.pull(this._.map(auditList, 'aid'), stageInfo.user_id);
                     const users = this._.pull(this._.map(auditList, 'aid'), stageInfo.user_id);
                     await this.ctx.helper.sendAliSms(users, smsTypeConst.const.JL,
                     await this.ctx.helper.sendAliSms(users, smsTypeConst.const.JL,
                         smsTypeConst.judge.result.toString(), SmsAliConst.template.stage_result, { qi: stageInfo.order, status: SmsAliConst.status.success });
                         smsTypeConst.judge.result.toString(), SmsAliConst.template.stage_result, { qi: stageInfo.order, status: SmsAliConst.status.success });
-                    // 添加到消息推送表
-                    const noticeContent = await this.getNoticeContent(pid, audit.tid, stageId)
-                    await transaction.insert('zh_notice', { pid, type: pushType.stage, uid: this.ctx.stage.user_id, status: auditConst.status.checked, is_read: 0, content: noticeContent });
                 }
                 }
                 await transaction.commit();
                 await transaction.commit();
             } catch (err) {
             } catch (err) {
@@ -422,6 +429,14 @@ module.exports = app => {
 
 
             const transaction = await this.db.beginTransaction();
             const transaction = await this.db.beginTransaction();
             try {
             try {
+                // 添加推送
+                const noticeContent = await this.getNoticeContent(pid, audit.tid, stageId)
+                const records = [{ pid, type: pushType.stage, uid: this.ctx.stage.user_id, status: auditConst.status.checkNo, content: noticeContent }]
+                auditors.forEach( audit => {
+                    records.push({ pid, type: pushType.stage, uid: audit.aid, status: auditConst.status.checkNo, content: noticeContent })
+                })
+                await transaction.insert('zh_notice', records);
+
                 // 计算并合同支付最终数据
                 // 计算并合同支付最终数据
                 const [yfPay, sfPay] = await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
                 const [yfPay, sfPay] = await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
                 this.ctx.stage.tp_history.push({
                 this.ctx.stage.tp_history.push({
@@ -484,9 +499,6 @@ module.exports = app => {
                 const users = this._.pull(this._.map(auditList, 'aid'), stageInfo.user_id);
                 const users = this._.pull(this._.map(auditList, 'aid'), stageInfo.user_id);
                 await this.ctx.helper.sendAliSms(users, smsTypeConst.const.JL,
                 await this.ctx.helper.sendAliSms(users, smsTypeConst.const.JL,
                     smsTypeConst.judge.result.toString(), SmsAliConst.template.stage_result, { qi: stageInfo.order, status: SmsAliConst.status.back });
                     smsTypeConst.judge.result.toString(), SmsAliConst.template.stage_result, { qi: stageInfo.order, status: SmsAliConst.status.back });
-                // 添加到消息推送表
-                const noticeContent = await this.getNoticeContent(pid, audit.tid, stageId)
-                await transaction.insert('zh_notice', { pid, type: pushType.stage, uid: this.ctx.stage.user_id, status: auditConst.status.checkNo, is_read: 0, content: noticeContent });
                 await transaction.commit();
                 await transaction.commit();
             } catch (err) {
             } catch (err) {
                 await transaction.rollback();
                 await transaction.rollback();
@@ -512,6 +524,16 @@ module.exports = app => {
             const tpData = await this.ctx.service.stageBills.getSumTotalPrice(this.ctx.stage);
             const tpData = await this.ctx.service.stageBills.getSumTotalPrice(this.ctx.stage);
             const transaction = await this.db.beginTransaction();
             const transaction = await this.db.beginTransaction();
             try {
             try {
+                // 添加推送
+                const noticeContent = await this.getNoticeContent(pid, audit.tid, stageId)
+                const records = [{ pid, type: pushType.stage, uid: this.ctx.stage.user_id, status: auditConst.status.checkNoPre, content: noticeContent }]
+                auditors2.forEach( audit => {
+                    records.push({ pid, type: pushType.stage, uid: audit.aid, status: auditConst.status.checkNoPre, content: noticeContent })
+                })
+
+                await transaction.insert('zh_notice', records);
+
+
                 // 计算并合同支付最终数据
                 // 计算并合同支付最终数据
                 const [yfPay, sfPay] = await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
                 const [yfPay, sfPay] = await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
                 this.ctx.stage.tp_history.push({
                 this.ctx.stage.tp_history.push({
@@ -565,7 +587,6 @@ module.exports = app => {
                     id: stageId, status: checkData.checkType,
                     id: stageId, status: checkData.checkType,
                     cache_time_r: this.ctx.stage.cache_time_l,
                     cache_time_r: this.ctx.stage.cache_time_l,
                 });
                 });
-
                 // 添加短信通知-需要审批提醒功能
                 // 添加短信通知-需要审批提醒功能
                 // const smsUser = await this.ctx.service.projectAccount.getDataById(preAuditor.aid);
                 // const smsUser = await this.ctx.service.projectAccount.getDataById(preAuditor.aid);
                 // if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
                 // if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
@@ -855,7 +876,9 @@ module.exports = app => {
             //     this.ctx.service.projectAccount.tableName, time, pid];
             //     this.ctx.service.projectAccount.tableName, time, pid];
             // return await this.db.query(sql, sqlParam);
             // return await this.db.query(sql, sqlParam);
             let notice =  await this.db.select('zh_notice', {
             let notice =  await this.db.select('zh_notice', {
-                where: { pid, type: pushType.stage, uid, is_read: 0 },
+                where: { pid, type: pushType.stage, uid },
+                orders: [['create_time', 'desc']],
+                limit: 10, offset: 0
             });
             });
             notice = notice.map(v => {
             notice = notice.map(v => {
                 const extra = JSON.parse(v.content)
                 const extra = JSON.parse(v.content)
@@ -870,15 +893,16 @@ module.exports = app => {
          * @param {Number} pid 项目id
          * @param {Number} pid 项目id
          * @param {Number} tid 台账id
          * @param {Number} tid 台账id
          * @param {Number} sid 期id
          * @param {Number} sid 期id
+         * @param {Number} uid 审核人id
          */
          */
-        async getNoticeContent(pid, tid, sid) {
+        async getNoticeContent(pid, tid, sid, uid) {
             const noticeSql = 'SELECT * FROM (SELECT ' +
             const noticeSql = 'SELECT * FROM (SELECT ' +
                 '  t.`id` As `tid`, t.`name`, s.`order`, pa.`name` As `su_name`, pa.role As `su_role`' +
                 '  t.`id` As `tid`, t.`name`, s.`order`, pa.`name` As `su_name`, pa.role As `su_role`' +
                 '  FROM (SELECT * FROM ?? WHERE `id` = ? ) As t' +
                 '  FROM (SELECT * FROM ?? WHERE `id` = ? ) As t' +
                 '  LEFT JOIN ?? As s On s.`id` =  ?' +
                 '  LEFT JOIN ?? As s On s.`id` =  ?' +
-                '  LEFT JOIN ?? As pa ON t.`user_id` = pa.`id`' +
+                '  LEFT JOIN ?? As pa ON pa.`id` = ?' +
                 '  WHERE  t.`project_id` = ? ) as new_t GROUP BY new_t.`tid`';
                 '  WHERE  t.`project_id` = ? ) as new_t GROUP BY new_t.`tid`';
-            const noticeSqlParam = [this.ctx.service.tender.tableName, tid, this.ctx.service.stage.tableName, sid,  this.ctx.service.projectAccount.tableName, pid];
+            const noticeSqlParam = [this.ctx.service.tender.tableName, tid, this.ctx.service.stage.tableName, sid,  this.ctx.service.projectAccount.tableName, uid, pid];
             const content = await this.db.query(noticeSql, noticeSqlParam);
             const content = await this.db.query(noticeSql, noticeSqlParam);
             return content.length ? JSON.stringify(content[0]) : '';
             return content.length ? JSON.stringify(content[0]) : '';
         }
         }

+ 72 - 73
app/view/dashboard/index.ejs

@@ -157,90 +157,88 @@
                     <div class="card">
                     <div class="card">
                         <div class="card-header">需要你关注</div>
                         <div class="card-header">需要你关注</div>
                         <div class="card-body">
                         <div class="card-body">
-                            <% if (noticeLedger.length !== 0 || noticeRevise.length !== 0 || noticeStage.length !== 0 || noticeChange.length !== 0 || noticeMaterial.length !== 0) { %>
+                                <% if(noticeList.length) { %>
                                 <ul id="notice" class="list-unstyled m-0">
                                 <ul id="notice" class="list-unstyled m-0">
-                                    <% for (const nl of noticeLedger) { %>
-                                        <li class="media pb-3 mb-3 border-bottom-1">
-                                            <div class="media-body">
-                                                <div class="row">
-                                                    <div class="col-auto"><span class="badge badge-info">台帐审批</span></div>
-                                                    <div class="col-6">
-                                                        <a data-id="<%- nl.id %>"href="/tender/<%- nl.tid %>/ledger"><%- nl.name %></a> 台帐<%- acLedger.statusString[nl.status]%>
+                                    <% for (const notice of noticeList) { %>
+                                        <% if(notice.type === pushType.stage) { %>
+                                            <li class="media pb-3 mb-3 border-bottom-1">
+                                                <div class="media-body">
+                                                    <div class="row">
+                                                        <div class="col-auto"><span class="badge badge-success">计量审批</span></div>
+                                                        <div class="col-6">
+                                                            <a href="/tender/<%- notice.tid %>"><%- notice.name %></a>
+                                                            <a href="/tender/<%- notice.tid %>/measure/stage/<%- notice.order %>">第<%- notice.order %>期 </a>
+                                                            <%- acStage.statusString[notice.status]%>
+                                                        </div>
                                                     </div>
                                                     </div>
+                                                    <p class="mt-1 mb-0"><%- notice.su_name %><small class="ml-1 text-muted"><%- (notice.su_role ? '- ' + notice.su_role : '') %></small>
+                                                        <span class="pull-right text-muted"><%- ctx.helper.formatFullDate(notice.create_time) %></span>
+                                                    </p>
                                                 </div>
                                                 </div>
-                                                <p class="mt-1 mb-0"><%- nl.su_name %><small class="ml-1 text-muted"><%- (nl.su_role ? '- ' + nl.su_role : '') %></small>
-                                                    <span class="pull-right text-muted"><%- ctx.helper.formatFullDate(nl.create_time) %></span>
-                                                </p>
-                                            </div>
-                                        </li>
-                                    <% } %>
-                                    <% for (const nr of noticeRevise) { %>
-                                        <li class="media pb-3 mb-3 border-bottom-1">
-                                            <div class="media-body">
-                                                <div class="row">
-                                                    <div class="col-auto"><span class="badge badge-info">台账修订</span></div>
-                                                    <div class="col-6">
-                                                        <a data-id="<%- nr.id %>" href="/tender/<%- nr.tid %>"><%- nr.name %></a>
-                                                        <a data-id="<%- nr.id %>" href="/tender/<%- nr.tid %>/revise/info">台账修订(第<%- nr.corder %>次)</a>
-                                                        <%- acRevise.statusString[nr.status]%>
+                                            </li>
+                                        <% } else if(notice.type === pushType.material) { %>
+                                            <li class="media pb-3 mb-3 border-bottom-1">
+                                                <div class="media-body">
+                                                    <div class="row">
+                                                        <div class="col-auto"><span class="badge badge-secondary">材料调差</span></div>
+                                                        <div class="col-6">
+                                                            <a href="/tender/<%- notice.tid %>"><%- notice.name %></a>
+                                                            <a href="/tender/<%- notice.tid %>/measure/material/<%- notice.order %>">第<%- notice.order %>期 </a>
+                                                            <%- acMaterial.statusString[notice.status]%>
+                                                        </div>
                                                     </div>
                                                     </div>
+                                                    <p class="mt-1 mb-0"><%- notice.su_name %><small class="ml-1 text-muted"><%- (notice.su_role ? '- ' + notice.su_role : '') %></small>
+                                                        <span class="pull-right text-muted"><%- ctx.helper.formatFullDate(notice.create_time) %></span>
+                                                    </p>
                                                 </div>
                                                 </div>
-                                                <p class="mt-1 mb-0"><%- nr.su_name %><small class="ml-1 text-muted"><%- (nr.su_role ? '- ' + nr.su_role : '') %></small>
-                                                    <span class="pull-right text-muted"><%- ctx.helper.formatFullDate(nr.create_time) %></span>
-                                                </p>
-                                            </div>
-                                        </li>
-                                    <% } %>
-                                    <% for (const ns of noticeStage) { %>
-                                        <li class="media pb-3 mb-3 border-bottom-1">
-                                            <div class="media-body">
-                                                <div class="row">
-                                                    <div class="col-auto"><span class="badge badge-success">计量审批</span></div>
-                                                    <div class="col-6">
-                                                        <a data-id="<%- ns.id %>" href="/tender/<%- ns.tid %>"><%- ns.name %></a>
-                                                        <a data-id="<%- ns.id %>" href="/tender/<%- ns.tid %>/measure/stage/<%- ns.order %>">第<%- ns.order %>期 </a>
-                                                        <%- acStage.statusString[ns.status]%>
+                                            </li>
+                                        <% } else if(notice.type === pushType.ledger) { %>
+                                            <li class="media pb-3 mb-3 border-bottom-1">
+                                                <div class="media-body">
+                                                    <div class="row">
+                                                        <div class="col-auto"><span class="badge badge-info">台帐审批</span></div>
+                                                        <div class="col-6">
+                                                            <a data-id="<%- notice.id %>"href="/tender/<%- notice.tid %>/ledger"><%- notice.name %></a> 台帐<%- acLedger.statusString[notice.status]%>
+                                                        </div>
                                                     </div>
                                                     </div>
+                                                    <p class="mt-1 mb-0"><%- notice.su_name %><small class="ml-1 text-muted"><%- (notice.su_role ? '- ' + notice.su_role : '') %></small>
+                                                        <span class="pull-right text-muted"><%- ctx.helper.formatFullDate(notice.create_time) %></span>
+                                                    </p>
                                                 </div>
                                                 </div>
-                                                <p class="mt-1 mb-0"><%- ns.su_name %><small class="ml-1 text-muted"><%- (ns.su_role ? '- ' + ns.su_role : '') %></small>
-                                                    <span class="pull-right text-muted"><%- ctx.helper.formatFullDate(ns.create_time) %></span>
-                                                </p>
-                                            </div>
-                                        </li>
-                                    <% } %>
-                                    <% for (const nc of noticeChange) { %>
-                                        <li class="media pb-3 mb-3 border-bottom-1">
-                                            <div class="media-body">
-                                                <div class="row">
-                                                    <div class="col-auto"><span class="badge badge-danger">变更审批</span></div>
-                                                    <div class="col-6">
-                                                        <a data-id="<%- nc.id %>" href="/tender/<%- nc.tid %>"><%- nc.name %></a>
-                                                        <a data-id="<%- nc.id %>" href="/tender/<%- nc.tid %>/change/<%- nc.cid %>/info"><%- nc.c_code %> </a>
-                                                        <%- acChange.statusString[nc.status]%>
+                                            </li>
+                                        <% } else if(notice.type === pushType.revise) { %>
+                                            <li class="media pb-3 mb-3 border-bottom-1">
+                                                <div class="media-body">
+                                                    <div class="row">
+                                                        <div class="col-auto"><span class="badge badge-info">台账修订</span></div>
+                                                        <div class="col-6">
+                                                            <a href="/tender/<%- notice.tid %>"><%- notice.name %></a>
+                                                            <a href="/tender/<%- notice.tid %>/revise/info">台账修订(第<%- notice.corder %>次)</a>
+                                                            <%- acRevise.statusString[notice.status]%>
+                                                        </div>
                                                     </div>
                                                     </div>
+                                                    <p class="mt-1 mb-0"><%- notice.su_name %><small class="ml-1 text-muted"><%- (notice.su_role ? '- ' + notice.su_role : '') %></small>
+                                                        <span class="pull-right text-muted"><%- ctx.helper.formatFullDate(notice.create_time) %></span>
+                                                    </p>
                                                 </div>
                                                 </div>
-                                                <p class="mt-1 mb-0"><%- nc.su_name %><small class="ml-1 text-muted"><%- (nc.su_role ? '- ' + nc.su_role : '') %></small>
-                                                    <span class="pull-right text-muted"><%- ctx.helper.formatFullDate(nc.create_time) %></span>
-                                                </p>
-                                            </div>
-                                        </li>
-                                    <% } %>
-                                    <% for (const nm of noticeMaterial) { %>
-                                        <li class="media pb-3 mb-3 border-bottom-1">
-                                            <div class="media-body">
-                                                <div class="row">
-                                                    <div class="col-auto"><span class="badge badge-secondary">材料调差</span></div>
-                                                    <div class="col-6">
-                                                        <a data-id="<%- nm.id %>" href="/tender/<%- nm.tid %>"><%- nm.name %></a>
-                                                        <a data-id="<%- nm.id %>" href="/tender/<%- nm.tid %>/measure/material/<%- nm.order %>">第<%- nm.order %>期 </a>
-                                                        <%- acMaterial.statusString[nm.status]%>
+                                            </li>
+                                        <% } else { %>
+                                            <li class="media pb-3 mb-3 border-bottom-1">
+                                                <div class="media-body">
+                                                    <div class="row">
+                                                        <div class="col-auto"><span class="badge badge-danger">变更审批</span></div>
+                                                        <div class="col-6">
+                                                            <a href="/tender/<%- notice.tid %>"><%- notice.name %></a>
+                                                            <a href="/tender/<%- notice.tid %>/change/<%- notice.cid %>/info"><%- notice.c_code %> </a>
+                                                            <%- acChange.statusString[notice.status]%>
+                                                        </div>
                                                     </div>
                                                     </div>
+                                                    <p class="mt-1 mb-0"><%- notice.su_name %><small class="ml-1 text-muted"><%- (notice.su_role ? '- ' + notice.su_role : '') %></small>
+                                                        <span class="pull-right text-muted"><%- ctx.helper.formatFullDate(notice.create_time) %></span>
+                                                    </p>
                                                 </div>
                                                 </div>
-                                                <p class="mt-1 mb-0"><%- nm.su_name %><small class="ml-1 text-muted"><%- (nm.su_role ? '- ' + nm.su_role : '') %></small>
-                                                    <span class="pull-right text-muted"><%- ctx.helper.formatFullDate(nm.create_time) %></span>
-                                                </p>
-                                            </div>
-                                        </li>
+                                            </li>
+                                        <% } %>
                                     <% } %>
                                     <% } %>
                                 </ul>
                                 </ul>
                                 <% } else { %>
                                 <% } else { %>
@@ -326,6 +324,7 @@
     autoFlashHeight();
     autoFlashHeight();
     const msgList = JSON.parse('<%- JSON.stringify(msgList) %>');
     const msgList = JSON.parse('<%- JSON.stringify(msgList) %>');
     const sysMsgList = JSON.parse('<%- JSON.stringify(sysMsgList) %>');
     const sysMsgList = JSON.parse('<%- JSON.stringify(sysMsgList) %>');
+    const pushType = JSON.parse('<%- JSON.stringify(pushType) %>');
     const uid = '<%- uid %>';
     const uid = '<%- uid %>';
     const type = 1;
     const type = 1;
     const userMsgPermission = <%- userMsgPermission %>;
     const userMsgPermission = <%- userMsgPermission %>;

+ 4 - 1
sql/update.sql

@@ -21,4 +21,7 @@ ADD COLUMN `dagl_status`  tinyint(4) NULL DEFAULT 0 COMMENT '档案管理-状态
 
 
 ALTER TABLE `zh_pos`
 ALTER TABLE `zh_pos`
 ADD COLUMN `gxby_status`  int(4) NULL DEFAULT 0 COMMENT '工序报验-状态' AFTER `real_qty`,
 ADD COLUMN `gxby_status`  int(4) NULL DEFAULT 0 COMMENT '工序报验-状态' AFTER `real_qty`,
-ADD COLUMN `dagl_status`  int(4) NULL DEFAULT 0 COMMENT '档案管理-状态' AFTER `gxby_status`;
+ADD COLUMN `dagl_status`  int(4) NULL DEFAULT 0 COMMENT '档案管理-状态' AFTER `gxby_status`;
+
+ALTER TABLE `calculation`.`zh_notice`
+DROP COLUMN `is_read`;