提交修改

This commit is contained in:
quyixiao 2025-11-12 12:37:24 +08:00
parent 55c5cd7335
commit 95f0f8b769

View File

@ -121,20 +121,16 @@ public class WeChatUtils {
String url = linkUrl + accessToken;
cn.hutool.json.JSONObject body = cn.hutool.json.JSONUtil.createObj();
body.putOpt("path", path);
body.putOpt("query", query);
body.putOpt("path", path); // 通过 URL Link 进入的小程序页面路径必须是已经发布的小程序存在的页面不可携带 query path 为空时会跳转小程序主页
body.putOpt("query", query); // 通过 URL Link 进入小程序时的query最大1024个字符只支持数字大小写英文以及部分特殊字符!#$&'()*+,/:;=?@-._~%
//链接过期类型0时间戳 1间隔天数
body.putOpt("expire_type", 1);
body.putOpt("expire_type", 1); // 默认值0.小程序 URL Link 失效类型失效时间0失效间隔天数1
//指定失效天数最多30
days = (days == null || days > 30) ? 30 : days;
body.putOpt("expire_interval", days); // 到期失效的URL Link的失效间隔天数生成的到期失效URL Link在该间隔时间到达前有效最长间隔天数为30天expire_type 1 必填
body.putOpt("expire_interval", days);
//小程序版本正式版为 "release"体验版为"trial"开发版为"develop"
body.putOpt("env_version", "trial");
body.putOpt("env_version", "trial"); // 默认值"release"要打开的小程序版本正式版为 "release"体验版为"trial"开发版为"develop"仅在微信外打开时生效
String result = HttpUtil.post(url, body.toJSONString(2));
log.info("jumpAppletShortUrl params:{}, result:{}", JSON.toJSONString(body), result);
return result;
@ -155,16 +151,16 @@ public class WeChatUtils {
String url = schemeUrl + getAccessTokenDTO().getAccessToken();
cn.hutool.json.JSONObject body = cn.hutool.json.JSONUtil.createObj();
cn.hutool.json.JSONObject jumpWxa = cn.hutool.json.JSONUtil.createObj();
jumpWxa.putOpt("path", path);
jumpWxa.putOpt("query", query);
jumpWxa.putOpt("env_version", "release");
body.putOpt("jump_wxa", jumpWxa);
jumpWxa.putOpt("path", path); // 通过 scheme 码进入的小程序页面路径必须是已经发布的小程序存在的页面不可携带 querypath 为空时会跳转小程序主页
jumpWxa.putOpt("query", query); // 通过 scheme 码进入小程序时的 query最大1024个字符只支持数字大小写英文以及部分特殊字符!#$&'()*+,/:;=?@-._~%`
jumpWxa.putOpt("env_version", "release"); // 默认值"release"要打开的小程序版本正式版为"release"体验版为"trial"开发版为"develop"仅在微信外打开时生效
body.putOpt("jump_wxa", jumpWxa); // 跳转到的目标小程序信息
//链接过期类型0时间戳 1间隔天数
body.putOpt("expire_type", 1);
body.putOpt("expire_type", 1); // 默认值0到期失效的 scheme 码失效类型失效时间0失效间隔天数1
body.putOpt("is_expire", true);
//指定失效天数最多30
days = (days == null || days > 30) ? 30 : days;
body.putOpt("expire_interval", days);
body.putOpt("expire_interval", days); // 到期失效的 scheme 码的失效间隔天数生成的到期失效 scheme 码在该间隔时间到达前有效最长间隔天数为30天is_expire true expire_type 1 时必填
String post = HttpUtil.post(url, body.toJSONString(2));
log.info("jumpAppletSchemeUrl params:{}, result:{}", JSON.toJSONString(body), post);