增加外网连通测试

This commit is contained in:
砂糖
2025-08-04 11:30:43 +08:00
parent b8a0792b5d
commit e8f7e5505b
2 changed files with 26 additions and 4 deletions

View File

@@ -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)
})
})
}