From 831e3312572cf29dd91cbd882ef3dce809ac852d Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期三, 14 六月 2023 20:58:04 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/1.1' into 1.1
---
user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/weChat/WeChatUtil.java | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/weChat/WeChatUtil.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/weChat/WeChatUtil.java
index c23f490..70aeb6a 100644
--- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/weChat/WeChatUtil.java
+++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/weChat/WeChatUtil.java
@@ -412,4 +412,31 @@
String body1 = exchange.getBody();
return body1;
}
+
+
+
+
+ /**
+ * 获取小程序urllink码
+ * env_version 默认值"release"。要打开的小程序版本。正式版为 "release",体验版为"trial",开发版为"develop",仅在微信外打开时生效。
+ * @return
+ */
+ public String getUrlLink(String path, String query, String env_version) throws Exception{
+ String wxAppletsAccessToken = redisUtil.getValue("wxAppletsAccessToken");
+ String url = "https://api.weixin.qq.com/wxa/generate_urllink?access_token=" + wxAppletsAccessToken;
+ Map<String, Object> param = new HashMap<>();
+ param.put("path", path);
+ param.put("query", query);
+ param.put("is_expire", true);
+ param.put("expire_type", 0);
+ param.put("expire_time", System.currentTimeMillis() + 60 * 60 * 1000);
+ param.put("env_version", env_version);
+ HttpHeaders httpHeaders = new HttpHeaders();
+ MediaType type=MediaType.parseMediaType("application/json;charset=UTF-8");
+ httpHeaders.setContentType(type);
+ HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(param, httpHeaders);
+ ResponseEntity<String> exchange = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class);
+ String body1 = exchange.getBody();
+ return body1;
+ }
}
--
Gitblit v1.7.1