修复小程序码的相关方法命名:WxCode->WxaCode, WxCodeLimit -> WxaCodeUnlimit

This commit is contained in:
Binary Wang 2018-05-08 14:04:42 +08:00
parent 95583789b5
commit 329847eb90
4 changed files with 40 additions and 40 deletions

View File

@ -1,15 +1,15 @@
package cn.binarywang.wx.miniapp.api; package cn.binarywang.wx.miniapp.api;
import java.io.File;
import cn.binarywang.wx.miniapp.bean.WxMaCodeLineColor; import cn.binarywang.wx.miniapp.bean.WxMaCodeLineColor;
import me.chanjar.weixin.common.exception.WxErrorException; import me.chanjar.weixin.common.exception.WxErrorException;
import java.io.File;
/** /**
* <pre> * <pre>
* 二维码相关操作接口. * 二维码相关操作接口.
* *
* 接口AcreateWxCode加上接口CcreateQrcode总共生成的码数量限制为100,000请谨慎调用 * 接口AcreateWxaCode加上接口CcreateQrcode总共生成的码数量限制为100,000请谨慎调用
* *
* 文档地址https://mp.weixin.qq.com/debug/wxadoc/dev/api/qrcode.html * 文档地址https://mp.weixin.qq.com/debug/wxadoc/dev/api/qrcode.html
* </pre> * </pre>
@ -45,11 +45,11 @@ public interface WxMaQrcodeService {
* @param autoColor 默认true 自动配置线条颜色如果颜色依然是黑色则说明不建议配置主色调 * @param autoColor 默认true 自动配置线条颜色如果颜色依然是黑色则说明不建议配置主色调
* @param lineColor auth_color false 时生效使用 rgb 设置颜色 例如 {"r":"xxx","g":"xxx","b":"xxx"} * @param lineColor auth_color false 时生效使用 rgb 设置颜色 例如 {"r":"xxx","g":"xxx","b":"xxx"}
*/ */
File createWxCode(String path, int width, boolean autoColor, WxMaCodeLineColor lineColor) throws WxErrorException; File createWxaCode(String path, int width, boolean autoColor, WxMaCodeLineColor lineColor) throws WxErrorException;
File createWxCode(String path, int width) throws WxErrorException; File createWxaCode(String path, int width) throws WxErrorException;
File createWxCode(String path) throws WxErrorException; File createWxaCode(String path) throws WxErrorException;
/** /**
* 接口B: 获取小程序码永久有效数量暂无限制. * 接口B: 获取小程序码永久有效数量暂无限制.
@ -65,8 +65,8 @@ public interface WxMaQrcodeService {
* @param autoColor 默认true 自动配置线条颜色如果颜色依然是黑色则说明不建议配置主色调 * @param autoColor 默认true 自动配置线条颜色如果颜色依然是黑色则说明不建议配置主色调
* @param lineColor auth_color false 时生效使用 rgb 设置颜色 例如 {"r":"xxx","g":"xxx","b":"xxx"} * @param lineColor auth_color false 时生效使用 rgb 设置颜色 例如 {"r":"xxx","g":"xxx","b":"xxx"}
*/ */
File createWxCodeLimit(String scene, String page, int width, boolean autoColor, WxMaCodeLineColor lineColor) throws WxErrorException; File createWxaCodeUnlimit(String scene, String page, int width, boolean autoColor, WxMaCodeLineColor lineColor) throws WxErrorException;
File createWxCodeLimit(String scene, String page) throws WxErrorException; File createWxaCodeUnlimit(String scene, String page) throws WxErrorException;
} }

View File

