|
@@ -41,6 +41,9 @@ public class WxUrlLinkServiceImpl implements IWxUrlLinkService {
|
|
|
@Value("${cloud.public-bucket-name}")
|
|
|
private String publicBucketName;
|
|
|
|
|
|
+ @Value("${miniprogram.env_version}")
|
|
|
+ private String envVersion;
|
|
|
+
|
|
|
@Override
|
|
|
public String generate(String path, String query, String appId) {
|
|
|
Map<String, Object> param = new HashMap<String, Object>();
|
|
@@ -74,7 +77,7 @@ public class WxUrlLinkServiceImpl implements IWxUrlLinkService {
|
|
|
Map<String, Object> jumpParam = new HashMap<>();
|
|
|
jumpParam.put("path", path);
|
|
|
jumpParam.put("query", query);
|
|
|
- jumpParam.put("env_version", "release");
|
|
|
+ jumpParam.put("env_version", envVersion);
|
|
|
param.put("jump_wxa", jumpParam);
|
|
|
// 有效时间超过31天的 Link 或永久有效的 Link 为长期有效Link,
|
|
|
// 单个小程序总共可生成长期有效 Link 上限为10万个,请谨慎调用
|
|
@@ -87,8 +90,8 @@ public class WxUrlLinkServiceImpl implements IWxUrlLinkService {
|
|
|
String res = HttpUtils.sendPost(
|
|
|
"https://api.weixin.qq.com/wxa/generatescheme?access_token=" + accessToken,
|
|
|
JSON.toJSONString(param));
|
|
|
- LogUtil.info(logger, "小程序UrlSchema获取,path:{0},query:{1},res:{2}",
|
|
|
- new Object[]{path, query, res});
|
|
|
+ LogUtil.info(logger, "小程序UrlSchema获取,path:{0},query:{1},res:{2},jumpParam:{3}",
|
|
|
+ new Object[]{path, query, res, jumpParam});
|
|
|
JSONObject jsonObject = JSON.parseObject(res);
|
|
|
if (jsonObject.getIntValue("errcode") != 0) {
|
|
|
LogUtil.error(logger, "小程序UrlSchema获取错误,res:{0}", res);
|
|
@@ -103,7 +106,7 @@ public class WxUrlLinkServiceImpl implements IWxUrlLinkService {
|
|
|
param.put("path", path + "?" + scene); // 页面路径
|
|
|
//param.put("scene", scene); // 参数
|
|
|
// param.put("check_path", true);// 为 true 时 page 必须是已经发布的小程序存在的页面(否则报错);为 false 时允许小程序未发布或者 page 不存在
|
|
|
-// param.put("env_version", "release");
|
|
|
+// param.put("env_version", envVersion);
|
|
|
// 获取access_token
|
|
|
String accessToken = appTokenService.getAccessToken(appId);
|
|
|
InputStream in = HttpUtils.sendImagePost(
|
|
@@ -134,7 +137,7 @@ public class WxUrlLinkServiceImpl implements IWxUrlLinkService {
|
|
|
param.put("page", path); // 页面路径
|
|
|
param.put("scene", scene); // 参数
|
|
|
// param.put("check_path", true);// 为 true 时 page 必须是已经发布的小程序存在的页面(否则报错);为 false 时允许小程序未发布或者 page 不存在
|
|
|
- param.put("env_version", "release");
|
|
|
+ param.put("env_version", envVersion);
|
|
|
// 获取access_token
|
|
|
String accessToken = appTokenService.getAccessToken(appId);
|
|
|
InputStream in = HttpUtils.sendImagePost(
|