mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-04-05 17:38:05 +08:00
✨ #1177 开放平台模块增加小程序基础信息设置接口
This commit is contained in:
parent
58244ee9ec
commit
b45f20a856
@ -70,6 +70,35 @@ public interface WxOpenMaService extends WxMaService {
|
||||
*/
|
||||
String API_GET_TESTERLIST = "https://api.weixin.qq.com/wxa/memberauth";
|
||||
|
||||
/**
|
||||
* 以下接口基础信息设置
|
||||
* <p>
|
||||
* https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=21517799059ZSEMr&token=6f965b5daf30a98a6bbd2a386faea5c934e929bf&lang=zh_CN
|
||||
* </p>
|
||||
*/
|
||||
|
||||
/**
|
||||
* 1. 设置小程序隐私设置(是否可被搜索)
|
||||
*/
|
||||
String API_CHANGE_WXA_SEARCH_STATUS = "https://api.weixin.qq.com/wxa/changewxasearchstatus";
|
||||
|
||||
/**
|
||||
* 2. 查询小程序当前隐私设置(是否可被搜索)
|
||||
*/
|
||||
String API_GET_WXA_SEARCH_STATUS = "https://api.weixin.qq.com/wxa/getwxasearchstatus";
|
||||
|
||||
/**
|
||||
* 3.1. 获取展示的公众号信息
|
||||
*/
|
||||
String API_GET_SHOW_WXA_ITEM = "https://api.weixin.qq.com/wxa/getshowwxaitem";
|
||||
|
||||
/**
|
||||
* 3.2 设置展示的公众号
|
||||
*/
|
||||
String API_UPDATE_SHOW_WXA_ITEM = "https://api.weixin.qq.com/wxa/updateshowwxaitem";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 以下接口为三方平台代小程序实现的代码管理功能
|
||||
* <p>
|
||||
@ -238,6 +267,35 @@ public interface WxOpenMaService extends WxMaService {
|
||||
*/
|
||||
WxOpenMaTesterListResult getTesterList() throws WxErrorException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设置小程序隐私设置(是否可被搜索)
|
||||
*
|
||||
* @param status 1表示不可搜索,0表示可搜索
|
||||
*/
|
||||
public WxOpenResult changeWxaSearchStatus(Integer status) throws WxErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* 2. 查询小程序当前隐私设置(是否可被搜索)
|
||||
*/
|
||||
public WxOpenMaSearchStatusResult getWxaSearchStatus() throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 3.1 获取展示的公众号信息
|
||||
*/
|
||||
public WxOpenMaShowItemResult getShowWxaItem() throws WxErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* 3.2 设置展示的公众号
|
||||
*
|
||||
* @param flag 0 关闭,1 开启
|
||||
* @param mpappid 如果开启,需要传新的公众号appid
|
||||
*/
|
||||
public WxOpenResult updateShowwxaitem(Integer flag, String mpappid) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 1、为授权的小程序帐号上传小程序代码
|
||||
*
|
||||
|
@ -137,7 +137,7 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
|
||||
/**
|
||||
* 设置小程序的业务域名
|
||||
*
|
||||
* @param action add添加, delete删除, set覆盖
|
||||
* @param action add添加, delete删除, set覆盖
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@ -208,6 +208,58 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
|
||||
return WxMaGsonBuilder.create().fromJson(response, WxOpenMaTesterListResult.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置小程序隐私设置(是否可被搜索)
|
||||
*
|
||||
* @param status 1表示不可搜索,0表示可搜索
|
||||
*/
|
||||
@Override
|
||||
public WxOpenResult changeWxaSearchStatus(Integer status) throws WxErrorException {
|
||||
JsonObject paramJson = new JsonObject();
|
||||
paramJson.addProperty("status", status);
|
||||
String response = post(API_CHANGE_WXA_SEARCH_STATUS, GSON.toJson(paramJson));
|
||||
return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 2. 查询小程序当前隐私设置(是否可被搜索)
|
||||
*/
|
||||
@Override
|
||||
public WxOpenMaSearchStatusResult getWxaSearchStatus() throws WxErrorException {
|
||||
JsonObject paramJson = new JsonObject();
|
||||
String response = post(API_GET_WXA_SEARCH_STATUS, GSON.toJson(paramJson));
|
||||
return WxMaGsonBuilder.create().fromJson(response, WxOpenMaSearchStatusResult.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 3.1 获取展示的公众号信息
|
||||
*/
|
||||
@Override
|
||||
public WxOpenMaShowItemResult getShowWxaItem() throws WxErrorException {
|
||||
String response = get(API_GET_SHOW_WXA_ITEM, null);
|
||||
return WxMaGsonBuilder.create().fromJson(response, WxOpenMaShowItemResult.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 3.2 设置展示的公众号
|
||||
*
|
||||
* @param flag 0 关闭,1 开启
|
||||
* @param mpappid 如果开启,需要传新的公众号appid
|
||||
*/
|
||||
@Override
|
||||
public WxOpenResult updateShowwxaitem(Integer flag, String mpappid) throws WxErrorException {
|
||||
JsonObject paramJson = new JsonObject();
|
||||
paramJson.addProperty("wxa_subscribe_biz_flag", flag);
|
||||
paramJson.addProperty("appid", mpappid);
|
||||
String response = post(API_UPDATE_SHOW_WXA_ITEM, GSON.toJson(paramJson));
|
||||
return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1、为授权的小程序帐号上传小程序代码
|
||||
*
|
||||
@ -330,6 +382,7 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
|
||||
|
||||
/**
|
||||
* 10. 修改小程序线上代码的可见状态(仅供第三方代小程序调用)
|
||||
*
|
||||
* @param action 设置可访问状态,发布后默认可访问,close为不可见,open为可见
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
@ -413,7 +466,6 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 13. 设置最低基础库版本(仅供第三方代小程序调用)
|
||||
*
|
||||
@ -471,7 +523,6 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 将字符串对象转化为GsonArray对象
|
||||
*
|
||||
|
@ -0,0 +1,20 @@
|
||||
package me.chanjar.weixin.open.bean.result;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WxOpenMaSearchStatusResult extends WxOpenResult {
|
||||
private static final long serialVersionUID = -1843419921284224813L;
|
||||
|
||||
@SerializedName("status")
|
||||
private Integer status;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return WxOpenGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package me.chanjar.weixin.open.bean.result;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WxOpenMaShowItemResult extends WxOpenResult {
|
||||
|
||||
private static final long serialVersionUID = -5707576958339934210L;
|
||||
|
||||
@SerializedName("is_open")
|
||||
private Integer isOpen;
|
||||
|
||||
@SerializedName("can_open")
|
||||
private Integer canOpen;
|
||||
|
||||
@SerializedName("appid")
|
||||
private String appid;
|
||||
|
||||
@SerializedName("nickname")
|
||||
private String nickname;
|
||||
|
||||
@SerializedName("headimg")
|
||||
private String headimg;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return WxOpenGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user