mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-10-21 02:57:37 +08:00
✨ #1123 增加设置小程序“扫普通链接二维码打开小程序”能力的五个接口
This commit is contained in:
@@ -167,10 +167,33 @@ public interface WxOpenMaService extends WxMaService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 14.设置小程序“扫普通链接二维码打开小程序”能力
|
* 14.设置小程序“扫普通链接二维码打开小程序”能力
|
||||||
* <p>
|
*
|
||||||
* TODO 暂时不实现
|
* https://mp.weixin.qq.com/debug/wxadoc/introduction/qrcode.html
|
||||||
* </p>
|
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
|
* 14.1 增加或修改二维码规则
|
||||||
|
*/
|
||||||
|
String API_QRCODE_JUMP_ADD = "https://api.weixin.qq.com/cgi-bin/wxopen/qrcodejumpadd";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 14.2 获取已设置的二维码规则
|
||||||
|
*/
|
||||||
|
String API_QRCODE_JUMP_GET = "https://api.weixin.qq.com/cgi-bin/wxopen/qrcodejumpget";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 14.3 获取校验文件名称及内容
|
||||||
|
*/
|
||||||
|
String API_QRCODE_JUMP_DOWNLOAD = "https://api.weixin.qq.com/cgi-bin/wxopen/qrcodejumpdownload";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 14.4 删除已设置的二维码规则
|
||||||
|
*/
|
||||||
|
String API_QRCODE_JUMP_DELETE = "https://api.weixin.qq.com/cgi-bin/wxopen/qrcodejumpdelete";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 14.5 发布已设置的二维码规则
|
||||||
|
*/
|
||||||
|
String API_QRCODE_JUMP_PUBLISH = "https://api.weixin.qq.com/cgi-bin/wxopen/qrcodejumppublish";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 15.小程序审核撤回
|
* 15.小程序审核撤回
|
||||||
@@ -421,4 +444,28 @@ public interface WxOpenMaService extends WxMaService {
|
|||||||
*/
|
*/
|
||||||
Boolean speedAudit(Long auditid) throws WxErrorException;
|
Boolean speedAudit(Long auditid) throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (1)增加或修改二维码规则
|
||||||
|
*/
|
||||||
|
WxOpenResult addQrcodeJump(WxQrcodeJumpRule wxQrcodeJumpRule) throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (2)获取已设置的二维码规则
|
||||||
|
*/
|
||||||
|
WxGetQrcodeJumpResult getQrcodeJump() throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (3)获取校验文件名称及内容
|
||||||
|
*/
|
||||||
|
WxDownlooadQrcodeJumpResult downloadQrcodeJump() throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (4)删除已设置的二维码规则
|
||||||
|
*/
|
||||||
|
WxOpenResult deleteQrcodeJump(String prefix) throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (5)发布已设置的二维码规则
|
||||||
|
*/
|
||||||
|
WxOpenResult publishQrcodeJump(String prefix) throws WxErrorException;
|
||||||
}
|
}
|
||||||
|
@@ -548,6 +548,68 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (1)增加或修改二维码规则
|
||||||
|
* @param wxQrcodeJumpRule
|
||||||
|
* @return
|
||||||
|
* @throws WxErrorException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WxOpenResult addQrcodeJump(WxQrcodeJumpRule wxQrcodeJumpRule) throws WxErrorException {
|
||||||
|
String response = post(API_QRCODE_JUMP_ADD, GSON.toJson(wxQrcodeJumpRule));
|
||||||
|
return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (2)获取已设置的二维码规则
|
||||||
|
* @return
|
||||||
|
* @throws WxErrorException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WxGetQrcodeJumpResult getQrcodeJump() throws WxErrorException {
|
||||||
|
String response = post(API_QRCODE_JUMP_GET, "{}");
|
||||||
|
return WxMaGsonBuilder.create().fromJson(response, WxGetQrcodeJumpResult.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (3)获取校验文件名称及内容
|
||||||
|
* @return
|
||||||
|
* @throws WxErrorException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WxDownlooadQrcodeJumpResult downloadQrcodeJump() throws WxErrorException {
|
||||||
|
String response = post(API_QRCODE_JUMP_DOWNLOAD, "{}");
|
||||||
|
return WxMaGsonBuilder.create().fromJson(response, WxDownlooadQrcodeJumpResult.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (4)删除已设置的二维码规则
|
||||||
|
* @param prefix
|
||||||
|
* @return
|
||||||
|
* @throws WxErrorException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WxOpenResult deleteQrcodeJump(String prefix) throws WxErrorException {
|
||||||
|
JsonObject params = new JsonObject();
|
||||||
|
params.addProperty("prefix", prefix);
|
||||||
|
String response = post(API_QRCODE_JUMP_DELETE, GSON.toJson(params));
|
||||||
|
return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (5)发布已设置的二维码规则
|
||||||
|
* @param prefix
|
||||||
|
* @return
|
||||||
|
* @throws WxErrorException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WxOpenResult publishQrcodeJump(String prefix) throws WxErrorException {
|
||||||
|
JsonObject params = new JsonObject();
|
||||||
|
params.addProperty("prefix", prefix);
|
||||||
|
String response = post(API_QRCODE_JUMP_PUBLISH, GSON.toJson(params));
|
||||||
|
return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将字符串对象转化为GsonArray对象
|
* 将字符串对象转化为GsonArray对象
|
||||||
*
|
*
|
||||||
|
@@ -0,0 +1,30 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二维码规则的校验文件名称及内容
|
||||||
|
*
|
||||||
|
* @author <a href="https://github.com/hanwei59">hanwei59</a>
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class WxDownlooadQrcodeJumpResult extends WxOpenResult {
|
||||||
|
|
||||||
|
//文件名称
|
||||||
|
@SerializedName("file_name")
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
//文件内容
|
||||||
|
@SerializedName("file_content")
|
||||||
|
private String fileContent;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return WxOpenGsonBuilder.create().toJson(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,40 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已设置的二维码规则信息
|
||||||
|
*
|
||||||
|
* @author <a href="https://github.com/hanwei59">hanwei59</a>
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class WxGetQrcodeJumpResult extends WxOpenResult {
|
||||||
|
|
||||||
|
//二维码规则详情,数组形式
|
||||||
|
@SerializedName("rule_list")
|
||||||
|
List<WxQrcodeJumpRule> ruleList;
|
||||||
|
|
||||||
|
//是否已经打开二维码跳转链接设置
|
||||||
|
@SerializedName("qrcodejump_open")
|
||||||
|
private String qrcodejumpOpen;
|
||||||
|
|
||||||
|
//本月还可发布的次数
|
||||||
|
@SerializedName("qrcodejump_pub_quota")
|
||||||
|
private Integer qrcodejumpPubQuota;
|
||||||
|
|
||||||
|
//二维码规则数量
|
||||||
|
@SerializedName("list_size")
|
||||||
|
private Integer listSize;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return WxOpenGsonBuilder.create().toJson(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,43 @@
|
|||||||
|
package me.chanjar.weixin.open.bean.result;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二维码规则
|
||||||
|
*
|
||||||
|
* <a href="https://github.com/hanwei59">hanwei59</a>
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class WxQrcodeJumpRule {
|
||||||
|
|
||||||
|
//二维码规则
|
||||||
|
@SerializedName("prefix")
|
||||||
|
private String prefix;
|
||||||
|
|
||||||
|
//是否独占符合二维码前缀匹配规则的所有子规则:1为不占用,2为占用
|
||||||
|
//详细说明:https://mp.weixin.qq.com/debug/wxadoc/introduction/qrcode.html#前缀占用规则
|
||||||
|
@SerializedName("permit_sub_rule")
|
||||||
|
private String permitSubRule;
|
||||||
|
|
||||||
|
//小程序功能页面
|
||||||
|
@SerializedName("path")
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
//测试范围:
|
||||||
|
//1为开发版(配置只对开发者生效)
|
||||||
|
//2为体验版(配置对管理员、体验者生效)
|
||||||
|
//3为线上版本(配置对管理员、开发者和体验者生效)
|
||||||
|
@SerializedName("open_version")
|
||||||
|
private String openVersion;
|
||||||
|
|
||||||
|
//测试链接(选填)可填写不多于5个用于测试的二维码完整链接,此链接必须符合已填写的二维码规则。
|
||||||
|
@SerializedName("debug_url")
|
||||||
|
private List<String> debugUrl;
|
||||||
|
|
||||||
|
//编辑标志位,0表示新增二维码规则,1表示修改已有二维码规则
|
||||||
|
@SerializedName("is_edit")
|
||||||
|
private String isEdit;
|
||||||
|
}
|
Reference in New Issue
Block a user