Commit 459f57f3 by fengzhaoyu

feat:去掉注释 接口报错向服务端发送日志

parent 16bc937f
...@@ -51,14 +51,6 @@ export default async function login() { ...@@ -51,14 +51,6 @@ export default async function login() {
}) })
}) })
} }
// let time =setInterval(function() {
// if (lock == false) {
// clearInterval(time)
// return;
// }
// }, 100)
async function waitLockRelease(retry) { async function waitLockRelease(retry) {
for (let i = 0; i < retry; i++) { for (let i = 0; i < retry; i++) {
if (lock == false) { if (lock == false) {
......
...@@ -24,7 +24,7 @@ export default function xFetch({ url, method, data, type }) { ...@@ -24,7 +24,7 @@ export default function xFetch({ url, method, data, type }) {
if (res.data.code == 401) { if (res.data.code == 401) {
login(); login();
} }
alertOnce(res.data.msg || '请求异常,请重试', rejects); alertOnce(res.data.msg || '请求异常,请重试', rejects, res);
} }
}, },
fail: function (err) { fail: function (err) {
...@@ -35,7 +35,7 @@ export default function xFetch({ url, method, data, type }) { ...@@ -35,7 +35,7 @@ export default function xFetch({ url, method, data, type }) {
} else { } else {
console.log(err) console.log(err)
alertOnce((err && err.errorMsg) || '网络异常,请重试', rejects); alertOnce((err && err.errorMsg) || '网络异常,请重试', rejects, err);
} }
} }
}); });
...@@ -43,8 +43,9 @@ export default function xFetch({ url, method, data, type }) { ...@@ -43,8 +43,9 @@ export default function xFetch({ url, method, data, type }) {
} }
let alert = false; let alert = false;
function alertOnce(content, rejects) { function alertOnce(content, rejects, err) {
if (alert == false) { if (alert == false) {
sendError(JSON.stringify(err))
dd.alert({ dd.alert({
content: content, content: content,
buttonText: "确定", buttonText: "确定",
...@@ -56,3 +57,21 @@ function alertOnce(content, rejects) { ...@@ -56,3 +57,21 @@ function alertOnce(content, rejects) {
} }
alert = true; alert = true;
} }
function sendError(err) {
let url = `${getApp().globalData.globalUrl}/meet/job/addLog`
dd.httpRequest({
headers: {
"Content-Type": "application/json;charset=UTF-8",
Authorization: `Bearer ${getApp().globalData.token}`
},
data: err,
url: url,
method: 'post',
dataType: "json",
timeout: 15000,
success: function (res) {
},
fail: function (err) {
}
});
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment