mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🆕 #1942 【小程序】增加生成小程序码的okhttp实现
This commit is contained in:
@@ -7,7 +7,6 @@ import cn.binarywang.wx.miniapp.bean.WxMaQrcode;
|
||||
import cn.binarywang.wx.miniapp.bean.WxaCode;
|
||||
import cn.binarywang.wx.miniapp.bean.WxaCodeUnlimit;
|
||||
import cn.binarywang.wx.miniapp.executor.QrcodeBytesRequestExecutor;
|
||||
import cn.binarywang.wx.miniapp.executor.QrcodeFileRequestExecutor;
|
||||
import cn.binarywang.wx.miniapp.executor.QrcodeRequestExecutor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
@@ -23,14 +22,12 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
|
||||
|
||||
@Override
|
||||
public byte[] createQrcodeBytes(String path, int width) throws WxErrorException {
|
||||
final QrcodeBytesRequestExecutor executor = new QrcodeBytesRequestExecutor(this.wxMaService.getRequestHttp());
|
||||
return this.wxMaService.execute(executor, CREATE_QRCODE_URL, new WxMaQrcode(path, width));
|
||||
return this.wxMaService.execute(QrcodeBytesRequestExecutor.create(this.wxMaService.getRequestHttp()), CREATE_QRCODE_URL, new WxMaQrcode(path, width));
|
||||
}
|
||||
|
||||
@Override
|
||||
public File createQrcode(String path, int width) throws WxErrorException {
|
||||
final QrcodeRequestExecutor executor = new QrcodeRequestExecutor(this.wxMaService.getRequestHttp());
|
||||
return this.wxMaService.execute(executor, CREATE_QRCODE_URL, new WxMaQrcode(path, width));
|
||||
return this.wxMaService.execute(QrcodeRequestExecutor.create(this.wxMaService.getRequestHttp()), CREATE_QRCODE_URL, new WxMaQrcode(path, width));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,8 +38,7 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
|
||||
@Override
|
||||
public byte[] createWxaCodeBytes(String path, int width, boolean autoColor, WxMaCodeLineColor lineColor, boolean isHyaline)
|
||||
throws WxErrorException {
|
||||
final QrcodeBytesRequestExecutor executor = new QrcodeBytesRequestExecutor(this.wxMaService.getRequestHttp());
|
||||
return this.wxMaService.execute(executor, GET_WXACODE_URL, WxaCode.builder()
|
||||
return this.wxMaService.execute(QrcodeBytesRequestExecutor.create(this.wxMaService.getRequestHttp()), GET_WXACODE_URL, WxaCode.builder()
|
||||
.path(path)
|
||||
.width(width)
|
||||
.autoColor(autoColor)
|
||||
@@ -54,8 +50,7 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
|
||||
@Override
|
||||
public File createWxaCode(String path, int width, boolean autoColor, WxMaCodeLineColor lineColor, boolean isHyaline)
|
||||
throws WxErrorException {
|
||||
final QrcodeRequestExecutor executor = new QrcodeRequestExecutor(this.wxMaService.getRequestHttp());
|
||||
return this.wxMaService.execute(executor, GET_WXACODE_URL, WxaCode.builder()
|
||||
return this.wxMaService.execute(QrcodeRequestExecutor.create(this.wxMaService.getRequestHttp()), GET_WXACODE_URL, WxaCode.builder()
|
||||
.path(path)
|
||||
.width(width)
|
||||
.autoColor(autoColor)
|
||||
@@ -77,7 +72,7 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
|
||||
@Override
|
||||
public byte[] createWxaCodeUnlimitBytes(String scene, String page, int width, boolean autoColor,
|
||||
WxMaCodeLineColor lineColor, boolean isHyaline) throws WxErrorException {
|
||||
return this.wxMaService.execute(new QrcodeBytesRequestExecutor(this.wxMaService.getRequestHttp()),
|
||||
return this.wxMaService.execute(QrcodeBytesRequestExecutor.create(this.wxMaService.getRequestHttp()),
|
||||
GET_WXACODE_UNLIMIT_URL,
|
||||
this.buildWxaCodeUnlimit(scene, page, width, autoColor, lineColor, isHyaline));
|
||||
}
|
||||
@@ -85,7 +80,7 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
|
||||
@Override
|
||||
public File createWxaCodeUnlimit(String scene, String page, int width, boolean autoColor,
|
||||
WxMaCodeLineColor lineColor, boolean isHyaline) throws WxErrorException {
|
||||
return this.wxMaService.execute(new QrcodeRequestExecutor(this.wxMaService.getRequestHttp()),
|
||||
return this.wxMaService.execute(QrcodeRequestExecutor.create(this.wxMaService.getRequestHttp()),
|
||||
GET_WXACODE_UNLIMIT_URL,
|
||||
this.buildWxaCodeUnlimit(scene, page, width, autoColor, lineColor, isHyaline));
|
||||
}
|
||||
@@ -110,8 +105,7 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
|
||||
|
||||
@Override
|
||||
public File createQrcode(String path, int width, String filePath) throws WxErrorException {
|
||||
final QrcodeFileRequestExecutor executor = new QrcodeFileRequestExecutor(this.wxMaService.getRequestHttp(), filePath);
|
||||
return this.wxMaService.execute(executor, CREATE_QRCODE_URL, new WxMaQrcode(path, width));
|
||||
return this.wxMaService.execute(QrcodeRequestExecutor.create(this.wxMaService.getRequestHttp(), filePath), CREATE_QRCODE_URL, new WxMaQrcode(path, width));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,8 +116,7 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
|
||||
@Override
|
||||
public File createWxaCode(String path, int width, String filePath, boolean autoColor, WxMaCodeLineColor lineColor, boolean isHyaline)
|
||||
throws WxErrorException {
|
||||
final QrcodeFileRequestExecutor executor = new QrcodeFileRequestExecutor(this.wxMaService.getRequestHttp(), filePath);
|
||||
return this.wxMaService.execute(executor, GET_WXACODE_URL, WxaCode.builder()
|
||||
return this.wxMaService.execute(QrcodeRequestExecutor.create(this.wxMaService.getRequestHttp(), filePath), GET_WXACODE_URL, WxaCode.builder()
|
||||
.path(path)
|
||||
.width(width)
|
||||
.autoColor(autoColor)
|
||||
@@ -145,7 +138,7 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
|
||||
@Override
|
||||
public File createWxaCodeUnlimit(String scene, String page, String filePath, int width, boolean autoColor,
|
||||
WxMaCodeLineColor lineColor, boolean isHyaline) throws WxErrorException {
|
||||
return this.wxMaService.execute(new QrcodeFileRequestExecutor(this.wxMaService.getRequestHttp(), filePath),
|
||||
return this.wxMaService.execute(QrcodeRequestExecutor.create(this.wxMaService.getRequestHttp(), filePath),
|
||||
GET_WXACODE_UNLIMIT_URL,
|
||||
this.buildWxaCodeUnlimit(scene, page, width, autoColor, lineColor, isHyaline));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user