|
@@ -28,8 +28,9 @@ public class MediaController {
|
|
|
|
|
|
@SneakyThrows
|
|
|
@RequestMapping("/upload/url")
|
|
|
- public WxMediaUploadResult uploadByUrl(String url, Integer appId) {
|
|
|
- DownloadResponse execute = SimpleDownloadRequestExecutor.create(WxCpConfiguration.getCpService(appId).getRequestHttp()).execute("https://s3.cn-north-1.amazonaws.com.cn/s3-000045-cfglpic/fc61e4cc-41bb-40cd-8031-0e97e4d09924_%7BA2F6210E-02AD-4DA6-83B4-85CD78EAA24E%7D.png", null);
|
|
|
+ public WxMediaUploadResult uploadByUrl(Integer appId) {
|
|
|
+ String url = "https://s3.cn-north-1.amazonaws.com.cn/s3-000045-cfglpic/fc61e4cc-41bb-40cd-8031-0e97e4d09924_%7BA2F6210E-02AD-4DA6-83B4-85CD78EAA24E%7D.png";
|
|
|
+ DownloadResponse execute = SimpleDownloadRequestExecutor.create(WxCpConfiguration.getCpService(appId).getRequestHttp()).execute(url, null);
|
|
|
ByteArrayOutputStream byteArrayOutputStream = (ByteArrayOutputStream) execute.getOutputStream();
|
|
|
UploadRequest request = UploadRequest.builder().inputStream(new ByteArrayInputStream(byteArrayOutputStream.toByteArray())).fileName("test").build();
|
|
|
return WxCpConfiguration.getCpService(appId).getMediaService().upload(WxConsts.MediaFileType.IMAGE, request);
|