소스 검색

1.文件上传 部分修改

dev
ldj 8 달 전
부모
커밋
f9f6db4b96
2개의 변경된 파일8개의 추가작업 그리고 7개의 파일을 삭제
  1. +6
    -6
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/aliexpress/AliexpressImageController.java
  2. +2
    -1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/aliexpress/dto/photobank/PhotoBankUploadImageDTO.java

+ 6
- 6
ruoyi-admin/src/main/java/com/ruoyi/web/controller/aliexpress/AliexpressImageController.java 파일 보기

@@ -117,7 +117,7 @@ public class AliexpressImageController {
IopClient client = new IopClientImpl(AliexpressAuthClientConfig.getUrl(), AliexpressAuthClientConfig.getAppKey(), AliexpressAuthClientConfig.getAppSecret());
IopRequest request = new IopRequest();
request.setApiName(AliexpressImageEnu.UPLOAD_IMAGE.getApiName());
request.addApiParameter("file_name", reqDto.getFile_name());
request.addApiParameter("file_name", reqDto.getSrc_file_name());
request.addApiParameter("group_id", reqDto.getGroup_id());
try {
request.addFileParameter("image_bytes", new FileItem(file.getOriginalFilename(), file.getInputStream(), file.getContentType()));
@@ -145,16 +145,16 @@ public class AliexpressImageController {
@Log(title = "上传图片到图片银行(推荐使用)", businessType = BusinessType.SELECT)
@ApiOperation("上传图片到图片银行(推荐使用)")
@PostMapping("/uploadImageForSdk")
public String uploadImageForSdk(@RequestParam("file") MultipartFile file, @RequestBody PhotoBankUploadImageDTO reqDto) throws ApiException {
public String uploadImageForSdk(@RequestBody PhotoBankUploadImageDTO reqDto) throws ApiException {
IopClient client = new IopClientImpl(AliexpressAuthClientConfig.getUrl(), AliexpressAuthClientConfig.getAppKey(), AliexpressAuthClientConfig.getAppSecret());
IopRequest request = new IopRequest();
request.setApiName(AliexpressImageEnu.UPLOAD_IMAGE_FOR_SDK.getApiName());
request.addApiParameter("file_name", reqDto.getFile_name());
request.addApiParameter("file_name", reqDto.getSrc_file_name());
request.addApiParameter("group_id", reqDto.getGroup_id());
try {
request.addFileParameter("image_bytes", new FileItem(file.getOriginalFilename(), file.getInputStream(), file.getContentType()));
} catch (IOException e) {
return "文件上传失败,IO异常!";
request.addFileParameter("image_bytes", new FileItem(reqDto.getSrc_file_name(),reqDto.getFile_data()));
} catch (Exception e) {
return "文件上传失败!";
}
IopResponse response = client.execute(request, reqDto.getAccessToken(), Protocol.TOP);
return response.getGopResponseBody();


+ 2
- 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/aliexpress/dto/photobank/PhotoBankUploadImageDTO.java 파일 보기

@@ -13,8 +13,9 @@ import lombok.Setter;
@Getter
@Setter
public class PhotoBankUploadImageDTO extends AliexpressAuth {
private byte[] file_data;
//request.addApiParameter("file_name", "0");
private String file_name;
private String src_file_name;
//request.addApiParameter("group_id", "0");
private String group_id;
}

불러오는 중...
취소
저장