mirror of
https://github.com/whyour/qinglong.git
synced 2026-12-01 18:40:37 +08:00
修复设置通知错误时提示不清晰
This commit is contained in:
1 parent
ca150dc6a6
commit
826f214f0f
4 files changed
+94
-24
No files matched your search
@@ -7,7 +7,7 @@ export default defineConfig({
|
|||||||
antd: {},
|
antd: {},
|
||||||
outputPath: 'static/dist',
|
outputPath: 'static/dist',
|
||||||
fastRefresh: true,
|
fastRefresh: true,
|
||||||
favicons: ['./images/favicon.svg'],
|
favicons: [`https://qn.whyour.cn/favicon.svg`],
|
||||||
mfsu: {
|
mfsu: {
|
||||||
strategy: 'eager',
|
strategy: 'eager',
|
||||||
},
|
},
|
||||||
|
|||||||
+83
-19
@@ -93,7 +93,11 @@ export default class NotificationService {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.json();
|
.json();
|
||||||
return typeof res.id === 'number';
|
if (typeof res.id === 'number') {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
throw new Error(JSON.stringify(res));
|
||||||
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.response ? error.response.body : error);
|
throw new Error(error.response ? error.response.body : error);
|
||||||
}
|
}
|
||||||
@@ -109,7 +113,11 @@ export default class NotificationService {
|
|||||||
headers: { Authorization: 'Bearer ' + goCqHttpBotToken },
|
headers: { Authorization: 'Bearer ' + goCqHttpBotToken },
|
||||||
})
|
})
|
||||||
.json();
|
.json();
|
||||||
return res.retcode === 0;
|
if (res.retcode === 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
throw new Error(JSON.stringify(res));
|
||||||
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.response ? error.response.body : error);
|
throw new Error(error.response ? error.response.body : error);
|
||||||
}
|
}
|
||||||
@@ -128,7 +136,11 @@ export default class NotificationService {
|
|||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
})
|
})
|
||||||
.json();
|
.json();
|
||||||
return res.errno === 0 || res.data.errno === 0;
|
if (res.errno === 0 || res.data.errno === 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
throw new Error(JSON.stringify(res));
|
||||||
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.response ? error.response.body : error);
|
throw new Error(error.response ? error.response.body : error);
|
||||||
}
|
}
|
||||||
@@ -147,9 +159,14 @@ export default class NotificationService {
|
|||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
})
|
})
|
||||||
.json();
|
.json();
|
||||||
return (
|
if (
|
||||||
res.content.result.length !== undefined && res.content.result.length > 0
|
res.content.result.length !== undefined &&
|
||||||
);
|
res.content.result.length > 0
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
throw new Error(JSON.stringify(res));
|
||||||
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.response ? error.response.body : error);
|
throw new Error(error.response ? error.response.body : error);
|
||||||
}
|
}
|
||||||
@@ -166,7 +183,11 @@ export default class NotificationService {
|
|||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
})
|
})
|
||||||
.json();
|
.json();
|
||||||
return res.success;
|
if (res.success) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
throw new Error(JSON.stringify(res));
|
||||||
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.response ? error.response.body : error);
|
throw new Error(error.response ? error.response.body : error);
|
||||||
}
|
}
|
||||||
@@ -190,7 +211,11 @@ export default class NotificationService {
|
|||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
})
|
})
|
||||||
.json();
|
.json();
|
||||||
return res.code === 200;
|
if (res.code === 200) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
throw new Error(JSON.stringify(res));
|
||||||
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.response ? error.response.body : error);
|
throw new Error(error.response ? error.response.body : error);
|
||||||
}
|
}
|
||||||
@@ -234,7 +259,11 @@ export default class NotificationService {
|
|||||||
agent,
|
agent,
|
||||||
})
|
})
|
||||||
.json();
|
.json();
|
||||||
return !!res.ok;
|
if (res.ok) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
throw new Error(JSON.stringify(res));
|
||||||
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.response ? error.response.body : error);
|
throw new Error(error.response ? error.response.body : error);
|
||||||
}
|
}
|
||||||
@@ -263,7 +292,11 @@ export default class NotificationService {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.json();
|
.json();
|
||||||
return res.errcode === 0;
|
if (res.errcode === 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
throw new Error(JSON.stringify(res));
|
||||||
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.response ? error.response.body : error);
|
throw new Error(error.response ? error.response.body : error);
|
||||||
}
|
}
|
||||||
@@ -284,7 +317,11 @@ export default class NotificationService {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.json();
|
.json();
|
||||||
return res.errcode === 0;
|
if (res.errcode === 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
throw new Error(JSON.stringify(res));
|
||||||
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.response ? error.response.body : error);
|
throw new Error(error.response ? error.response.body : error);
|
||||||
}
|
}
|
||||||
@@ -359,7 +396,11 @@ export default class NotificationService {
|
|||||||
)
|
)
|
||||||
.json();
|
.json();
|
||||||
|
|
||||||
return res.errcode === 0;
|
if (res.errcode === 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
throw new Error(JSON.stringify(res));
|
||||||
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.response ? error.response.body : error);
|
throw new Error(error.response ? error.response.body : error);
|
||||||
}
|
}
|
||||||
@@ -403,8 +444,11 @@ export default class NotificationService {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.json();
|
.json();
|
||||||
|
if (res.code === 0) {
|
||||||
return res.code === 0;
|
return true;
|
||||||
|
} else {
|
||||||
|
throw new Error(JSON.stringify(res));
|
||||||
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.response ? error.response.body : error);
|
throw new Error(error.response ? error.response.body : error);
|
||||||
}
|
}
|
||||||
@@ -422,7 +466,11 @@ export default class NotificationService {
|
|||||||
})
|
})
|
||||||
.json();
|
.json();
|
||||||
|
|
||||||
return res.ret === 0;
|
if (res.ret === 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
throw new Error(JSON.stringify(res));
|
||||||
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.response ? error.response.body : error);
|
throw new Error(error.response ? error.response.body : error);
|
||||||
}
|
}
|
||||||
@@ -444,7 +492,11 @@ export default class NotificationService {
|
|||||||
})
|
})
|
||||||
.json();
|
.json();
|
||||||
|
|
||||||
return res.code === 200;
|
if (res.code === 200) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
throw new Error(JSON.stringify(res));
|
||||||
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.response ? error.response.body : error);
|
throw new Error(error.response ? error.response.body : error);
|
||||||
}
|
}
|
||||||
@@ -468,7 +520,11 @@ export default class NotificationService {
|
|||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
})
|
})
|
||||||
.json();
|
.json();
|
||||||
return res.StatusCode === 0;
|
if (res.StatusCode === 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
throw new Error(JSON.stringify(res));
|
||||||
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.response ? error.response.body : error);
|
throw new Error(error.response ? error.response.body : error);
|
||||||
}
|
}
|
||||||
@@ -495,7 +551,11 @@ export default class NotificationService {
|
|||||||
|
|
||||||
transporter.close();
|
transporter.close();
|
||||||
|
|
||||||
return !!info.messageId;
|
if (info.messageId) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
throw new Error(JSON.stringify(info));
|
||||||
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.response ? error.response.body : error);
|
throw new Error(error.response ? error.response.body : error);
|
||||||
}
|
}
|
||||||
@@ -529,7 +589,11 @@ export default class NotificationService {
|
|||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
const res = await got(formatUrl, options);
|
const res = await got(formatUrl, options);
|
||||||
return String(res.statusCode).startsWith('20');
|
if (String(res.statusCode).startsWith('20')) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
throw new Error(JSON.stringify(res));
|
||||||
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.response ? error.response.body : error);
|
throw new Error(error.response ? error.response.body : error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1660987580315" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5759" width="128" height="128" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css"></style></defs><path d="M883.2 576.8s93.6-60.8 118.4-140c-38.4 8-79.2 16.8-114.4 24.8-21.6-183.2-179.2-327.2-369.6-327.2-192 0-348.8 144.8-369.6 331.2-36-8.8-84.8-19.2-128-28 24.8 78.4 133.6 148 133.6 148s-30.4 0.8-90.4-8.8c42.4 74.4 120 92.8 120 92.8s-31.2 11.2-77.6 12.8c28.8 45.6 90.4 72 148 86.4 68 68 160.8 108.8 263.2 108.8 105.6 0 200-44 268-114.4 51.2-15.2 103.2-40.8 129.6-80.8-46.4-1.6-65.6-6.4-65.6-6.4s66.4-24 108-99.2c-58.4 8.8-73.6 0-73.6 0z" fill="#F5B116" p-id="5760"></path><path d="M518.4 890.4c-101.6 0-196.8-39.2-269.6-110.4-75.2-20-126.4-50.4-152-91.2l-12-18.4 21.6-0.8c12.8-0.8 24.8-1.6 34.4-3.2-27.2-13.6-62.4-39.2-88-83.2L40.8 560l26.4 4c17.6 2.4 32.8 4.8 45.6 5.6-35.2-28-87.2-76-103.2-128.8l-6.4-20 20.8 4c39.2 8 80.8 16.8 114.4 24.8 28-188 188.8-328 380-328 190.4 0 350.4 138.4 379.2 325.6 38.4-9.6 72-16 101.6-21.6l20.8-4-5.6 20c-17.6 56-65.6 102.4-96.8 128 10.4 0 23.2-1.6 40-4l26.4-4-12.8 23.2c-24 42.4-55.2 69.6-79.2 85.6 8 0.8 16 0.8 26.4 1.6l21.6 0.8-12 18.4c-24 36.8-68 65.6-132.8 85.6-75.2 72.8-172 113.6-276.8 113.6zM132 693.6c25.6 27.2 68.8 48 125.6 63.2l3.2 0.8 3.2 2.4c68 68 158.4 105.6 254.4 105.6 99.2 0 191.2-39.2 258.4-110.4l2.4-2.4 3.2-0.8c48.8-14.4 85.6-33.6 108-57.6-30.4-2.4-44-5.6-44.8-5.6l-13.6-3.2c-8-2.4-8.8-13.6-0.8-16l12.8-4c0.8 0 48.8-18.4 87.2-71.2-38.4 3.2-52-2.4-56-4.8l-5.6-3.2c-4.8-3.2-5.6-11.2 0-14.4l5.6-3.2c0.8-0.8 74.4-48.8 104.8-112-27.2 5.6-57.6 12.8-90.4 20l-13.6 3.2-1.6-14.4c-20.8-181.6-175.2-317.6-356.8-317.6-183.2 0-336.8 137.6-356.8 319.2L160 480l-14.4-3.2c-28-6.4-66.4-15.2-104-24 32.8 64.8 119.2 120 120 120.8l12 8c6.4 4 4 15.2-4 15.2h-13.6c-0.8 0-23.2 0.8-64-4.8 40 49.6 96 64 96.8 64l14.4 3.2c8.8 1.6 8.8 13.6 0.8 16l-14.4 4.8c-1.6 2.4-24 9.6-57.6 13.6z m751.2-116.8z" p-id="5761"></path><path d="M264.8 282.4s-185.6-77.6-160-124c24-42.4 84.8-12 84.8-12S132 41.6 176 20c64.8-32.8 146.4 209.6 146.4 209.6s0 28.8-13.6 40.8c-18.4 14.4-44 12-44 12z" fill="#B02523" p-id="5762"></path><path d="M268 295.2h-5.6l-1.6-0.8c-15.2-6.4-150.4-64-167.2-114.4-3.2-10.4-2.4-19.2 1.6-28 16-28.8 45.6-31.2 71.2-27.2-12-26.4-24.8-65.6-16-92 3.2-11.2 11.2-20 20.8-25.6 11.2-5.6 24-5.6 35.2-0.8C268.8 33.6 328 204.8 335.2 224l0.8 1.6v2.4c0 3.2-0.8 34.4-18.4 49.6-18.4 16-39.2 17.6-49.6 17.6z m0-25.6c4.8 0 20.8-0.8 32-10.4 6.4-5.6 9.6-20.8 9.6-29.6C292 178.4 239.2 48 196 30.4c-4.8-2.4-10.4-2.4-14.4 0-4 1.6-6.4 4.8-8 10.4-8 24 13.6 73.6 28 100l19.2 35.2-36-17.6c-0.8 0-50.4-24.8-68.8 6.4-0.8 1.6-1.6 3.2 0 8 10.4 28.8 98.4 74.4 152 96.8z" p-id="5763"></path><path d="M760 282.4s185.6-77.6 160-124c-24-42.4-84.8-12-84.8-12s58.4-105.6 14.4-128c-64.8-32.8-146.4 209.6-146.4 209.6s0 28.8 13.6 40.8c17.6 16 43.2 13.6 43.2 13.6z" fill="#B02523" p-id="5764"></path><path d="M756.8 295.2c-9.6 0-31.2-1.6-48-16.8-17.6-15.2-18.4-46.4-18.4-49.6v-2.4l0.8-1.6c6.4-19.2 65.6-192 128.8-216.8 12-4.8 24.8-4.8 35.2 0.8 10.4 4.8 16.8 13.6 20.8 25.6 8.8 27.2-4.8 65.6-16 92 25.6-4.8 55.2-1.6 71.2 27.2 4.8 8.8 4.8 17.6 1.6 28-16.8 50.4-152 108-167.2 114.4l-1.6 0.8h-1.6c-1.6-1.6-3.2-1.6-5.6-1.6z m3.2-12.8z m-44-52c0.8 8.8 3.2 24 9.6 29.6 11.2 9.6 27.2 10.4 32 10.4 54.4-23.2 140.8-68.8 151.2-98.4 1.6-3.2 0.8-5.6 0-8-17.6-31.2-68-6.4-68.8-6.4l-36 17.6 19.2-35.2c14.4-26.4 35.2-76.8 28-100-1.6-4.8-4-8-8-10.4-4-2.4-9.6-2.4-14.4 0-43.2 19.2-96 148.8-112.8 200.8z" p-id="5765"></path><path d="M299.2 447.2a84.8 68 90 1 0 136 0 84.8 68 90 1 0-136 0Z" fill="#FFFFFF" p-id="5766"></path><path d="M367.2 540c-41.6 0-76-41.6-76-92.8s33.6-92.8 76-92.8 76 41.6 76 92.8-34.4 92.8-76 92.8z m0-168.8c-32.8 0-59.2 34.4-59.2 76 0 42.4 27.2 76 59.2 76s59.2-34.4 59.2-76c0-42.4-26.4-76-59.2-76z" p-id="5767"></path><path d="M281.6 378.4c-1.6 0-2.4 0-3.2-0.8-4-1.6-5.6-6.4-3.2-11.2 16.8-33.6 53.6-56 92-56s74.4 20 91.2 54.4c2.4 4 0.8 9.6-3.2 12-4 2.4-9.6 0.8-12-3.2-14.4-28-44-44.8-76.8-44.8s-63.2 17.6-77.6 45.6c-0.8 1.6-4 4-7.2 4zM585.6 378.4c-1.6 0-2.4 0-3.2-0.8-4-1.6-5.6-6.4-3.2-11.2 16.8-33.6 53.6-56 92-56 39.2 0 74.4 20 91.2 54.4 2.4 4 0.8 9.6-3.2 12-4 2.4-9.6 0.8-12-3.2-14.4-28-44-44.8-76.8-44.8s-63.2 17.6-77.6 45.6c-0.8 1.6-3.2 4-7.2 4z" p-id="5768"></path><path d="M367.2 450.4m-33.6 0a33.6 33.6 0 1 0 67.2 0 33.6 33.6 0 1 0-67.2 0Z" p-id="5769"></path><path d="M603.2 447.2a84.8 68 90 1 0 136 0 84.8 68 90 1 0-136 0Z" fill="#FFFFFF" p-id="5770"></path><path d="M671.2 540c-41.6 0-76-41.6-76-92.8s33.6-92.8 76-92.8 76 41.6 76 92.8-34.4 92.8-76 92.8z m0-168.8c-32.8 0-59.2 34.4-59.2 76 0 42.4 27.2 76 59.2 76s59.2-34.4 59.2-76c0-42.4-26.4-76-59.2-76z" p-id="5771"></path><path d="M671.2 450.4m-33.6 0a33.6 33.6 0 1 0 67.2 0 33.6 33.6 0 1 0-67.2 0Z" p-id="5772"></path><path d="M385.6 736.8l-5.6 51.2 40-31.2zM651.2Line truncated
|
|
||||||
|
Before Width: | Height: | Size: 6.8 KiB |
+10
-3
@@ -4,7 +4,7 @@ import config from './config';
|
|||||||
import { history } from '@umijs/max';
|
import { history } from '@umijs/max';
|
||||||
|
|
||||||
message.config({
|
message.config({
|
||||||
duration: 1.5,
|
duration: 2,
|
||||||
});
|
});
|
||||||
|
|
||||||
const time = Date.now();
|
const time = Date.now();
|
||||||
@@ -23,7 +23,10 @@ const errorHandler = function (error: any) {
|
|||||||
history.push('/login');
|
history.push('/login');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
message.error(msg);
|
message.error({
|
||||||
|
content: msg,
|
||||||
|
style: { maxWidth: 500, margin: '0 auto' },
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(error.message);
|
console.log(error.message);
|
||||||
@@ -66,7 +69,11 @@ _request.interceptors.response.use(async (response) => {
|
|||||||
const res = await response.clone().json();
|
const res = await response.clone().json();
|
||||||
if (res.code !== 200) {
|
if (res.code !== 200) {
|
||||||
const msg = res.message || res.data;
|
const msg = res.message || res.data;
|
||||||
msg && message.error(msg);
|
msg &&
|
||||||
|
message.error({
|
||||||
|
content: msg,
|
||||||
|
style: { maxWidth: 500, margin: '0 auto' },
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user