| | |
| | | try { |
| | | // 从URL下载文件 |
| | | byte[] fileBytes = downloadFromUrl(fileUrl); |
| | | if (fileBytes == null || fileBytes.length == 0) { |
| | | if (fileBytes.length == 0) { |
| | | return FileUploadResponse.error("从URL下载文件失败"); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | try { |
| | | log.info("开始解析PHP响应: {}", response); |
| | | // log.info("开始解析PHP响应: {}", response); |
| | | |
| | | // 根据PHP接口的实际返回格式进行解析 |
| | | // PHP返回格式: {"success": true, "message": "文件上传成功", "data": {...}} |
| | |
| | | String filePath = extractFilePathFromResponse(response); |
| | | String thumbnailPath = extractThumbnailPathFromResponse(response); |
| | | |
| | | log.info("解析结果 - filePath: {}, thumbnailPath: {}", filePath, thumbnailPath); |
| | | // log.info("解析结果 - filePath: {}, thumbnailPath: {}", filePath, thumbnailPath); |
| | | |
| | | // 创建响应对象 |
| | | FileUploadResponse uploadResponse = FileUploadResponse.success(filePath, "上传成功"); |
| | |
| | | return uploadResponse; |
| | | } |
| | | |
| | | log.info("上传文件成功 文件:{} 缩略:{}",uploadResponse.getFilePath(),uploadResponse.getThumbnailPath()); |
| | | // log.info("上传文件成功 文件:{} 缩略:{}",uploadResponse.getFilePath(),uploadResponse.getThumbnailPath()); |
| | | return uploadResponse; |
| | | |
| | | } catch (Exception e) { |