Skip to content

Commit 329847e

Browse files
committed
修复小程序码的相关方法命名:WxCode->WxaCode, WxCodeLimit -> WxaCodeUnlimit
1 parent 9558378 commit 329847e

File tree

4 files changed

+40
-40
lines changed

4 files changed

+40
-40
lines changed

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaQrcodeService.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package cn.binarywang.wx.miniapp.api;
22

3+
import java.io.File;
4+
35
import cn.binarywang.wx.miniapp.bean.WxMaCodeLineColor;
46
import me.chanjar.weixin.common.exception.WxErrorException;
57

6-
import java.io.File;
7-
88
/**
99
* <pre>
1010
* 二维码相关操作接口.
1111
*
12-
* 接口A(createWxCode)加上接口C(createQrcode),总共生成的码数量限制为100,000,请谨慎调用。
12+
* 接口A(createWxaCode)加上接口C(createQrcode),总共生成的码数量限制为100,000,请谨慎调用。
1313
*
1414
* 文档地址:https://mp.weixin.qq.com/debug/wxadoc/dev/api/qrcode.html
1515
* </pre>
@@ -45,11 +45,11 @@ public interface WxMaQrcodeService {
4545
* @param autoColor 默认true 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调
4646
* @param lineColor auth_color 为 false 时生效,使用 rgb 设置颜色 例如 {"r":"xxx","g":"xxx","b":"xxx"}
4747
*/
48-
File createWxCode(String path, int width, boolean autoColor, WxMaCodeLineColor lineColor) throws WxErrorException;
48+
File createWxaCode(String path, int width, boolean autoColor, WxMaCodeLineColor lineColor) throws WxErrorException;
4949

50-
File createWxCode(String path, int width) throws WxErrorException;
50+
File createWxaCode(String path, int width) throws WxErrorException;
5151

52-
File createWxCode(String path) throws WxErrorException;
52+
File createWxaCode(String path) throws WxErrorException;
5353

5454
/**
5555
* 接口B: 获取小程序码(永久有效、数量暂无限制).
@@ -65,8 +65,8 @@ public interface WxMaQrcodeService {
6565
* @param autoColor 默认true 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调
6666
* @param lineColor auth_color 为 false 时生效,使用 rgb 设置颜色 例如 {"r":"xxx","g":"xxx","b":"xxx"}
6767
*/
68-
File createWxCodeLimit(String scene, String page, int width, boolean autoColor, WxMaCodeLineColor lineColor) throws WxErrorException;
68+
File createWxaCodeUnlimit(String scene, String page, int width, boolean autoColor, WxMaCodeLineColor lineColor) throws WxErrorException;
6969

70-
File createWxCodeLimit(String scene, String page) throws WxErrorException;
70+
File createWxaCodeUnlimit(String scene, String page) throws WxErrorException;
7171

7272
}
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
package cn.binarywang.wx.miniapp.api.impl;
22

3+
import java.io.File;
4+
35
import cn.binarywang.wx.miniapp.api.WxMaQrcodeService;
46
import cn.binarywang.wx.miniapp.api.WxMaService;
57
import cn.binarywang.wx.miniapp.bean.WxMaCodeLineColor;
68
import cn.binarywang.wx.miniapp.bean.WxMaQrcode;
79
import cn.binarywang.wx.miniapp.bean.WxMaWxcode;
8-
import cn.binarywang.wx.miniapp.bean.WxMaWxcodeLimit;
10+
import cn.binarywang.wx.miniapp.bean.WxaCodeUnlimit;
911
import cn.binarywang.wx.miniapp.util.http.QrCodeRequestExecutor;
1012
import me.chanjar.weixin.common.exception.WxErrorException;
1113

12-
import java.io.File;
13-
1414
/**
1515
* @author <a href="https://github.com/binarywang">Binary Wang</a>
1616
*/
@@ -33,7 +33,7 @@ public File createQrcode(String path) throws WxErrorException {
3333
}
3434

