From 082cd2658a36a18b905d3866a9bdcb638d87dcea Mon Sep 17 00:00:00 2001 From: lijuncheng Date: Mon, 12 Aug 2024 14:45:34 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E7=BB=9C=E8=AF=B7=E6=B1=82=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/httpRequest3.js | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/src/api/httpRequest3.js b/src/api/httpRequest3.js index 30c879c4..85e764ed 100644 --- a/src/api/httpRequest3.js +++ b/src/api/httpRequest3.js @@ -43,18 +43,40 @@ function service(options = {}) { url: '/pages/login/index' }) } - reject("系统异常:" + res.data.msg) - console.log("系统异常", res.data.msg) + if (res.data.msg) { + if (res.data.msg.includes('get lock')) { + reject("系统异常:" + "数据库死锁") + } else { + reject("系统异常:" + res.data.msg) + } + } else { + reject("系统异常:") + } } } else { - reject("系统异常:" + res.data.msg) - console.log("系统异常", res.data.msg) + if (res.data.msg) { + if (res.data.msg.includes('get lock')) { + reject("系统异常:" + "数据库死锁") + } else { + reject("系统异常:" + res.data.msg) + } + } else { + reject("系统异常:") + } } } else { - reject("系统异常:" + res.data.msg) - console.log("系统异常", res.data.msg) + if (res.data.msg) { + if (res.data.msg.includes('get lock')) { + reject("系统异常:" + "数据库死锁") + } else { + reject("系统异常:" + res.data.msg) + } + } else { + reject("系统异常:") + } + } }; options.fail = (error) => { @@ -65,6 +87,8 @@ function service(options = {}) { message = '接口请求超时' } else if (message.includes('Request failed with status code')) { message = '接口' + message.substr(message.length - 3) + '异常' + } else if (message.includes('get lock')) { + message = '接口' + "数据库死锁" } reject("系统异常:" + message); console.log("系统异常", message) @@ -84,9 +108,9 @@ function service(options = {}) { // #endif // #ifdef H5 console.log("网s络H5", navigator.onLine) - if(navigator.onLine){ + if (navigator.onLine) { uni.request(options); - }else { + } else { reject("当前无网络"); } // #endif