Kaynağa Gözat

成本管理,所有期列表页面出错重定向调整,防止重定向过多

MaiXinRong 1 gün önce
ebeveyn
işleme
fd93ecf5ea
1 değiştirilmiş dosya ile 3 ekleme ve 4 silme
  1. 3 4
      app/controller/cost_controller.js

+ 3 - 4
app/controller/cost_controller.js

@@ -9,7 +9,6 @@
  */
 const audit = require('../const/audit');
 const shenpiConst = require('../const/shenpi');
-const moment = require('moment');
 const sendToWormhole = require('stream-wormhole');
 const fs = require('fs');
 const path = require('path');
@@ -120,7 +119,7 @@ module.exports = app => {
                 await this.layout('cost/ledger_list.ejs', renderData, 'cost/ledger_list_modal.ejs');
             } catch(err) {
                 ctx.log(err);
-                ctx.redirect(ctx.request.header.referer);
+                ctx.redirect(`/sp/${ctx.subProject.id}/cost`);
             }
         }
         async book(ctx) {
@@ -142,7 +141,7 @@ module.exports = app => {
                 await this.layout('cost/book_list.ejs', renderData, 'cost/book_list_modal.ejs');
             } catch(err) {
                 ctx.log(err);
-                ctx.redirect(ctx.request.header.referer);
+                ctx.redirect(`/sp/${ctx.subProject.id}/cost`);
             }
         }
         async analysis(ctx) {
@@ -167,7 +166,7 @@ module.exports = app => {
                 await this.layout('cost/analysis_list.ejs', renderData, 'cost/analysis_list_modal.ejs');
             } catch(err) {
                 ctx.log(err);
-                ctx.redirect(ctx.request.header.referer);
+                ctx.redirect(`/sp/${ctx.subProject.id}/cost`);
             }
         }