Browse Source

期上报,缓存相关

MaiXinRong 2 years ago
parent
commit
547a23e713
1 changed files with 11 additions and 12 deletions
  1. 11 12
      app/service/tender_cache.js

+ 11 - 12
app/service/tender_cache.js

@@ -184,44 +184,43 @@ module.exports = app => {
 
 
         async updateStageCache4Start(transaction, stage, status, auditor, ledgerTp, stageTp) {
         async updateStageCache4Start(transaction, stage, status, auditor, ledgerTp, stageTp) {
             const orgCache = await this.getDataById(stage.tid);
             const orgCache = await this.getDataById(stage.tid);
-            const data = { id: tid, stage_status: status };
-            if (ledgerTp) data.ledger_tp = JSON.parse(ledgerTp);
+            const data = { id: stage.tid, stage_status: status };
+            if (ledgerTp) data.ledger_tp = JSON.stringify(ledgerTp);
             const tp = JSON.parse(orgCache.stage_flow_cur_tp);
             const tp = JSON.parse(orgCache.stage_flow_cur_tp);
             if (stageTp) this._.assign(tp, stageTp);
             if (stageTp) this._.assign(tp, stageTp);
-            data.stage_flow_pre_uid = data.stage_flow_cur_uid;
-            data.stage_flow_pre_info = data.stage_flow_cur_info;
+            data.stage_flow_pre_uid = orgCache.stage_flow_cur_uid;
+            data.stage_flow_pre_info = orgCache.stage_flow_cur_info;
             data.stage_flow_pre_tp = JSON.stringify(tp);
             data.stage_flow_pre_tp = JSON.stringify(tp);
             data.stage_flow_cur_uid = auditor.id;
             data.stage_flow_cur_uid = auditor.id;
             const cur_flow_info = await this.ctx.service.projectAccount.getAccountCacheData(auditor.id);
             const cur_flow_info = await this.ctx.service.projectAccount.getAccountCacheData(auditor.id);
             cur_flow_info.stage_order = stage.order;
             cur_flow_info.stage_order = stage.order;
             cur_flow_info.stage_status = stage.status;
             cur_flow_info.stage_status = stage.status;
-            data.stage_flow_cur_info = JSON.parse(cur_flow_info);
+            data.stage_flow_cur_info = JSON.stringify(cur_flow_info);
             data.stage_flow_cur_tp = JSON.stringify(tp);
             data.stage_flow_cur_tp = JSON.stringify(tp);
             await transaction.update(this.tableName, data);
             await transaction.update(this.tableName, data);
         }
         }
 
 
         async updateStageCache4Flow(transaction, stage, status, auditor, preAuditor, ledgerTp, stageTp, pcTp) {
         async updateStageCache4Flow(transaction, stage, status, auditor, preAuditor, ledgerTp, stageTp, pcTp) {
             const orgCache = await this.getDataById(stage.tid);
             const orgCache = await this.getDataById(stage.tid);
-            const data = { id: tid, stage_status: status };
-            if (ledgerTp) data.ledger_tp = JSON.parse(ledgerTp);
+            const data = { id: stage.tid, stage_status: status };
+            if (ledgerTp) data.ledger_tp = JSON.stringify(ledgerTp);
             const tp = JSON.parse(orgCache.stage_flow_cur_tp);
             const tp = JSON.parse(orgCache.stage_flow_cur_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) {
                 data.stage_flow_pre_uid = preAuditor.id;
                 data.stage_flow_pre_uid = preAuditor.id;
                 const info = await this.ctx.service.projectAccount.getAccountCacheData(preAuditor.id);
                 const info = await this.ctx.service.projectAccount.getAccountCacheData(preAuditor.id);
-                data.stage_flow_pre_info = JSON.parse(info);
+                data.stage_flow_pre_info = JSON.stringify(info);
             }
             }
-            data.stage_flow_pre_uid = data.stage_flow_cur_uid;
-            data.stage_flow_pre_info = data.stage_flow_cur_info;
+            data.stage_flow_pre_uid = orgCache.stage_flow_cur_uid;
+            data.stage_flow_pre_info = orgCache.stage_flow_cur_info;
             data.stage_flow_pre_tp = JSON.stringify(tp);
             data.stage_flow_pre_tp = JSON.stringify(tp);
             if (auditor) {
             if (auditor) {
                 data.stage_flow_cur_uid = auditor.id;
                 data.stage_flow_cur_uid = auditor.id;
                 const info = await this.ctx.service.projectAccount.getAccountCacheData(auditor.id);
                 const info = await this.ctx.service.projectAccount.getAccountCacheData(auditor.id);
-                data.stage_flow_cur_info = JSON.parse(info);
+                data.stage_flow_cur_info = JSON.stringify(info);
             }
             }
             data.stage_flow_cur_tp = JSON.stringify(tp);
             data.stage_flow_cur_tp = JSON.stringify(tp);
-            console.log(data);
             await transaction.update(this.tableName, data);
             await transaction.update(this.tableName, data);
         }
         }