Explorar o código

返回报错相关

MaiXinRong %!s(int64=3) %!d(string=hai) anos
pai
achega
27a0818000
Modificáronse 2 ficheiros con 4 adicións e 3 borrados
  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};
         }
     },