🆕【开放平台】添加获取换绑管理员 URL 的接口

This commit is contained in:
痴货 2025-08-08 06:14:25 +00:00 committed by Binary Wang
parent 8bb4a21598
commit 7ffc1b3719
6 changed files with 36 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.open.bean.ma.WxFastMaCategory;
import me.chanjar.weixin.open.bean.result.*;
import java.io.UnsupportedEncodingException;
import java.util.List;
/**
@ -78,6 +79,8 @@ public interface WxOpenMaBasicService {
*/
String OPEN_GET_ORDER_PATH_INFO = "https://api.weixin.qq.com/wxa/security/getorderpathinfo";
String URL_COMPONENT_REBIND_ADMIN = "https://mp.weixin.qq.com/wxopen/componentrebindadmin?appid=%s&component_appid=%s&redirect_uri=%s";
/**
* 1.获取小程序的信息
@ -148,6 +151,14 @@ public interface WxOpenMaBasicService {
*/
WxOpenResult modifySignature(String signature) throws WxErrorException;
/**
* 7.1 获取换绑管理员URL
* @param redirectUri 跳转URL
* @param appId 公众号的 appid
* @return 换绑管理员URL
*/
String getComponentRebindAdminUrl(String redirectUri, String appId) throws UnsupportedEncodingException;
/**
* 7.3 管理员换绑
*

View File

@ -11,6 +11,7 @@ import me.chanjar.weixin.open.bean.ma.WxFastMaCategory;
import me.chanjar.weixin.open.bean.result.*;
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -99,6 +100,11 @@ public class WxOpenFastMaServiceImpl extends WxMaServiceImpl implements WxOpenFa
return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class);
}
@Override
public String getComponentRebindAdminUrl(String redirectUri, String appId) {
return "";
}
@Override
public WxOpenResult componentRebindAdmin(String taskid) throws WxErrorException {
JsonObject params = new JsonObject();

View File

@ -3,12 +3,16 @@ package me.chanjar.weixin.open.api.impl;
import cn.binarywang.wx.miniapp.api.WxMaService;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import lombok.SneakyThrows;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.open.api.WxOpenComponentService;
import me.chanjar.weixin.open.api.WxOpenMaBasicService;
import me.chanjar.weixin.open.bean.ma.WxFastMaCategory;
import me.chanjar.weixin.open.bean.result.*;
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -21,9 +25,11 @@ import java.util.Map;
public class WxOpenMaBasicServiceImpl implements WxOpenMaBasicService {
private final WxMaService wxMaService;
private final WxOpenComponentService wxOpenComponentService;
public WxOpenMaBasicServiceImpl(WxMaService wxMaService) {
public WxOpenMaBasicServiceImpl(WxMaService wxMaService, WxOpenComponentService wxOpenComponentService) {
this.wxMaService = wxMaService;
this.wxOpenComponentService = wxOpenComponentService;
}
@ -81,6 +87,15 @@ public class WxOpenMaBasicServiceImpl implements WxOpenMaBasicService {
return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class);
}
@SneakyThrows
@Override
public String getComponentRebindAdminUrl(String redirectUri, String appId) {
String componentAppId = wxOpenComponentService.getWxOpenConfigStorage().getComponentAppId();
String encoded = URLEncoder.encode(redirectUri, "UTF-8");
return String.format(URL_COMPONENT_REBIND_ADMIN, appId, componentAppId, encoded);
}
@Override
public WxOpenResult componentRebindAdmin(String taskid) throws WxErrorException {
JsonObject params = new JsonObject();

View File

@ -63,7 +63,7 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
this.wxOpenComponentService = wxOpenComponentService;
this.appId = appId;
this.wxMaConfig = wxMaConfig;
this.basicService = new WxOpenMaBasicServiceImpl(this);
this.basicService = new WxOpenMaBasicServiceImpl(this, wxOpenComponentService);
this.authService = new WxOpenMaAuthServiceImpl(this);
this.icpService = new WxOpenMaIcpServiceImpl(this);
this.privacyService = new WxOpenMaPrivacyServiceImpl(this);

View File

@ -518,7 +518,7 @@ public class WxOpenSubmitAuthAndIcpParam implements Serializable {
* 微信小程序基本信息
*/
@SerializedName("base_info")
private AppletsBaseInfo AppleBaseInfo;
private AppletsBaseInfo baseInfo;
/**
* 小程序负责人信息

View File

@ -313,7 +313,7 @@ public class WxOpenApplyIcpFilingParam implements Serializable {
* 微信小程序基本信息
*/
@SerializedName("base_info")
private AppletsBaseInfo basInfo;
private AppletsBaseInfo baseInfo;
/**
* 小程序负责人信息