🆕 #1685 小程序增加图像处理相关接口

This commit is contained in:
Binary Wang
2020-08-08 17:14:09 +08:00
parent 542b633c70
commit 14dfe30bf6
12 changed files with 287 additions and 114 deletions

View File

@ -1,121 +0,0 @@
package me.chanjar.weixin.mp.api;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.bean.imgproc.WxMpImgProcAiCropResult;
import me.chanjar.weixin.mp.bean.imgproc.WxMpImgProcQrCodeResult;
import me.chanjar.weixin.mp.bean.imgproc.WxMpImgProcSuperResolutionResult;
import java.io.File;
/**
* 多项图像处理能力相关的API.
* https://developers.weixin.qq.com/doc/offiaccount/Intelligent_Interface/Img_Proc.html
*
* @author Theo Nie
*/
public interface WxMpImgProcService {
/**
* 二维码/条码识别接口
* 说明:
* 1.图片支持使用img参数实时上传也支持使用img_url参数传送图片地址由微信后台下载图片进行识别
* 2.文件大小限制小于2M
* 3.支持条码、二维码、DataMatrix和PDF417的识别。
* 4.二维码、DataMatrix会返回位置坐标条码和PDF417暂不返回位置坐标。
*
* @param imgUrl 图片url地址
* @return WxMpImgProcQrCodeResult
* @throws WxErrorException .
*/
WxMpImgProcQrCodeResult qrCode(String imgUrl) throws WxErrorException;
/**
* 二维码/条码识别接口
* 说明:
* 1.图片支持使用img参数实时上传也支持使用img_url参数传送图片地址由微信后台下载图片进行识别
* 2.文件大小限制小于2M
* 3.支持条码、二维码、DataMatrix和PDF417的识别。
* 4.二维码、DataMatrix会返回位置坐标条码和PDF417暂不返回位置坐标。
*
* @param imgFile 图片文件对象
* @return WxMpImgProcQrCodeResult
* @throws WxErrorException .
*/
WxMpImgProcQrCodeResult qrCode(File imgFile) throws WxErrorException;
/**
* 图片高清化接口
* 说明:
* 1.图片支持使用img参数实时上传也支持使用img_url参数传送图片地址由微信后台下载图片进行识别
* 2.文件大小限制小于2M
* 3.目前支持将图片超分辨率高清化2倍即生成图片分辨率为原图2倍大小
* 返回的media_id有效期为3天期间可以通过“获取临时素材”接口获取图片二进制
*
* @param imgUrl 图片url地址
* @return WxMpImgProcSuperResolutionResult
* @throws WxErrorException .
*/
WxMpImgProcSuperResolutionResult superResolution(String imgUrl) throws WxErrorException;
/**
* 图片高清化接口
* 说明:
* 1.图片支持使用img参数实时上传也支持使用img_url参数传送图片地址由微信后台下载图片进行识别
* 2.文件大小限制小于2M
* 3.目前支持将图片超分辨率高清化2倍即生成图片分辨率为原图2倍大小
* 返回的media_id有效期为3天期间可以通过“获取临时素材”接口获取图片二进制
*
* @param imgFile 图片文件对象
* @return WxMpImgProcSuperResolutionResult
* @throws WxErrorException .
*/
WxMpImgProcSuperResolutionResult superResolution(File imgFile) throws WxErrorException;
/**
* 图片智能裁剪接口
* 说明:
* 1.图片支持使用img参数实时上传也支持使用img_url参数传送图片地址由微信后台下载图片进行识别
* 2.文件大小限制小于2M
* 3.该接口默认使用最佳宽高比
* @param imgUrl 图片url地址
* @return WxMpImgProcAiCropResult
* @throws WxErrorException .
*/
WxMpImgProcAiCropResult aiCrop(String imgUrl) throws WxErrorException;
/**
* 图片智能裁剪接口
* 说明:
* 1.图片支持使用img参数实时上传也支持使用img_url参数传送图片地址由微信后台下载图片进行识别
* 2.文件大小限制小于2M
* @param imgUrl 图片url地址
* @param ratios 宽高比最多支持5个请以英文逗号分隔
* @return WxMpImgProcAiCropResult
* @throws WxErrorException .
*/
WxMpImgProcAiCropResult aiCrop(String imgUrl, String ratios) throws WxErrorException;
/**
* 图片智能裁剪接口
* 说明:
* 1.图片支持使用img参数实时上传也支持使用img_url参数传送图片地址由微信后台下载图片进行识别
* 2.文件大小限制小于2M
* 3.该接口默认使用最佳宽高比
* @param imgFile 图片文件对象
* @return WxMpImgProcAiCropResult
* @throws WxErrorException .
*/
WxMpImgProcAiCropResult aiCrop(File imgFile) throws WxErrorException;
/**
* 图片智能裁剪接口
* 说明:
* 1.图片支持使用img参数实时上传也支持使用img_url参数传送图片地址由微信后台下载图片进行识别
* 2.文件大小限制小于2M
* @param imgFile 图片文件对象
* @param ratios 宽高比最多支持5个请以英文逗号分隔
* @return WxMpImgProcAiCropResult
* @throws WxErrorException .
*/
WxMpImgProcAiCropResult aiCrop(File imgFile, String ratios) throws WxErrorException;
}

