Przeglądaj źródła

common-error修复

MaiXinRong 2 lat temu
rodzic
commit
3fb8431fc3

+ 2 - 0
app/controller/revise_controller.js

@@ -216,6 +216,8 @@ module.exports = app => {
         async cancel(ctx) {
         async cancel(ctx) {
             try {
             try {
                 const revise = await ctx.service.ledgerRevise.getLastestRevise(ctx.tender.id);
                 const revise = await ctx.service.ledgerRevise.getLastestRevise(ctx.tender.id);
+                if (!revise) throw '当前标段无任何修订数据';
+
                 if (revise.uid !== ctx.session.sessionUser.accountId) {
                 if (revise.uid !== ctx.session.sessionUser.accountId) {
                     throw '您无权作废该修订';
                     throw '您无权作废该修订';
                 }
                 }

+ 1 - 1
app/extend/helper.js

@@ -1264,7 +1264,7 @@ module.exports = {
     isMobile(agent) {
     isMobile(agent) {
         const ua = new UAParser(agent);
         const ua = new UAParser(agent);
         const osInfo = ua.getOS();
         const osInfo = ua.getOS();
-        return agent.match(/(iphone|ipod|android)/i) || osInfo.name === 'Android' || osInfo.name === 'iOS';
+        return (agent ? agent.match(/(iphone|ipod|android)/i) : false) || osInfo.name === 'Android' || osInfo.name === 'iOS';
     },
     },
 
 
     /**
     /**

+ 2 - 2
app/service/tender_cache.js

@@ -208,7 +208,7 @@ module.exports = app => {
             const orgCache = await this.getDataById(stage.tid);
             const orgCache = await this.getDataById(stage.tid);
             const data = { id: stage.tid, stage_status: status };
             const data = { id: stage.tid, stage_status: status };
             if (ledgerTp) data.ledger_tp = JSON.stringify(ledgerTp);
             if (ledgerTp) data.ledger_tp = JSON.stringify(ledgerTp);
-            const tp = JSON.parse(orgCache.stage_flow_cur_tp);
+            const tp = orgCache.stage_flow_cur_tp ? JSON.parse(orgCache.stage_flow_cur_tp) : (orgCache.stage_flow_pre_tp ? JSON.parse(orgCache.stage_flow_pre_tp) : {});
             if (stageTp) this._.assign(tp, stageTp);
             if (stageTp) this._.assign(tp, stageTp);
             if (pcTp) this._.assign(tp, pcTp);
             if (pcTp) this._.assign(tp, pcTp);
             if (preAuditor) {
             if (preAuditor) {
@@ -253,7 +253,7 @@ module.exports = app => {
         }
         }
 
 
         async updateAdvanceCache(tid) {
         async updateAdvanceCache(tid) {
-            const advance_tp = await this.ctx.service.advance.getSumAdvance(tender.id);
+            const advance_tp = await this.ctx.service.advance.getSumAdvance(tid);
             await this.db.update(this.tableName, { id: tid, advance_tp });
             await this.db.update(this.tableName, { id: tid, advance_tp });
         }
         }