fix(brand): 品牌检测源文件改走 OSS URL(服务端化跨节点组装可用)

前端上传桥与降级桥透传 uploadOss;品牌页提交时 fileUrl 优先取上传响应的 OSS url,localPath 仅作旧桌面桥兜底。
This commit is contained in:
2026-09-08 15:19:21 +08:00
parent 630bfc3eee
commit ba581ed095
3 changed files with 11 additions and 5 deletions
@@ -93,6 +93,7 @@ export interface PywebviewApi {
upload_file_to_java?: (
filePath: string,
relativePath?: string,
uploadOss?: boolean,
) => Promise<{
success: boolean;
message?: string;
@@ -125,8 +125,8 @@ export const webFallbackApi: PywebviewApi = {
return registerWebFiles(files)
},
/** 虚拟路径 → 浏览器 File → 上传 Java 临时目录;返回结构与桌面桥一致(透传 Java ApiResponse<UploadFileVo> */
async upload_file_to_java(filePath, relativePath) {
/** 虚拟路径 → 浏览器 File → 上传 JavauploadOss=true 时同时上传公开 OSS(品牌检测等服务端化工具用 */
async upload_file_to_java(filePath, relativePath, uploadOss) {
const file = typeof filePath === 'string' ? webFileMap.get(filePath) : undefined
if (!file) {
return { success: false, error: '文件不存在,请重新选择' }
@@ -136,6 +136,10 @@ export const webFallbackApi: PywebviewApi = {
if (relativePath) {
form.append('relativePath', relativePath)
}
if (uploadOss) {
form.append('uploadToOss', 'true')
form.append('moduleType', 'BRAND')
}
try {
// http 实例对 /newApi 前缀自动附带 BearerFormData 的 Content-Type 交由浏览器自动生成(含 boundary)
const response = await http.post('/newApi/api/files/upload', form, { timeout: 120000 })