MaiXinRong 2 years ago
parent
commit
9e6ec593ba
2 changed files with 1 additions and 100 deletions
  1. 1 1
      app/public/js/shenpi.js
  2. 0 99
      app/service/stage_audit.js

+ 1 - 1
app/public/js/shenpi.js

@@ -775,7 +775,7 @@ $(document).ready(function () {
                 if (rela_lid.length === 0) {
                     data.del = { id: orgAss.id };
                 } else {
-                    if (data.update) data.update = [];
+                    if (!data.update) data.update = [];
                     data.update.push({ id: orgAss.id, ass_ledger_id: rela_lid.join(',')});
                 }
             }

+ 0 - 99
app/service/stage_audit.js

@@ -319,21 +319,6 @@ module.exports = app => {
                 await this.ctx.service.stageAuditAss.cancelLock(this.ctx.stage, audit.aid, transaction);
 
                 // 添加短信通知-需要审批提醒功能
-                // const smsUser = await this.ctx.service.projectAccount.getDataById(audit.aid);
-                // if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
-                //     const smsType = JSON.parse(smsUser.sms_type);
-                //     if (smsType[smsTypeConst.const.JL] !== undefined && smsType[smsTypeConst.const.JL].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
-                //         const tenderInfo = await this.ctx.service.tender.getDataById(audit.tid);
-                //         const stageInfo = await this.ctx.service.stage.getDataById(audit.sid);
-                //         const sms = new SMS(this.ctx);
-                //         const tenderName = await sms.contentChange(tenderInfo.name);
-                //         const projectName = await sms.contentChange(this.ctx.tender.info.deal_info.buildName);
-                //         const ptmsg = projectName !== '' ? '项目「' + projectName + '」标段「' + tenderName + '」' : tenderName;
-                //         const result = await this.ctx.helper.urlToShort('http://' + this.ctx.request.header.host + '/wap/tender/' + this.ctx.tender.id + '/stage/' + stageInfo.order);
-                //         const content = '【纵横计量支付】' + ptmsg + '第' + stageInfo.order + '期,需要您审批。' + result;
-                //         sms.send(smsUser.auth_mobile, content);
-                //     }
-                // }
                 const stageInfo = await this.ctx.service.stage.getDataById(audit.sid);
                 const shenpiUrl = await this.ctx.helper.urlToShort(this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + this.ctx.tender.id + '/stage/' + stageInfo.order);
                 const users = this._.map(this.ctx.stage.auditAssists.filter(x => { return x.user_id === audit.aid }), 'ass_user_id');
@@ -464,22 +449,6 @@ module.exports = app => {
                     await this.ctx.service.stageAuditAss.cancelLock(this.ctx.stage, nextAudit.aid, transaction);
 
                     // 添加短信通知-需要审批提醒功能
-                    // const smsUser = await this.ctx.service.projectAccount.getDataById(nextAudit.aid);
-                    // if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
-                    //     const smsType = JSON.parse(smsUser.sms_type);
-                    //     if (smsType[smsTypeConst.const.JL] !== undefined && smsType[smsTypeConst.const.JL].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
-                    //         const tenderInfo = await this.ctx.service.tender.getDataById(nextAudit.tid);
-                    //         const stageInfo = await this.ctx.service.stage.getDataById(nextAudit.sid);
-                    //         const sms = new SMS(this.ctx);
-                    //         const tenderName = await sms.contentChange(tenderInfo.name);
-                    //         const projectName = await sms.contentChange(this.ctx.tender.info.deal_info.buildName);
-                    //         const result = await this.ctx.helper.urlToShort('http://' + this.ctx.request.header.host + '/wap/tender/' + this.ctx.tender.id + '/stage/' + stageInfo.order);
-                    //         // const result = '';
-                    //         const ptmsg = projectName !== '' ? '项目「' + projectName + '」标段「' + tenderName + '」' : tenderName;
-                    //         const content = '【纵横计量支付】' + ptmsg + '第' + stageInfo.order + '期,需要您审批。' + result;
-                    //         sms.send(smsUser.auth_mobile, content);
-                    //     }
-                    // }
                     const stageInfo = await this.ctx.service.stage.getDataById(nextAudit.sid);
                     const shenpiUrl = await this.ctx.helper.urlToShort(this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + this.ctx.tender.id + '/stage/' + stageInfo.order);
                     const users = this._.map(this.ctx.auditAssists.filter(x => { return x.user_id === nextAudit.id; }), 'ass_user_id');
@@ -522,34 +491,8 @@ module.exports = app => {
                     });
 
                     // 添加短信通知-审批通过提醒功能
-                    // const mobile_array = [];
                     const stageInfo = await this.ctx.service.stage.getDataById(stageId);
                     const auditList = await this.getAuditors(stageId, stageInfo.times);
-                    // const smsUser1 = await this.ctx.service.projectAccount.getDataById(stageInfo.user_id);
-                    // if (smsUser1.auth_mobile !== undefined && smsUser1.sms_type !== '' && smsUser1.sms_type !== null) {
-                    //     const smsType = JSON.parse(smsUser1.sms_type);
-                    //     if (smsType[smsTypeConst.const.JL] !== undefined && smsType[smsTypeConst.const.JL].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
-                    //         mobile_array.push(smsUser1.auth_mobile);
-                    //     }
-                    // }
-                    // for (const user of auditList) {
-                    //     const smsUser = await this.ctx.service.projectAccount.getDataById(user.aid);
-                    //     if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
-                    //         const smsType = JSON.parse(smsUser.sms_type);
-                    //         if (mobile_array.indexOf(smsUser.auth_mobile) === -1 && smsType[smsTypeConst.const.JL] !== undefined && smsType[smsTypeConst.const.JL].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
-                    //             mobile_array.push(smsUser.auth_mobile);
-                    //         }
-                    //     }
-                    // }
-                    // if (mobile_array.length > 0) {
-                    //     const tenderInfo = await this.ctx.service.tender.getDataById(stageInfo.tid);
-                    //     const sms = new SMS(this.ctx);
-                    //     const tenderName = await sms.contentChange(tenderInfo.name);
-                    //     const projectName = await sms.contentChange(this.ctx.tender.info.deal_info.buildName);
-                    //     const ptmsg = projectName !== '' ? '项目「' + projectName + '」标段「' + tenderName + '」' : tenderName;
-                    //     const content = '【纵横计量支付】' + ptmsg + '第' + stageInfo.order + '期,审批通过。';
-                    //     sms.send(mobile_array, content);
-                    // }
                     const users = this._.uniq(this._.concat(this._.map(auditList, 'aid'), stageInfo.user_id, this._.map(this.ctx.stage.userAssists, 'ass_user_id'), this._.map(this.ctx.stage.auditAssists, 'ass_user_id')));
                     await this.ctx.helper.sendAliSms(users, smsTypeConst.const.JL, smsTypeConst.judge.result.toString(), SmsAliConst.template.stage_result, {
                         qi: stageInfo.order,
@@ -679,31 +622,6 @@ module.exports = app => {
                 // const mobile_array = [];
                 const stageInfo = await this.ctx.service.stage.getDataById(stageId);
                 const auditList = await this.getAuditors(stageId, stageInfo.times);
-                // const smsUser1 = await this.ctx.service.projectAccount.getDataById(stageInfo.user_id);
-                // if (smsUser1.auth_mobile !== '' && smsUser1.auth_mobile !== undefined && smsUser1.sms_type !== '' && smsUser1.sms_type !== null) {
-                //     const smsType = JSON.parse(smsUser1.sms_type);
-                //     if (smsType[smsTypeConst.const.JL] !== undefined && smsType[smsTypeConst.const.JL].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
-                //         mobile_array.push(smsUser1.auth_mobile);
-                //     }
-                // }
-                // for (const user of auditList) {
-                //     const smsUser = await this.ctx.service.projectAccount.getDataById(user.aid);
-                //     if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
-                //         const smsType = JSON.parse(smsUser.sms_type);
-                //         if (mobile_array.indexOf(smsUser.auth_mobile) === -1 && smsType[smsTypeConst.const.JL] !== undefined && smsType[smsTypeConst.const.JL].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
-                //             mobile_array.push(smsUser.auth_mobile);
-                //         }
-                //     }
-                // }
-                // if (mobile_array.length > 0) {
-                //     const tenderInfo = await this.ctx.service.tender.getDataById(stageInfo.tid);
-                //     const sms = new SMS(this.ctx);
-                //     const tenderName = await sms.contentChange(tenderInfo.name);
-                //     const projectName = await sms.contentChange(this.ctx.tender.info.deal_info.buildName);
-                //     const ptmsg = projectName !== '' ? '项目「' + projectName + '」标段「' + tenderName + '」' : tenderName;
-                //     const content = '【纵横计量支付】' + ptmsg + '第' + stageInfo.order + '期,审批退回。';
-                //     sms.send(mobile_array, content);
-                // }
                 const users = this._.uniq(this._.concat(this._.map(auditList, 'aid'), stageInfo.user_id, this._.map(this.ctx.stage.userAssists, 'ass_user_id'), this._.map(this.ctx.stage.auditAssists, 'ass_user_id')));
                 await this.ctx.helper.sendAliSms(users, smsTypeConst.const.JL, smsTypeConst.judge.result.toString(), SmsAliConst.template.stage_result, {
                     qi: stageInfo.order,
@@ -854,23 +772,6 @@ module.exports = app => {
                     status: checkData.checkType,
                     cache_time_r: this.ctx.stage.cache_time_l,
                 });
-                // 添加短信通知-需要审批提醒功能
-                // 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) {
-                //     const smsType = JSON.parse(smsUser.sms_type);
-                //     if (smsType[smsTypeConst.const.JL] !== undefined && smsType[smsTypeConst.const.JL].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
-                //         const tenderInfo = await this.ctx.service.tender.getDataById(audit.tid);
-                //         const stageInfo = await this.ctx.service.stage.getDataById(audit.sid);
-                //         const sms = new SMS(this.ctx);
-                //         const tenderName = await sms.contentChange(tenderInfo.name);
-                //         const projectName = await sms.contentChange(this.ctx.tender.info.deal_info.buildName);
-                //         const ptmsg = projectName !== '' ? '项目「' + projectName + '」标段「' + tenderName + '」' : tenderName;
-                //         const result = await this.ctx.helper.urlToShort('http://' + this.ctx.request.header.host + '/wap/tender/' + this.ctx.tender.id + '/stage/' + stageInfo.order);
-                //         // const result = '';
-                //         const content = '【纵横计量支付】' + ptmsg + '第' + stageInfo.order + '期,需要您审批。' + result;
-                //         sms.send(smsUser.auth_mobile, content);
-                //     }
-                // }
                 const stageInfo = await this.ctx.service.stage.getDataById(audit.sid);
                 const shenpiUrl = await this.ctx.helper.urlToShort(this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + this.ctx.tender.id + '/stage/' + stageInfo.order);
                 const users = this._.map(this.ctx.stage.auditAssists.filter(x => {return x.user_id === preAuditor.aid}), 'ass_user_id');