@ -1,16 +1,16 @@
package cn.binarywang.wx.miniapp.api.impl; package cn.binarywang.wx.miniapp.api.impl;
import java.io.File;
import cn.binarywang.wx.miniapp.api.WxMaQrcodeService; import cn.binarywang.wx.miniapp.api.WxMaQrcodeService;
import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaCodeLineColor; import cn.binarywang.wx.miniapp.bean.WxMaCodeLineColor;
import cn.binarywang.wx.miniapp.bean.WxMaQrcode; import cn.binarywang.wx.miniapp.bean.WxMaQrcode;
import cn.binarywang.wx.miniapp.bean.WxMaWxcode; import cn.binarywang.wx.miniapp.bean.WxMaWxcode;
import cn.binarywang.wx.miniapp.bean.WxMaWxcodeLimit; import cn.binarywang.wx.miniapp.bean.WxaCodeUnlimit;
import cn.binarywang.wx.miniapp.util.http.QrCodeRequestExecutor; import cn.binarywang.wx.miniapp.util.http.QrCodeRequestExecutor;
import me.chanjar.weixin.common.exception.WxErrorException; import me.chanjar.weixin.common.exception.WxErrorException;
import java.io.File;
/** /**
* @author <a href="https://github.com/binarywang">Binary Wang</a> * @author <a href="https://github.com/binarywang">Binary Wang</a>
*/ */
@ -33,7 +33,7 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
} }
@Override @Override
public File createWxCode(String path, int width, boolean autoColor, WxMaCodeLineColor lineColor) throws WxErrorException { public File createWxaCode(String path, int width, boolean autoColor, WxMaCodeLineColor lineColor) throws WxErrorException {
WxMaWxcode wxMaWxcode = new WxMaWxcode(); WxMaWxcode wxMaWxcode = new WxMaWxcode();
wxMaWxcode.setPath(path); wxMaWxcode.setPath(path);
wxMaWxcode.setWidth(width); wxMaWxcode.setWidth(width);
@ -44,31 +44,31 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
} }
@Override @Override
public File createWxCode(String path, int width) throws WxErrorException { public File createWxaCode(String path, int width) throws WxErrorException {
return this.createWxCode(path, width, true, null); return this.createWxaCode(path, width, true, null);
} }
@Override @Override
public File createWxCode(String path) throws WxErrorException { public File createWxaCode(String path) throws WxErrorException {
return this.createWxCode(path, 430, true, null); return this.createWxaCode(path, 430, true, null);
} }
@Override @Override
public File createWxCodeLimit(String scene, String page, int width, boolean autoColor, WxMaCodeLineColor lineColor) public File createWxaCodeUnlimit(String scene, String page, int width, boolean autoColor, WxMaCodeLineColor lineColor)
throws WxErrorException { throws WxErrorException {
WxMaWxcodeLimit wxMaWxcodeLimit = new WxMaWxcodeLimit(); WxaCodeUnlimit wxaCodeUnlimit = new WxaCodeUnlimit();
wxMaWxcodeLimit.setScene(scene); wxaCodeUnlimit.setScene(scene);
wxMaWxcodeLimit.setPage(page); wxaCodeUnlimit.setPage(page);
wxMaWxcodeLimit.setWidth(width); wxaCodeUnlimit.setWidth(width);
wxMaWxcodeLimit.setAutoColor(autoColor); wxaCodeUnlimit.setAutoColor(autoColor);
wxMaWxcodeLimit.setLineColor(lineColor); wxaCodeUnlimit.setLineColor(lineColor);
return this.wxMaService.execute(new QrCodeRequestExecutor(this.wxMaService.getRequestHttp()), return this.wxMaService.execute(new QrCodeRequestExecutor(this.wxMaService.getRequestHttp()),
GET_WXACODE_UNLIMIT_URL, wxMaWxcodeLimit); GET_WXACODE_UNLIMIT_URL, wxaCodeUnlimit);
} }
@Override @Override
public File createWxCodeLimit(String scene, String page) throws WxErrorException { public File createWxaCodeUnlimit(String scene, String page) throws WxErrorException {
return this.createWxCodeLimit(scene, page, 430, true, null); return this.createWxaCodeUnlimit(scene, page, 430, true, null);
} }
} }

View File

@ -1,12 +1,12 @@
package cn.binarywang.wx.miniapp.bean; package cn.binarywang.wx.miniapp.bean;
import java.io.Serializable;
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder; import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.io.Serializable;
/** /**
* 小程序码接口B. * 小程序码接口B.
* *
@ -15,7 +15,7 @@ import java.io.Serializable;
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public class WxMaWxcodeLimit extends AbstractWxMaQrcodeWrapper implements Serializable { public class WxaCodeUnlimit extends AbstractWxMaQrcodeWrapper implements Serializable {
private static final long serialVersionUID = 4782193774524960401L; private static final long serialVersionUID = 4782193774524960401L;
private String scene; private String scene;
private String page; private String page;
@ -28,8 +28,8 @@ public class WxMaWxcodeLimit extends AbstractWxMaQrcodeWrapper implements Serial
@SerializedName("line_color") @SerializedName("line_color")
private WxMaCodeLineColor lineColor = new WxMaCodeLineColor("0", "0", "0"); private WxMaCodeLineColor lineColor = new WxMaCodeLineColor("0", "0", "0");
public static WxMaWxcodeLimit fromJson(String json) { public static WxaCodeUnlimit fromJson(String json) {
return WxMaGsonBuilder.create().fromJson(json, WxMaWxcodeLimit.class); return WxMaGsonBuilder.create().fromJson(json, WxaCodeUnlimit.class);
} }
} }

View File

@ -1,12 +1,12 @@
package cn.binarywang.wx.miniapp.api.impl; package cn.binarywang.wx.miniapp.api.impl;
import java.io.File;
import org.testng.annotations.*;
import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.test.ApiTestModule; import cn.binarywang.wx.miniapp.test.ApiTestModule;
import com.google.inject.Inject; import com.google.inject.Inject;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import java.io.File;
/** /**
* @author <a href="https://github.com/binarywang">Binary Wang</a> * @author <a href="https://github.com/binarywang">Binary Wang</a>
@ -15,7 +15,7 @@ import java.io.File;
@Guice(modules = ApiTestModule.class) @Guice(modules = ApiTestModule.class)
public class WxMaQrcodeServiceImplTest { public class WxMaQrcodeServiceImplTest {
@Inject @Inject
protected WxMaService wxService; private WxMaService wxService;
@Test @Test
public void testCreateQrCode() throws Exception { public void testCreateQrCode() throws Exception {
@ -24,14 +24,14 @@ public class WxMaQrcodeServiceImplTest {
} }
@Test @Test
public void testCreateWxCode() throws Exception { public void testCreateWxaCode() throws Exception {
final File wxCode = this.wxService.getQrcodeService().createWxCode("111", 122); final File wxCode = this.wxService.getQrcodeService().createWxaCode("111", 122);
System.out.println(wxCode); System.out.println(wxCode);
} }
@Test @Test
public void testCreateWxCodeLimit() throws Exception { public void testCreateWxaCodeUnlimit() throws Exception {
final File wxCode = this.wxService.getQrcodeService().createWxCodeLimit("111", null); final File wxCode = this.wxService.getQrcodeService().createWxaCodeUnlimit("111", null);
System.out.println(wxCode); System.out.println(wxCode);
} }