|
@@ -188,7 +188,7 @@ module.exports = app => {
|
|
|
|
|
|
// 添加短信通知-需要审批提醒功能
|
|
// 添加短信通知-需要审批提醒功能
|
|
const smsUser = await this.ctx.service.projectAccount.getDataById(audit.audit_id);
|
|
const smsUser = await this.ctx.service.projectAccount.getDataById(audit.audit_id);
|
|
- if (smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
|
|
|
|
|
|
+ if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
|
|
const smsType = JSON.parse(smsUser.sms_type);
|
|
const smsType = JSON.parse(smsUser.sms_type);
|
|
if (smsType[smsTypeConst.const.TZ] !== undefined && smsType[smsTypeConst.const.TZ].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
|
|
if (smsType[smsTypeConst.const.TZ] !== undefined && smsType[smsTypeConst.const.TZ].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
|
|
const tenderInfo = await this.ctx.service.tender.getDataById(tenderId);
|
|
const tenderInfo = await this.ctx.service.tender.getDataById(tenderId);
|
|
@@ -237,7 +237,7 @@ module.exports = app => {
|
|
|
|
|
|
// 添加短信通知-需要审批提醒功能
|
|
// 添加短信通知-需要审批提醒功能
|
|
const smsUser = await this.ctx.service.projectAccount.getDataById(nextAudit.audit_id);
|
|
const smsUser = await this.ctx.service.projectAccount.getDataById(nextAudit.audit_id);
|
|
- if (smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
|
|
|
|
|
|
+ if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
|
|
const smsType = JSON.parse(smsUser.sms_type);
|
|
const smsType = JSON.parse(smsUser.sms_type);
|
|
if (smsType[smsTypeConst.const.TZ] !== undefined && smsType[smsTypeConst.const.TZ].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
|
|
if (smsType[smsTypeConst.const.TZ] !== undefined && smsType[smsTypeConst.const.TZ].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
|
|
const tenderInfo = await this.ctx.service.tender.getDataById(tenderId);
|
|
const tenderInfo = await this.ctx.service.tender.getDataById(tenderId);
|
|
@@ -252,17 +252,31 @@ module.exports = app => {
|
|
await transaction.update(this.ctx.service.tender.tableName, {id: tenderId, ledger_status: checkType});
|
|
await transaction.update(this.ctx.service.tender.tableName, {id: tenderId, ledger_status: checkType});
|
|
|
|
|
|
// 添加短信通知-审批通过提醒功能
|
|
// 添加短信通知-审批通过提醒功能
|
|
|
|
+ const mobile_array = [];
|
|
const tenderInfo = await this.ctx.service.tender.getDataById(tenderId);
|
|
const tenderInfo = await this.ctx.service.tender.getDataById(tenderId);
|
|
- const smsUser = await this.ctx.service.projectAccount.getDataById(tenderInfo.user_id);
|
|
|
|
- if (smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
|
|
|
|
- const smsType = JSON.parse(smsUser.sms_type);
|
|
|
|
|
|
+ const smsUser1 = await this.ctx.service.projectAccount.getDataById(tenderInfo.user_id);
|
|
|
|
+ if (smsUser1.auth_mobile !== '' && smsUser1.auth_mobile !== undefined && smsUser1.sms_type !== '') {
|
|
|
|
+ const smsType = JSON.parse(smsUser1.sms_type);
|
|
if (smsType[smsTypeConst.const.TZ] !== undefined && smsType[smsTypeConst.const.TZ].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
|
|
if (smsType[smsTypeConst.const.TZ] !== undefined && smsType[smsTypeConst.const.TZ].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
|
|
- const sms = new SMS(this.ctx);
|
|
|
|
- const tenderName = await sms.contentChange(tenderInfo.name);
|
|
|
|
- const content = '【纵横计量支付】' + tenderName + '台账审批通过,请登录系统处理。';
|
|
|
|
- sms.send(smsUser.auth_mobile, content);
|
|
|
|
|
|
+ mobile_array.push(smsUser1.auth_mobile);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ const auditList = await this.getAuditors(tenderId, times);
|
|
|
|
+ for (const user of auditList) {
|
|
|
|
+ const smsUser = await this.ctx.service.projectAccount.getDataById(user.audit_id);
|
|
|
|
+ if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
|
|
|
|
+ const smsType = JSON.parse(smsUser.sms_type);
|
|
|
|
+ if (mobile_array.indexOf(smsUser.auth_mobile) === -1 && smsType[smsTypeConst.const.TZ] !== undefined && smsType[smsTypeConst.const.TZ].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
|
|
|
|
+ mobile_array.push(smsUser.auth_mobile);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (mobile_array.length > 0) {
|
|
|
|
+ const sms = new SMS(this.ctx);
|
|
|
|
+ const tenderName = await sms.contentChange(tenderInfo.name);
|
|
|
|
+ const content = '【纵横计量支付】' + tenderName + '台账审批通过,请登录系统处理。';
|
|
|
|
+ sms.send(mobile_array, content);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
// 同步标段信息
|
|
// 同步标段信息
|
|
@@ -279,17 +293,30 @@ module.exports = app => {
|
|
await transaction.insert(this.tableName, auditors);
|
|
await transaction.insert(this.tableName, auditors);
|
|
|
|
|
|
// 添加短信通知-审批退回提醒功能
|
|
// 添加短信通知-审批退回提醒功能
|
|
|
|
+ const mobile_array = [];
|
|
const tenderInfo = await this.ctx.service.tender.getDataById(tenderId);
|
|
const tenderInfo = await this.ctx.service.tender.getDataById(tenderId);
|
|
- const smsUser = await this.ctx.service.projectAccount.getDataById(tenderInfo.user_id);
|
|
|
|
- if (smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
|
|
|
|
- const smsType = JSON.parse(smsUser.sms_type);
|
|
|
|
|
|
+ const smsUser1 = await this.ctx.service.projectAccount.getDataById(tenderInfo.user_id);
|
|
|
|
+ if (smsUser1.auth_mobile !== '' && smsUser1.auth_mobile !== undefined && smsUser1.sms_type !== '') {
|
|
|
|
+ const smsType = JSON.parse(smsUser1.sms_type);
|
|
if (smsType[smsTypeConst.const.TZ] !== undefined && smsType[smsTypeConst.const.TZ].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
|
|
if (smsType[smsTypeConst.const.TZ] !== undefined && smsType[smsTypeConst.const.TZ].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
|
|
- const sms = new SMS(this.ctx);
|
|
|
|
- const tenderName = await sms.contentChange(tenderInfo.name);
|
|
|
|
- const content = '【纵横计量支付】' + tenderName + '台账审批退回,请登录系统处理。';
|
|
|
|
- sms.send(smsUser.auth_mobile, content);
|
|
|
|
|
|
+ mobile_array.push(smsUser1.auth_mobile);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ for (const user of auditors) {
|
|
|
|
+ const smsUser = await this.ctx.service.projectAccount.getDataById(user.audit_id);
|
|
|
|
+ if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
|
|
|
|
+ const smsType = JSON.parse(smsUser.sms_type);
|
|
|
|
+ if (mobile_array.indexOf(smsUser.auth_mobile) === -1 && smsType[smsTypeConst.const.TZ] !== undefined && smsType[smsTypeConst.const.TZ].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
|
|
|
|
+ mobile_array.push(smsUser.auth_mobile);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (mobile_array.length > 0) {
|
|
|
|
+ const sms = new SMS(this.ctx);
|
|
|
|
+ const tenderName = await sms.contentChange(tenderInfo.name);
|
|
|
|
+ const content = '【纵横计量支付】' + tenderName + '台账审批退回,请登录系统处理。';
|
|
|
|
+ sms.send(mobile_array, content);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
await transaction.commit();
|
|
await transaction.commit();
|