Merge branch 'release/test' of http://8.163.30.128:10082/html/pda-overseas-uniapp into release/test

This commit is contained in:
2026-09-17 13:36:11 +08:00
8 changed files with 46 additions and 11 deletions
+6 -1
View File
@@ -162,7 +162,8 @@ export async function overseasUpload(path, filePath, name = 'file', retry = true
return body.data
}
export async function overseasDownload(path, retry = true) {
export async function overseasDownload(path, options = {}) {
const { retry = true, expectedContentTypePrefix = '' } = options
const attemptedToken = session.token
let response = await rawDownload(path, attemptedToken)
if (retry && unauthorized(response)) {
@@ -172,6 +173,10 @@ export async function overseasDownload(path, retry = true) {
if (response?.statusCode !== 200 || !response?.tempFilePath) {
throw errorFrom({ ...response, data: {} }, '签收照片下载失败')
}
const contentType = String(response?.header?.['content-type'] || response?.header?.['Content-Type'] || '').toLowerCase()
if (expectedContentTypePrefix && !contentType.startsWith(expectedContentTypePrefix.toLowerCase())) {
throw errorFrom({ ...response, data: {} }, '照片服务返回了无效内容,请稍后重试')
}
return response.tempFilePath
}