11package cn .binarywang .wx .miniapp .api ;
22
3- import java .io .File ;
4-
53import cn .binarywang .wx .miniapp .bean .WxMaCodeLineColor ;
64import me .chanjar .weixin .common .error .WxErrorException ;
75
6+ import java .io .File ;
7+
88/**
99 * <pre>
1010 * 二维码相关操作接口.
@@ -37,6 +37,23 @@ public interface WxMaQrcodeService {
3737 */
3838 byte [] createQrcodeBytes (String path , int width ) throws WxErrorException ;
3939
40+ /**
41+ * 接口C: 获取小程序页面二维码.
42+ * <pre>
43+ * 适用于需要的码数量较少的业务场景
44+ * 通过该接口,仅能生成已发布的小程序的二维码。
45+ * 可以在开发者工具预览时生成开发版的带参二维码。
46+ * 带参二维码只有 100000 个,请谨慎调用。
47+ * </pre>
48+ *
49+ * @param path 不能为空,最大长度 128 字节
50+ * @param width 默认430 二维码的宽度
51+ * @param filePath 二维码生成的文件路径,例如: /var/temp
52+ * @return 文件对象
53+ * @throws WxErrorException 异常
54+ */
55+ File createQrcode (String path , int width , String filePath ) throws WxErrorException ;
56+
4057 /**
4158 * 接口C: 获取小程序页面二维码.
4259 * <pre>
@@ -53,6 +70,22 @@ public interface WxMaQrcodeService {
5370 */
5471 File createQrcode (String path , int width ) throws WxErrorException ;
5572
73+ /**
74+ * 接口C: 获取小程序页面二维码.
75+ * <pre>
76+ * 适用于需要的码数量较少的业务场景
77+ * 通过该接口,仅能生成已发布的小程序的二维码。
78+ * 可以在开发者工具预览时生成开发版的带参二维码。
79+ * 带参二维码只有 100000 个,请谨慎调用。
80+ * </pre>
81+ *
82+ * @param path 不能为空,最大长度 128 字节
83+ * @param filePath 二维码生成的文件路径,例如: /var/temp
84+ * @return 文件对象
85+ * @throws WxErrorException 异常
86+ */
87+ File createQrcode (String path , String filePath ) throws WxErrorException ;
88+
5689 /**
5790 * 接口C: 获取小程序页面二维码.
5891 * <pre>
@@ -82,6 +115,21 @@ public interface WxMaQrcodeService {
82115 byte [] createWxaCodeBytes (String path , int width , boolean autoColor , WxMaCodeLineColor lineColor , boolean isHyaline )
83116 throws WxErrorException ;
84117
118+ /**
119+ * 接口A: 获取小程序码.
120+ *
121+ * @param path 不能为空,最大长度 128 字节
122+ * @param width 默认430 二维码的宽度
123+ * @param filePath 二维码生成的文件路径,例如: /var/temp
124+ * @param autoColor 默认true 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调
125+ * @param lineColor auth_color 为 false 时生效,使用 rgb 设置颜色 例如 {"r":"xxx","g":"xxx","b":"xxx"}
126+ * @param isHyaline 是否需要透明底色, isHyaline 为true时,生成透明底色的小程序码
127+ * @return 文件对象
128+ * @throws WxErrorException 异常
129+ */
130+ File createWxaCode (String path , int width , String filePath , boolean autoColor , WxMaCodeLineColor lineColor , boolean isHyaline )
131+ throws WxErrorException ;
132+
85133 /**
86134 * 接口A: 获取小程序码.
87135 *
@@ -96,6 +144,17 @@ byte[] createWxaCodeBytes(String path, int width, boolean autoColor, WxMaCodeLin
96144 File createWxaCode (String path , int width , boolean autoColor , WxMaCodeLineColor lineColor , boolean isHyaline )
97145 throws WxErrorException ;
98146
147+ /**
148+ * 接口A: 获取小程序码.
149+ *
150+ * @param path 不能为空,最大长度 128 字节
151+ * @param width 默认430 二维码的宽度
152+ * @param filePath 二维码生成的文件路径,例如: /var/temp
153+ * @return 文件对象
154+ * @throws WxErrorException 异常
155+ */
156+ File createWxaCode (String path , int width , String filePath ) throws WxErrorException ;
157+
99158 /**
100159 * 接口A: 获取小程序码.
101160 *
@@ -106,6 +165,16 @@ File createWxaCode(String path, int width, boolean autoColor, WxMaCodeLineColor
106165 */
107166 File createWxaCode (String path , int width ) throws WxErrorException ;
108167
168+ /**
169+ * 接口A: 获取小程序码.
170+ *
171+ * @param path 不能为空,最大长度 128 字节
172+ * @param filePath 二维码生成的文件路径,例如: /var/temp
173+ * @return 文件对象
174+ * @throws WxErrorException 异常
175+ */
176+ File createWxaCode (String path , String filePath ) throws WxErrorException ;
177+
109178 /**
110179 * 接口A: 获取小程序码.
111180 *
@@ -137,6 +206,29 @@ File createWxaCode(String path, int width, boolean autoColor, WxMaCodeLineColor
137206 byte [] createWxaCodeUnlimitBytes (String scene , String page , int width , boolean autoColor ,
138207 WxMaCodeLineColor lineColor , boolean isHyaline ) throws WxErrorException ;
139208
209+ /**
210+ * 接口B: 获取小程序码(永久有效、数量暂无限制).
211+ * <pre>
212+ * 通过该接口生成的小程序码,永久有效,数量暂无限制。
213+ * 用户扫描该码进入小程序后,将统一打开首页,开发者需在对应页面根据获取的码中 scene 字段的值,再做处理逻辑。
214+ * 使用如下代码可以获取到二维码中的 scene 字段的值。
215+ * 调试阶段可以使用开发工具的条件编译自定义参数 scene=xxxx 进行模拟,开发工具模拟时的 scene 的参数值需要进行 urlencode
216+ * </pre>
217+ *
218+ * @param scene 最大32个可见字符,只支持数字,大小写英文以及部分特殊字符:!#$&'()*+,/:;=?@-._~,
219+ * 其它字符请自行编码为合法字符(因不支持%,中文无法使用 urlencode 处理,请使用其他编码方式)
220+ * @param page 必须是已经发布的小程序页面,例如 "pages/index/index" ,如果不填写这个字段,默认跳主页面
221+ * @param filePath 二维码生成的文件路径,例如: /var/temp
222+ * @param width 默认false 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调
223+ * @param autoColor 默认true 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调
224+ * @param lineColor auth_color 为 false 时生效,使用 rgb 设置颜色 例如 {"r":"xxx","g":"xxx","b":"xxx"}
225+ * @param isHyaline 是否需要透明底色, is_hyaline 为true时,生成透明底色的小程序码
226+ * @return 文件对象
227+ * @throws WxErrorException 异常
228+ */
229+ File createWxaCodeUnlimit (String scene , String page , String filePath , int width , boolean autoColor ,
230+ WxMaCodeLineColor lineColor , boolean isHyaline ) throws WxErrorException ;
231+
140232 /**
141233 * 接口B: 获取小程序码(永久有效、数量暂无限制).
142234 * <pre>
@@ -159,6 +251,24 @@ byte[] createWxaCodeUnlimitBytes(String scene, String page, int width, boolean a
159251 File createWxaCodeUnlimit (String scene , String page , int width , boolean autoColor ,
160252 WxMaCodeLineColor lineColor , boolean isHyaline ) throws WxErrorException ;
161253
254+ /**
255+ * 接口B: 获取小程序码(永久有效、数量暂无限制).
256+ * <pre>
257+ * 通过该接口生成的小程序码,永久有效,数量暂无限制。
258+ * 用户扫描该码进入小程序后,将统一打开首页,开发者需在对应页面根据获取的码中 scene 字段的值,再做处理逻辑。
259+ * 使用如下代码可以获取到二维码中的 scene 字段的值。
260+ * 调试阶段可以使用开发工具的条件编译自定义参数 scene=xxxx 进行模拟,开发工具模拟时的 scene 的参数值需要进行 urlencode
261+ * </pre>
262+ *
263+ * @param scene 最大32个可见字符,只支持数字,大小写英文以及部分特殊字符:!#$&'()*+,/:;=?@-._~,
264+ * 其它字符请自行编码为合法字符(因不支持%,中文无法使用 urlencode 处理,请使用其他编码方式)
265+ * @param page 必须是已经发布的小程序页面,例如 "pages/index/index" ,如果不填写这个字段,默认跳主页面
266+ * @param filePath 二维码生成的文件路径,例如: /var/temp
267+ * @return 文件对象
268+ * @throws WxErrorException 异常
269+ */
270+ File createWxaCodeUnlimit (String scene , String page , String filePath ) throws WxErrorException ;
271+
162272 /**
163273 * 接口B: 获取小程序码(永久有效、数量暂无限制).
164274 * <pre>
0 commit comments