|
|
@@ -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(); |
|
|
|