|  | @@ -11,6 +11,7 @@
 | 
	
		
			
				|  |  |  const auditConst = require('../const/audit').stage;
 | 
	
		
			
				|  |  |  const smsTypeConst = require('../const/sms_type');
 | 
	
		
			
				|  |  |  const SMS = require('../lib/sms');
 | 
	
		
			
				|  |  | +const SmsAliConst = require('../const/sms_alitemplate');
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  module.exports = app => {
 | 
	
		
			
				|  |  |      class StageAudit extends app.BaseService {
 | 
	
	
		
			
				|  | @@ -209,7 +210,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |           * @returns {Promise<boolean>}
 | 
	
		
			
				|  |  |           */
 | 
	
		
			
				|  |  |          async start(stageId, times = 1) {
 | 
	
		
			
				|  |  | -            const audit = await this.getDataByCondition({sid: stageId, times: times, order: 1});
 | 
	
		
			
				|  |  | +            const audit = await this.getDataByCondition({ sid: stageId, times, order: 1 });
 | 
	
		
			
				|  |  |              if (!audit) {
 | 
	
		
			
				|  |  |                  throw '请先选择审批人,再上报数据';
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -244,25 +245,28 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  // 添加短信通知-需要审批提醒功能
 | 
	
		
			
				|  |  | -                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 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);
 | 
	
		
			
				|  |  | +                await this.ctx.helper.sendAliSms(audit.aid, smsTypeConst.const.JL,
 | 
	
		
			
				|  |  | +                    smsTypeConst.judge.approval.toString(), SmsAliConst.template.stage_check, { qi: stageInfo.order });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  // todo 更新标段tender状态 ?
 | 
	
		
			
				|  |  |                  await transaction.commit();
 | 
	
		
			
				|  |  | -            } catch(err) {
 | 
	
		
			
				|  |  | +            } catch (err) {
 | 
	
		
			
				|  |  |                  await transaction.rollback();
 | 
	
		
			
				|  |  |                  throw err;
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -312,22 +316,25 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                      // 添加短信通知-需要审批提醒功能
 | 
	
		
			
				|  |  | -                    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 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);
 | 
	
		
			
				|  |  | +                    await this.ctx.helper.sendAliSms(nextAudit.aid, smsTypeConst.const.JL,
 | 
	
		
			
				|  |  | +                        smsTypeConst.judge.approval.toString(), SmsAliConst.template.stage_check, { qi: stageInfo.order });
 | 
	
		
			
				|  |  |                  } else {
 | 
	
		
			
				|  |  |                      // 本期结束
 | 
	
		
			
				|  |  |                      // 生成截止本期数据 final数据
 | 
	
	
		
			
				|  | @@ -347,34 +354,37 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                      // 添加短信通知-审批通过提醒功能
 | 
	
		
			
				|  |  | -                    const mobile_array = [];
 | 
	
		
			
				|  |  | +                    // 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 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._.pull(this._.map(auditList, 'aid'), stageInfo.user_id);
 | 
	
		
			
				|  |  | +                    await this.ctx.helper.sendAliSms(users, smsTypeConst.const.JL,
 | 
	
		
			
				|  |  | +                        smsTypeConst.judge.result.toString(), SmsAliConst.template.stage_result, { qi: stageInfo.order, status: SmsAliConst.status.success });
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  await transaction.commit();
 | 
	
		
			
				|  |  |              } catch (err) {
 | 
	
	
		
			
				|  | @@ -435,34 +445,37 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  await this.ctx.service.stageBonus.updateHistory(this.ctx.stage, transaction);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  // 添加短信通知-审批退回提醒功能
 | 
	
		
			
				|  |  | -                const mobile_array = [];
 | 
	
		
			
				|  |  | +                // 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 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._.pull(this._.map(auditList, 'aid'), stageInfo.user_id);
 | 
	
		
			
				|  |  | +                await this.ctx.helper.sendAliSms(users, smsTypeConst.const.JL,
 | 
	
		
			
				|  |  | +                    smsTypeConst.judge.result.toString(), SmsAliConst.template.stage_result, { qi: stageInfo.order, status: SmsAliConst.status.back });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  await transaction.commit();
 | 
	
		
			
				|  |  |              } catch (err) {
 | 
	
	
		
			
				|  | @@ -474,7 +487,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |          async _checkNoPre(stageId, checkData, times) {
 | 
	
		
			
				|  |  |              const time = new Date();
 | 
	
		
			
				|  |  |              // 整理当前流程审核人状态更新
 | 
	
		
			
				|  |  | -            const audit = await this.getDataByCondition({sid: stageId, times: times, status: auditConst.status.checking});
 | 
	
		
			
				|  |  | +            const audit = await this.getDataByCondition({ sid: stageId, times, status: auditConst.status.checking });
 | 
	
		
			
				|  |  |              if (!audit || audit.order <= 1) {
 | 
	
		
			
				|  |  |                  throw '审核数据错误';
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -544,25 +557,28 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  // 添加短信通知-需要审批提醒功能
 | 
	
		
			
				|  |  | -                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 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);
 | 
	
		
			
				|  |  | +                await this.ctx.helper.sendAliSms(preAuditor.aid, smsTypeConst.const.JL,
 | 
	
		
			
				|  |  | +                    smsTypeConst.judge.approval.toString(), SmsAliConst.template.stage_check, { qi: stageInfo.order });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  await transaction.commit();
 | 
	
		
			
				|  |  | -            } catch(err) {
 | 
	
		
			
				|  |  | +            } catch (err) {
 | 
	
		
			
				|  |  |                  await transaction.rollback();
 | 
	
		
			
				|  |  |                  throw err;
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -762,21 +778,24 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  // 添加短信通知-需要审批提醒功能
 | 
	
		
			
				|  |  | -                const smsUser = await this.ctx.service.projectAccount.getDataById(audit.aid);
 | 
	
		
			
				|  |  | -                if (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 smsUser = await this.ctx.service.projectAccount.getDataById(audit.aid);
 | 
	
		
			
				|  |  | +                // if (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);
 | 
	
		
			
				|  |  | +                await this.ctx.helper.sendAliSms(audit.aid, smsTypeConst.const.JL,
 | 
	
		
			
				|  |  | +                    smsTypeConst.judge.approval.toString(), SmsAliConst.template.stage_check, { qi: stageInfo.order });
 | 
	
		
			
				|  |  |                  await transaction.commit();
 | 
	
		
			
				|  |  |              } catch (err) {
 | 
	
		
			
				|  |  |                  await transaction.rollback();
 |