增加外网连通测试
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import request from '@/utils/request'
|
||||
import axios from 'axios'
|
||||
|
||||
/**
|
||||
* 调用ocr, 直接识别图像中的文字
|
||||
@@ -41,4 +42,18 @@ export function recognizePdfText({ pdfUrl }) {
|
||||
method: 'post',
|
||||
data: { pdfUrl },
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试外网连接
|
||||
*/
|
||||
export function testNet() {
|
||||
// ping一下百度
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get('https://api.thecatapi.com/v1/images/search?limit=1').then(res => {
|
||||
resolve(true)
|
||||
}).catch(err => {
|
||||
resolve(false)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user