Browse Source

修复wap项目读取bug

laiguoran 5 years ago
parent
commit
483c2e2e12
2 changed files with 9 additions and 5 deletions
  1. 8 4
      app/controller/wap_controller.js
  2. 1 1
      app/service/stage.js

+ 8 - 4
app/controller/wap_controller.js

@@ -142,11 +142,10 @@ module.exports = app => {
         async list(ctx) {
             try {
                 // 获取用户新建标段权利
-                const accountInfo = await this.ctx.service.projectAccount.getDataById(this.ctx.session.sessionUser.accountId);
+                const accountInfo = await this.ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
                 const userPermission = accountInfo !== undefined && accountInfo.permission !== '' ? JSON.parse(accountInfo.permission) : null;
 
                 const tenderList = await this.ctx.service.tender.getList('', userPermission);
-
                 for (const t of tenderList) {
                     if (t.user_id === this.ctx.session.sessionUser.accountId && (
                         t.ledger_status === auditConst.ledger.status.checkNo || t.ledger_status === auditConst.ledger.status.uncheck)) {
@@ -156,9 +155,14 @@ module.exports = app => {
                     }
                     if (t.ledger_status === auditConst.ledger.status.checked) {
                         t.lastStage = await this.ctx.service.stage.getLastestStage(t.id, true);
-                        if (t.lastStage) {
-                            await this.ctx.service.stage.checkStageGatherData(t.lastStage);
+
+                        if (!t.lastStage) continue;
+                        if (t.lastStage.status === auditConst.stage.status.uncheck && t.lastStage.user_id !== this.ctx.session.sessionUser.accountId) {
+                            t.lastStage = await this.ctx.service.stage.getLastestStage(t.id);
                         }
+
+                        if (!t.lastStage) continue;
+                        await this.ctx.service.stage.checkStageGatherData(t.lastStage);
                     }
                 }
                 const categoryData = await this.ctx.service.category.getAllCategory(this.ctx.session.sessionProject.id);

+ 1 - 1
app/service/stage.js

@@ -225,7 +225,7 @@ module.exports = app => {
                     }, {id: stage.id});
                 } else if (stage.tp_history) {
                     const his = this.ctx.helper._.find(stage.tp_history, {times: stage.curTimes, order: stage.curOrder});
-                    console.log(his);
+                    // console.log(his);
                     if (his) {
                         stage.contract_tp = his.contract_tp;
                         stage.qc_tp = his.qc_tp;