🆕 #2815【开放平台】查询公众号/小程序是否绑定open实现 && 增加授权用户资料变更事件常量

This commit is contained in:
Nobody 2022-09-19 20:00:16 +08:00 committed by GitHub
parent b8d0baae5b
commit 7f7c0a3765
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 68 additions and 0 deletions

View File

@ -309,7 +309,23 @@ public class WxConsts {
*/
public static final String LOCATION_SELECT = "location_select";
/**
* 授权用户资料变更事件
* 1 当部分用户的资料存在风险时平台会对用户资料进行清理并通过消息推送服务器通知最近30天授权过的公众号开发者我们建议开发者留意响应该事件及时主动更新或清理用户的头像及昵称降低风险
* 2 当用户撤回授权信息时平台会通过消息推送服务器通知给公众号开发者请开发者注意及时删除用户信息
*/
public static final String USER_INFO_MODIFIED = "user_info_modified";
/**
* 用户撤回授权事件
*/
public static final String USER_AUTHORIZATION_REVOKE = "user_authorization_revoke";
/**
* 群发模板回调事件
*/
public static final String TEMPLATE_SEND_JOB_FINISH = "TEMPLATESENDJOBFINISH";
/**
* 微信小店 订单付款通知.
*/

View File

@ -115,6 +115,11 @@ public interface WxOpenComponentService {
*/
String GET_OPEN_URL = "https://api.weixin.qq.com/cgi-bin/open/get";
/**
* 查询公众号/小程序是否绑定 open 帐号
*/
String HAVE_OPEN_URL = "https://api.weixin.qq.com/cgi-bin/open/have";
/**
* 快速创建小程序接口.
*/
@ -575,6 +580,16 @@ public interface WxOpenComponentService {
*/
WxOpenGetResult getOpenAccount(String appId, String appIdType) throws WxErrorException;
/**
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Mini_Program_Basic_Info/getbindopeninfo.html
* 查询公众号/小程序是否绑定 open 帐号
*
* @return 是否绑定 open 帐号true表示绑定false表示未绑定任何 open 帐号
* @throws WxErrorException the wx error exception
*/
WxOpenHaveResult haveOpen() throws WxErrorException;
/**
* https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=21538208049W8uwq&token=&lang=zh_CN
* 第三方平台快速创建小程序.

View File

@ -607,6 +607,12 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService {
return WxOpenGetResult.fromJson(json);
}
@Override
public WxOpenHaveResult haveOpen() throws WxErrorException {
String json = post(GET_OPEN_URL, null);
return WxOpenHaveResult.fromJson(json);
}
@Override
public WxOpenResult fastRegisterWeapp(String name, String code, String codeType, String legalPersonaWechat, String legalPersonaName, String componentPhone) throws WxErrorException {

View File

@ -0,0 +1,25 @@
package me.chanjar.weixin.open.bean.result;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
import java.io.Serializable;
/**
* API 用于查询公众号或小程序是否绑定的开放平台帐号
* 文档地址https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Mini_Program_Basic_Info/getbindopeninfo.html
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class WxOpenHaveResult extends WxOpenResult implements Serializable {
@SerializedName("have_open")
private Boolean haveOpen;
public static WxOpenHaveResult fromJson(String json) {
return WxGsonBuilder.create().fromJson(json, WxOpenHaveResult.class);
}
}

View File

@ -3,6 +3,7 @@ package me.chanjar.weixin.open.api.impl;
import com.google.inject.Inject;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.open.api.WxOpenComponentService;
import me.chanjar.weixin.open.bean.result.WxOpenHaveResult;
import me.chanjar.weixin.open.bean.result.WxOpenResult;
import me.chanjar.weixin.open.bean.tcb.ShareCloudBaseEnvRequest;
import me.chanjar.weixin.open.bean.tcb.ShareCloudBaseEnvResponse;
@ -166,6 +167,11 @@ public class WxOpenComponentServiceImplTest {
@Test
public void testGetOpenAccount() {
}
@Test
public void testHaveOpen() throws WxErrorException {
WxOpenHaveResult wxOpenHaveResult = wxOpenComponentService.haveOpen();
Assert.assertNotNull(wxOpenHaveResult);
}
@Test
public void testFastRegisterWeapp() {