3535
@Override
36-
public File createWxCode(String path, int width, boolean autoColor, WxMaCodeLineColor lineColor) throws WxErrorException {
36+
public File createWxaCode(String path, int width, boolean autoColor, WxMaCodeLineColor lineColor) throws WxErrorException {
3737
WxMaWxcode wxMaWxcode = new WxMaWxcode();
3838
wxMaWxcode.setPath(path);
3939
wxMaWxcode.setWidth(width);
@@ -44,31 +44,31 @@ public File createWxCode(String path, int width, boolean autoColor, WxMaCodeLine
4444
}
4545

4646
@Override
47-
public File createWxCode(String path, int width) throws WxErrorException {
48-
return this.createWxCode(path, width, true, null);
47+
public File createWxaCode(String path, int width) throws WxErrorException {
48+
return this.createWxaCode(path, width, true, null);
4949
}
5050

5151
@Override
52-
public File createWxCode(String path) throws WxErrorException {
53-
return this.createWxCode(path, 430, true, null);
52+
public File createWxaCode(String path) throws WxErrorException {
53+
return this.createWxaCode(path, 430, true, null);
5454
}
5555

5656
@Override
57-
public File createWxCodeLimit(String scene, String page, int width, boolean autoColor, WxMaCodeLineColor lineColor)
57+
public File createWxaCodeUnlimit(String scene, String page, int width, boolean autoColor, WxMaCodeLineColor lineColor)
5858
throws WxErrorException {
59-
WxMaWxcodeLimit wxMaWxcodeLimit = new WxMaWxcodeLimit();
60-
wxMaWxcodeLimit.setScene(scene);
61-
wxMaWxcodeLimit.setPage(page);
62-
wxMaWxcodeLimit.setWidth(width);
63-
wxMaWxcodeLimit.setAutoColor(autoColor);
64-
wxMaWxcodeLimit.setLineColor(lineColor);
59+
WxaCodeUnlimit wxaCodeUnlimit = new WxaCodeUnlimit();
60+
wxaCodeUnlimit.setScene(scene);
61+
wxaCodeUnlimit.setPage(page);
62+
wxaCodeUnlimit.setWidth(width);
63+
wxaCodeUnlimit.setAutoColor(autoColor);
64+
wxaCodeUnlimit.setLineColor(lineColor);
6565
return this.wxMaService.execute(new QrCodeRequestExecutor(this.wxMaService.getRequestHttp()),
66-
GET_WXACODE_UNLIMIT_URL, wxMaWxcodeLimit);
66+
GET_WXACODE_UNLIMIT_URL, wxaCodeUnlimit);
6767
}
6868

6969
@Override
70-
public File createWxCodeLimit(String scene, String page) throws WxErrorException {
71-
return this.createWxCodeLimit(scene, page, 430, true, null);
70+
public File createWxaCodeUnlimit(String scene, String page) throws WxErrorException {
71+
return this.createWxaCodeUnlimit(scene, page, 430, true, null);
7272
}
7373

7474
}

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxMaWxcodeLimit.java renamed to weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxaCodeUnlimit.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package cn.binarywang.wx.miniapp.bean;
22

3+
import java.io.Serializable;
4+
35
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
46
import com.google.gson.annotations.SerializedName;
57
import lombok.Data;
68
import lombok.EqualsAndHashCode;
79

8-
import java.io.Serializable;
9-
1010
/**
1111
* 小程序码接口B.
1212
*
@@ -15,7 +15,7 @@
1515
*/
1616
@Data
1717
@EqualsAndHashCode(callSuper = false)
18-
public class WxMaWxcodeLimit extends AbstractWxMaQrcodeWrapper implements Serializable {
18+
public class WxaCodeUnlimit extends AbstractWxMaQrcodeWrapper implements Serializable {
1919
private static final long serialVersionUID = 4782193774524960401L;
2020
private String scene;
2121
private String page;
@@ -28,8 +28,8 @@ public class WxMaWxcodeLimit extends AbstractWxMaQrcodeWrapper implements Serial
2828
@SerializedName("line_color")
2929
private WxMaCodeLineColor lineColor = new WxMaCodeLineColor("0", "0", "0");
3030

31-
public static WxMaWxcodeLimit fromJson(String json) {
32-
return WxMaGsonBuilder.create().fromJson(json, WxMaWxcodeLimit.class);
31+
public static WxaCodeUnlimit fromJson(String json) {
32+
return WxMaGsonBuilder.create().fromJson(json, WxaCodeUnlimit.class);
3333
}
3434

3535
}

weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaQrcodeServiceImplTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package cn.binarywang.wx.miniapp.api.impl;
22

3+
import java.io.File;
4+
5+
import org.testng.annotations.*;
6+
37
import cn.binarywang.wx.miniapp.api.WxMaService;
48
import cn.binarywang.wx.miniapp.test.ApiTestModule;
59
import com.google.inject.Inject;
6-
import org.testng.annotations.Guice;
7-
import org.testng.annotations.Test;
8-
9-
import java.io.File;
1010

1111
/**
1212
* @author <a href="https://github.com/binarywang">Binary Wang</a>
@@ -15,7 +15,7 @@
1515
@Guice(modules = ApiTestModule.class)
1616
public class WxMaQrcodeServiceImplTest {
1717
@Inject
18-
protected WxMaService wxService;
18+
private WxMaService wxService;
1919

2020
@Test
2121
public void testCreateQrCode() throws Exception {
@@ -24,14 +24,14 @@ public void testCreateQrCode() throws Exception {
2424
}
2525

2626
@Test
27-
public void testCreateWxCode() throws Exception {
28-
final File wxCode = this.wxService.getQrcodeService().createWxCode("111", 122);
27+
public void testCreateWxaCode() throws Exception {
28+
final File wxCode = this.wxService.getQrcodeService().createWxaCode("111", 122);
2929
System.out.println(wxCode);
3030
}
3131

3232
@Test
33-
public void testCreateWxCodeLimit() throws Exception {
34-
final File wxCode = this.wxService.getQrcodeService().createWxCodeLimit("111", null);
33+
public void testCreateWxaCodeUnlimit() throws Exception {
34+
final File wxCode = this.wxService.getQrcodeService().createWxaCodeUnlimit("111", null);
3535
System.out.println(wxCode);
3636
}
3737

0 commit comments

Comments
 (0)