View File

@ -1,5 +1,6 @@
package me.chanjar.weixin.mp.api;
import me.chanjar.weixin.common.api.WxImgProcService;
import me.chanjar.weixin.common.api.WxOcrService;
import me.chanjar.weixin.common.bean.WxJsapiSignature;
import me.chanjar.weixin.common.bean.WxNetCheckResult;
@ -561,9 +562,9 @@ public interface WxMpService extends WxService {
/**
* 返回图像处理接口的实现类对象,以方便调用其各个接口.
*
* @return WxMpImgProcService
* @return WxImgProcService
*/
WxMpImgProcService getImgProcService();
WxImgProcService getImgProcService();
/**
* .
@ -696,7 +697,7 @@ public interface WxMpService extends WxService {
*
* @param imgProcService .
*/
void setImgProcService(WxMpImgProcService imgProcService);
void setImgProcService(WxImgProcService imgProcService);
/**
* 返回评论数据管理接口方法的实现类对象,以方便调用其各个接口.

View File

@ -7,6 +7,7 @@ import com.google.gson.JsonObject;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.api.WxImgProcService;
import me.chanjar.weixin.common.enums.WxType;
import me.chanjar.weixin.common.api.WxOcrService;
import me.chanjar.weixin.common.bean.WxAccessToken;
@ -71,7 +72,7 @@ public abstract class BaseWxMpServiceImpl<H, P> implements WxMpService, RequestH
private WxMpMarketingService marketingService = new WxMpMarketingServiceImpl(this);
private WxMpCommentService commentService = new WxMpCommentServiceImpl(this);
private WxOcrService ocrService = new WxMpOcrServiceImpl(this);
private WxMpImgProcService imgProcService = new WxMpImgProcServiceImpl(this);
private WxImgProcService imgProcService = new WxMpImgProcServiceImpl(this);
@Getter
@Setter
@ -696,12 +697,12 @@ public abstract class BaseWxMpServiceImpl<H, P> implements WxMpService, RequestH
}
@Override
public WxMpImgProcService getImgProcService() {
public WxImgProcService getImgProcService() {
return this.imgProcService;
}
@Override
public void setImgProcService(WxMpImgProcService imgProcService) {
public void setImgProcService(WxImgProcService imgProcService) {
this.imgProcService = imgProcService;
}
}

View File

@ -2,11 +2,11 @@ package me.chanjar.weixin.mp.api.impl;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpImgProcService;
import me.chanjar.weixin.common.api.WxImgProcService;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.imgproc.WxMpImgProcAiCropResult;
import me.chanjar.weixin.mp.bean.imgproc.WxMpImgProcQrCodeResult;
import me.chanjar.weixin.mp.bean.imgproc.WxMpImgProcSuperResolutionResult;
import me.chanjar.weixin.common.bean.imgproc.WxImgProcAiCropResult;
import me.chanjar.weixin.common.bean.imgproc.WxImgProcQrCodeResult;
import me.chanjar.weixin.common.bean.imgproc.WxImgProcSuperResolutionResult;
import me.chanjar.weixin.common.requestexecuter.ocr.OcrDiscernRequestExecutor;
import org.apache.commons.lang3.StringUtils;
@ -27,29 +27,31 @@ import static me.chanjar.weixin.mp.enums.WxMpApiUrl.ImgProc.SUPER_RESOLUTION;
* @author Theo Nie
*/
@RequiredArgsConstructor
public class WxMpImgProcServiceImpl implements WxMpImgProcService {
public class WxMpImgProcServiceImpl implements WxImgProcService {
private final WxMpService wxMpService;
@Override
public WxMpImgProcQrCodeResult qrCode(String imgUrl) throws WxErrorException {
public WxImgProcQrCodeResult qrCode(String imgUrl) throws WxErrorException {
try {
imgUrl = URLEncoder.encode(imgUrl, StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
//ignore
}
final String result = this.wxMpService.get(String.format(QRCODE.getUrl(this.wxMpService.getWxMpConfigStorage()), imgUrl), null);
return WxMpImgProcQrCodeResult.fromJson(result);
String result = this.wxMpService.get(String.format(QRCODE.getUrl(this.wxMpService.getWxMpConfigStorage()), imgUrl),
null);
return WxImgProcQrCodeResult.fromJson(result);
}
@Override
public WxMpImgProcQrCodeResult qrCode(File imgFile) throws WxErrorException {
String result = this.wxMpService.execute(OcrDiscernRequestExecutor.create(this.wxMpService.getRequestHttp()), FILE_QRCODE.getUrl(this.wxMpService.getWxMpConfigStorage()), imgFile);
return WxMpImgProcQrCodeResult.fromJson(result);
public WxImgProcQrCodeResult qrCode(File imgFile) throws WxErrorException {
String result = this.wxMpService.execute(OcrDiscernRequestExecutor.create(this.wxMpService.getRequestHttp()),
FILE_QRCODE.getUrl(this.wxMpService.getWxMpConfigStorage()), imgFile);
return WxImgProcQrCodeResult.fromJson(result);
}
@Override
public WxMpImgProcSuperResolutionResult superResolution(String imgUrl) throws WxErrorException {
public WxImgProcSuperResolutionResult superResolution(String imgUrl) throws WxErrorException {
try {
imgUrl = URLEncoder.encode(imgUrl, StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
@ -57,22 +59,23 @@ public class WxMpImgProcServiceImpl implements WxMpImgProcService {
}
final String result = this.wxMpService.get(String.format(SUPER_RESOLUTION.getUrl(this.wxMpService.getWxMpConfigStorage()), imgUrl), null);
return WxMpImgProcSuperResolutionResult.fromJson(result);
return WxImgProcSuperResolutionResult.fromJson(result);
}
@Override
public WxMpImgProcSuperResolutionResult superResolution(File imgFile) throws WxErrorException {
String result = this.wxMpService.execute(OcrDiscernRequestExecutor.create(this.wxMpService.getRequestHttp()), FILE_SUPER_RESOLUTION.getUrl(this.wxMpService.getWxMpConfigStorage()), imgFile);
return WxMpImgProcSuperResolutionResult.fromJson(result);
public WxImgProcSuperResolutionResult superResolution(File imgFile) throws WxErrorException {
String result = this.wxMpService.execute(OcrDiscernRequestExecutor.create(this.wxMpService.getRequestHttp()),
FILE_SUPER_RESOLUTION.getUrl(this.wxMpService.getWxMpConfigStorage()), imgFile);
return WxImgProcSuperResolutionResult.fromJson(result);
}
@Override
public WxMpImgProcAiCropResult aiCrop(String imgUrl) throws WxErrorException {
public WxImgProcAiCropResult aiCrop(String imgUrl) throws WxErrorException {
return this.aiCrop(imgUrl, "");
}
@Override
public WxMpImgProcAiCropResult aiCrop(String imgUrl, String ratios) throws WxErrorException {
public WxImgProcAiCropResult aiCrop(String imgUrl, String ratios) throws WxErrorException {
try {
imgUrl = URLEncoder.encode(imgUrl, StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
@ -83,22 +86,24 @@ public class WxMpImgProcServiceImpl implements WxMpImgProcService {
ratios = "";
}
final String result = this.wxMpService.get(String.format(AI_CROP.getUrl(this.wxMpService.getWxMpConfigStorage()), imgUrl, ratios), null);
return WxMpImgProcAiCropResult.fromJson(result);
final String result = this.wxMpService.get(String.format(AI_CROP.getUrl(this.wxMpService.getWxMpConfigStorage()),
imgUrl, ratios), null);
return WxImgProcAiCropResult.fromJson(result);
}
@Override
public WxMpImgProcAiCropResult aiCrop(File imgFile) throws WxErrorException {
public WxImgProcAiCropResult aiCrop(File imgFile) throws WxErrorException {
return this.aiCrop(imgFile, "");
}
@Override
public WxMpImgProcAiCropResult aiCrop(File imgFile, String ratios) throws WxErrorException {
public WxImgProcAiCropResult aiCrop(File imgFile, String ratios) throws WxErrorException {
if (StringUtils.isEmpty(ratios)) {
ratios = "";
}
String result = this.wxMpService.execute(OcrDiscernRequestExecutor.create(this.wxMpService.getRequestHttp()), String.format(FILE_AI_CROP.getUrl(this.wxMpService.getWxMpConfigStorage()), ratios), imgFile);
return WxMpImgProcAiCropResult.fromJson(result);
String result = this.wxMpService.execute(OcrDiscernRequestExecutor.create(this.wxMpService.getRequestHttp()),
String.format(FILE_AI_CROP.getUrl(this.wxMpService.getWxMpConfigStorage()), ratios), imgFile);
return WxImgProcAiCropResult.fromJson(result);
}
}

View File

@ -1,60 +0,0 @@
package me.chanjar.weixin.mp.bean.imgproc;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
import java.io.Serializable;
import java.util.List;
/**
* @author Theo Nie
*/
@Data
public class WxMpImgProcAiCropResult implements Serializable {
private static final long serialVersionUID = -6470673963772979463L;
@SerializedName("img_size")
private ImgSize imgSize;
@SerializedName("results")
private List<Results> results;
@Override
public String toString() {
return WxMpGsonBuilder.create().toJson(this);
}
public static WxMpImgProcAiCropResult fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpImgProcAiCropResult.class);
}
@Data
public static class ImgSize {
@SerializedName("w")
private int w;
@SerializedName("h")
private int h;
@Override
public String toString() {
return WxMpGsonBuilder.create().toJson(this);
}
}
@Data
public static class Results {
@SerializedName("crop_left")
private int cropLeft;
@SerializedName("crop_top")
private int cropTop;
@SerializedName("crop_right")
private int cropRight;
@SerializedName("crop_bottom")
private int cropBottom;
@Override
public String toString() {
return WxMpGsonBuilder.create().toJson(this);
}
}
}

View File

@ -1,93 +0,0 @@
package me.chanjar.weixin.mp.bean.imgproc;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
import java.io.Serializable;
import java.util.List;
/**
* 二维码/条码识别返回结果
* @author Theo Nie
*/
@Data
public class WxMpImgProcQrCodeResult implements Serializable {
private static final long serialVersionUID = -1194154790100866123L;
@SerializedName("img_size")
private ImgSize imgSize;
@SerializedName("code_results")
private List<CodeResults> codeResults;
@Data
public static class ImgSize implements Serializable{
private static final long serialVersionUID = -8847603245514017839L;
@SerializedName("w")
private int w;
@SerializedName("h")
private int h;
@Override
public String toString() {
return WxMpGsonBuilder.create().toJson(this);
}
}
@Data
public static class CodeResults implements Serializable{
private static final long serialVersionUID = -6138135951229076759L;
@SerializedName("type_name")
private String typeName;
@SerializedName("data")
private String data;
@SerializedName("pos")
private Pos pos;
@Override
public String toString() {
return WxMpGsonBuilder.create().toJson(this);
}
@Data
public static class Pos implements Serializable{
private static final long serialVersionUID = 7754894061212819602L;
@SerializedName("left_top")
private Coordinate leftTop;
@SerializedName("right_top")
private Coordinate rightTop;
@SerializedName("right_bottom")
private Coordinate rightBottom;
@SerializedName("left_bottom")
private Coordinate leftBottom;
@Override
public String toString() {
return WxMpGsonBuilder.create().toJson(this);
}
@Data
public static class Coordinate implements Serializable{
private static final long serialVersionUID = 8930443668927359677L;
@SerializedName("x")
private int x;
@SerializedName("y")
private int y;
@Override
public String toString() {
return WxMpGsonBuilder.create().toJson(this);
}
}
}
}
public static WxMpImgProcQrCodeResult fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpImgProcQrCodeResult.class);
}
@Override
public String toString() {
return WxMpGsonBuilder.create().toJson(this);
}
}

View File

@ -1,28 +0,0 @@
package me.chanjar.weixin.mp.bean.imgproc;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
import java.io.Serializable;
/**
* 图片高清化返回结果
* @author Theo Nie
*/
@Data
public class WxMpImgProcSuperResolutionResult implements Serializable {
private static final long serialVersionUID = 8007440280170407021L;
@SerializedName("media_id")
private String mediaId;
@Override
public String toString() {
return WxMpGsonBuilder.create().toJson(this);
}
public static WxMpImgProcSuperResolutionResult fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpImgProcSuperResolutionResult.class);
}
}

View File

@ -2,13 +2,13 @@ package me.chanjar.weixin.mp.api.impl;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.fs.FileUtils;
import me.chanjar.weixin.mp.api.WxMpImgProcService;
import me.chanjar.weixin.common.api.WxImgProcService;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.test.TestConstants;
import me.chanjar.weixin.mp.bean.imgproc.WxMpImgProcAiCropResult;
import me.chanjar.weixin.mp.bean.imgproc.WxMpImgProcQrCodeResult;
import me.chanjar.weixin.mp.bean.imgproc.WxMpImgProcSuperResolutionResult;
import me.chanjar.weixin.common.bean.imgproc.WxImgProcAiCropResult;
import me.chanjar.weixin.common.bean.imgproc.WxImgProcQrCodeResult;
import me.chanjar.weixin.common.bean.imgproc.WxImgProcSuperResolutionResult;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
@ -29,7 +29,7 @@ public class WxMpImgProcServiceImplTest {
@Test
public void testQrCode() throws WxErrorException {
final WxMpImgProcQrCodeResult result = this.mpService.getImgProcService().qrCode("https://gitee.com/binary/weixin-java-tools/raw/master/images/qrcodes/mp.png");
final WxImgProcQrCodeResult result = this.mpService.getImgProcService().qrCode("https://gitee.com/binary/weixin-java-tools/raw/master/images/qrcodes/mp.png");
assertThat(result).isNotNull();
System.out.println(result);
}
@ -38,14 +38,14 @@ public class WxMpImgProcServiceImplTest {
public void testQrCode2() throws Exception {
InputStream inputStream = ClassLoader.getSystemResourceAsStream("mm.jpeg");
File tempFile = FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), TestConstants.FILE_JPG);
final WxMpImgProcQrCodeResult result = this.mpService.getImgProcService().qrCode(tempFile);
final WxImgProcQrCodeResult result = this.mpService.getImgProcService().qrCode(tempFile);
assertThat(result).isNotNull();
System.out.println(result);
}
@Test
public void testSuperResolution() throws WxErrorException {
final WxMpImgProcSuperResolutionResult result = this.mpService.getImgProcService().superResolution("https://gitee.com/binary/weixin-java-tools/raw/master/images/qrcodes/mp.png");
final WxImgProcSuperResolutionResult result = this.mpService.getImgProcService().superResolution("https://gitee.com/binary/weixin-java-tools/raw/master/images/qrcodes/mp.png");
assertThat(result).isNotNull();
System.out.println(result);
}
@ -54,21 +54,21 @@ public class WxMpImgProcServiceImplTest {
public void testSuperResolution2() throws Exception {
InputStream inputStream = ClassLoader.getSystemResourceAsStream("mm.jpeg");
File tempFile = FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), TestConstants.FILE_JPG);
final WxMpImgProcSuperResolutionResult result = this.mpService.getImgProcService().superResolution(tempFile);
final WxImgProcSuperResolutionResult result = this.mpService.getImgProcService().superResolution(tempFile);
assertThat(result).isNotNull();
System.out.println(result);
}
@Test
public void testAiCrop() throws WxErrorException {
final WxMpImgProcAiCropResult result = this.mpService.getImgProcService().aiCrop("https://gitee.com/binary/weixin-java-tools/raw/master/images/qrcodes/mp.png");
final WxImgProcAiCropResult result = this.mpService.getImgProcService().aiCrop("https://gitee.com/binary/weixin-java-tools/raw/master/images/qrcodes/mp.png");
assertThat(result).isNotNull();
System.out.println(result);
}
@Test
public void testAiCrop2() throws WxErrorException {
final WxMpImgProcAiCropResult result = this.mpService.getImgProcService().aiCrop("https://gitee.com/binary/weixin-java-tools/raw/master/images/qrcodes/mp.png", "1,2.35");
final WxImgProcAiCropResult result = this.mpService.getImgProcService().aiCrop("https://gitee.com/binary/weixin-java-tools/raw/master/images/qrcodes/mp.png", "1,2.35");
assertThat(result).isNotNull();
System.out.println(result);
}
@ -77,7 +77,7 @@ public class WxMpImgProcServiceImplTest {
public void testAiCrop3() throws Exception {
InputStream inputStream = ClassLoader.getSystemResourceAsStream("mm.jpeg");
File tempFile = FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), TestConstants.FILE_JPG);
final WxMpImgProcAiCropResult result = this.mpService.getImgProcService().aiCrop(tempFile);
final WxImgProcAiCropResult result = this.mpService.getImgProcService().aiCrop(tempFile);
assertThat(result).isNotNull();
System.out.println(result);
}
@ -86,7 +86,7 @@ public class WxMpImgProcServiceImplTest {
public void testAiCrop4() throws Exception {
InputStream inputStream = ClassLoader.getSystemResourceAsStream("mm.jpeg");
File tempFile = FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), TestConstants.FILE_JPG);
final WxMpImgProcAiCropResult result = this.mpService.getImgProcService().aiCrop(tempFile, "1,2.35,3.5");
final WxImgProcAiCropResult result = this.mpService.getImgProcService().aiCrop(tempFile, "1,2.35,3.5");
assertThat(result).isNotNull();
System.out.println(result);
}
@ -159,8 +159,8 @@ public class WxMpImgProcServiceImplTest {
" }\n" +
"}";
when(wxService.get(anyString(), anyString())).thenReturn(returnJson);
final WxMpImgProcService wxMpImgProcService = new WxMpImgProcServiceImpl(wxService);
final WxMpImgProcQrCodeResult result = wxMpImgProcService.qrCode("abc");
final WxImgProcService wxMpImgProcService = new WxMpImgProcServiceImpl(wxService);
final WxImgProcQrCodeResult result = wxMpImgProcService.qrCode("abc");
assertThat(result).isNotNull();
System.out.println(result);
}
@ -173,8 +173,8 @@ public class WxMpImgProcServiceImplTest {
" \"media_id\": \"6WXsIXkG7lXuDLspD9xfm5dsvHzb0EFl0li6ySxi92ap8Vl3zZoD9DpOyNudeJGB\"\n" +
"}";
when(wxService.get(anyString(), anyString())).thenReturn(returnJson);
final WxMpImgProcService wxMpImgProcService = new WxMpImgProcServiceImpl(wxService);
final WxMpImgProcSuperResolutionResult result = wxMpImgProcService.superResolution("abc");
final WxImgProcService wxMpImgProcService = new WxMpImgProcServiceImpl(wxService);
final WxImgProcSuperResolutionResult result = wxMpImgProcService.superResolution("abc");
assertThat(result).isNotNull();
System.out.println(result);
}
@ -204,8 +204,8 @@ public class WxMpImgProcServiceImplTest {
" }\n" +
"}";
when(wxService.get(anyString(), anyString())).thenReturn(returnJson);
final WxMpImgProcService wxMpImgProcService = new WxMpImgProcServiceImpl(wxService);
final WxMpImgProcAiCropResult result = wxMpImgProcService.aiCrop("abc");
final WxImgProcService wxMpImgProcService = new WxMpImgProcServiceImpl(wxService);
final WxImgProcAiCropResult result = wxMpImgProcService.aiCrop("abc");
assertThat(result).isNotNull();
System.out.println(result);
}