mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-02 20:02:37 +08:00
🆕 #2815【开放平台】查询公众号/小程序是否绑定open实现 && 增加授权用户资料变更事件常量
This commit is contained in:
parent
b8d0baae5b
commit
7f7c0a3765
@ -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";
|
||||
|
||||
/**
|
||||
* 微信小店 订单付款通知.
|
||||
*/
|
||||
|
@ -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
|
||||
* 第三方平台快速创建小程序.
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user