Skip to content

Commit 72266c3

Browse files
zhoushi1zhoushi1
andauthored
🎨 #3627 【开放平台】小程序三方平台代上传代码提交额外信息对象新增requiredPrivateInfos信息
Co-authored-by: zhoushi1 <[email protected]>
1 parent ccbfa98 commit 72266c3

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/ma/WxMaOpenCommitExtInfo.java

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,39 @@ public class WxMaOpenCommitExtInfo implements Serializable {
9494
@SerializedName("tabBar")
9595
private WxMaOpenTabBar tabBar;
9696

97+
/**
98+
* 关于新增 requiredPrivateInfos 说明
99+
* 关于地理位置接口新增与相关流程调整可以查看社区公告:
100+
* <a href="https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01">点击查看</a>
101+
* 7.14后,在代码中使用的地理位置相关接口(共计 8 个,见表1),第三方开发者均需要在 ext_json 参数中 requiredPrivateInfos 配置项中声明
102+
* 在ext_json参数中配置requiredPrivateInfos,其规则为「整体替换」。即如果在 app.json 里也配置了,那么最终会是ext_json的配置会覆盖 app.json
103+
* 配置的requiredPrivateInfos。其余规则可查看下方的「ext_json补充说明」
104+
* 在ext_json参数中配置 requiredPrivateInfos 示例如下
105+
* {
106+
* "template_id": "95",
107+
* "ext_json": "{\"requiredPrivateInfos\":[\"onLocationChange\",\"startLocationUpdate\"]}",
108+
* "user_version": "V1.0",
109+
* "user_desc": "test"
110+
* }
111+
* requiredPrivateInfos主要会检查格式是否正确,填入的 api 名称是否正确,填入的 api 名称是否有权限,填入的 api 名称是否互斥。对应的错误码可查看文档末尾的错误码文档。
112+
* requiredPrivateInfos在2022.7.14后才会生效,文档提前更新是为了方便开发者可以提前了解接口的参数变更规则,提前进行调整。
113+
*/
114+
@SerializedName("requiredPrivateInfos")
115+
private String[] requiredPrivateInfos;
116+
97117
/**
98118
* 添加扩展项
99119
*
100120
* @param key
101121
* @param value
102122
*/
103123
public void addExt(String key, String value) {
104-
if (extMap == null)
124+
if (extMap == null) {
105125
extMap = new HashMap<>();
106-
if (StringUtils.isNoneBlank(key, value))
126+
}
127+
if (StringUtils.isNoneBlank(key, value)) {
107128
extMap.put(key, value);
129+
}
108130
}
109131

110132
/**
@@ -114,10 +136,12 @@ public void addExt(String key, String value) {
114136
* @param page
115137
*/
116138
public void addExtPage(String pagePath, WxMaOpenPage page) {
117-
if (extPages == null)
139+
if (extPages == null) {
118140
extPages = new HashMap<>();
119-
if (StringUtils.isNotBlank(pagePath) && page != null)
141+
}
142+
if (StringUtils.isNotBlank(pagePath) && page != null) {
120143
extPages.put(pagePath, page);
144+
}
121145
}
122146

123147
/**
@@ -126,10 +150,12 @@ public void addExtPage(String pagePath, WxMaOpenPage page) {
126150
* @param pagePath
127151
*/
128152
public void addPage(String pagePath) {
129-
if (pageList == null)
153+
if (pageList == null) {
130154
pageList = new ArrayList<>();
131-
if (StringUtils.isNotBlank(pagePath))
155+
}
156+
if (StringUtils.isNotBlank(pagePath)) {
132157
pageList.add(pagePath);
158+
}
133159
}
134160

135161
public static WxMaOpenCommitExtInfo INSTANCE() {

0 commit comments

Comments
 (0)