Selaa lähdekoodia

feat: 更新weapp标段控制器,简化用户信息获取逻辑,优化项目进度处理

caipin 2 kuukautta sitten
vanhempi
commit
68582e0d9e
1 muutettua tiedostoa jossa 3 lisäystä ja 3 poistoa
  1. 3 3
      app/controller/weapp_tender_controller.js

+ 3 - 3
app/controller/weapp_tender_controller.js

@@ -12,7 +12,7 @@ module.exports = app => {
                     ctx.body = { err: 1, msg: '缺少projectId参数', data: null };
                     ctx.body = { err: 1, msg: '缺少projectId参数', data: null };
                     return;
                     return;
                 }
                 }
-                const accountInfo = await this.ctx.service.projectAccount.getDataById(ctx.session.sessionUser.id);
+                const accountInfo = ctx.session.sessionUser;
                 const userPermission = accountInfo !== undefined && accountInfo.permission !== '' ? JSON.parse(accountInfo.permission) : null;
                 const userPermission = accountInfo !== undefined && accountInfo.permission !== '' ? JSON.parse(accountInfo.permission) : null;
                 if (userPermission !== null && userPermission.tender !== undefined && userPermission.tender.indexOf('1') !== -1) {
                 if (userPermission !== null && userPermission.tender !== undefined && userPermission.tender.indexOf('1') !== -1) {
                     const subProject = await this.ctx.service.subProject.getDataById(projectId);
                     const subProject = await this.ctx.service.subProject.getDataById(projectId);
@@ -90,7 +90,7 @@ module.exports = app => {
                 const monthProgress = [];
                 const monthProgress = [];
                 for (const s of stages) {
                 for (const s of stages) {
                     if (s.s_time) {
                     if (s.s_time) {
-                        let progress = monthProgress.find(function(x) {
+                        let progress = monthProgress.find(function (x) {
                             return x.month === s.s_time;
                             return x.month === s.s_time;
                         });
                         });
                         if (!progress) {
                         if (!progress) {
@@ -100,7 +100,7 @@ module.exports = app => {
                         progress.tp = ctx.helper.add(ctx.helper.add(progress.tp, s.contract_tp), s.qc_tp);
                         progress.tp = ctx.helper.add(ctx.helper.add(progress.tp, s.contract_tp), s.qc_tp);
                     }
                     }
                 }
                 }
-                monthProgress.sort(function(x, y) {
+                monthProgress.sort(function (x, y) {
                     return Date.parse(x.month) - Date.parse(y.month);
                     return Date.parse(x.month) - Date.parse(y.month);
                 });
                 });
                 let sum = 0;
                 let sum = 0;