浏览代码

返回报错相关

MaiXinRong 3 年之前
父节点
当前提交
27a0818000
共有 2 个文件被更改,包括 4 次插入3 次删除
  1. 2 1
      app/controller/tender_controller.js
  2. 2 2
      app/extend/context.js

+ 2 - 1
app/controller/tender_controller.js

@@ -1272,8 +1272,9 @@ module.exports = app => {
                         throw '数据错误';
                 }
             } catch (err) {
+                console.log(err);
                 this.log(err);
-                this.ajaxErrorBody(err, '导入数据失败');
+                ctx.ajaxErrorBody(err, '导入数据失败');
             }
         }
 

+ 2 - 2
app/extend/context.js

@@ -48,9 +48,9 @@ module.exports = {
 
     ajaxErrorBody(error, msg) {
         if (error.stack) {
-            return {err: 4, msg: msg, data: null};
+            this.body = {err: 4, msg: msg, data: null};
         } else {
-            return {err: 3, msg: error.toString(), data: null};
+            this.body = {err: 3, msg: error.toString(), data: null};
         }
     },