添加appsecret

This commit is contained in:
yangjun 2025-06-06 15:29:11 +08:00
parent 2704de678c
commit e96fc8cce0
5 changed files with 13 additions and 4 deletions

View File

@ -274,7 +274,6 @@ public class WechatPayController {
@PostMapping("/getUserInfo")
public JSONObject getWxUserInfo(@RequestBody Map<String,String> params) throws Exception {
// String accessToken = getToken(GET_TOKEN_URL, "wx8fc3e4305d2fbf0b", "3bf3dd4ec72f591432db6b28c2c044e5");// 获取token
String accessToken = params.get("access_token");
String openid = params.get("openid");
System.out.println("---------token-------"+accessToken);
@ -300,9 +299,9 @@ public class WechatPayController {
@PostMapping("/getJsApiInfo")
public static Map<String,String> getJsApiInfo(@RequestBody Map<String,String> params) throws Exception {
// String accessToken = getToken(GET_TOKEN_URL, "wx8fc3e4305d2fbf0b", "3bf3dd4ec72f591432db6b28c2c044e5");// 获取token
String accessToken = params.get("access_token");
public Map<String,String> getJsApiInfo(@RequestBody Map<String,String> params) throws Exception {
String accessToken = getToken(GET_TOKEN_URL, wechatpayConfig.getAppid(), wechatpayConfig.getAppsecret());// 获取token
// String accessToken = params.get("access_token");
System.out.println("---------token-------"+accessToken);
// 构造请求URL
String requestUrl = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + accessToken + "&type=jsapi";

View File

@ -33,6 +33,10 @@ public class WechatpayConfig {
@Value("${wxpay.notify-domain}")
private String notifyDomain;
// APPID
@Value("${wxpay.appsecret}")
private String appsecret;
}

View File

@ -395,6 +395,8 @@ wxpay:
api-v3-key: asdfiuzwe3534565478WETDSAFRWEq1E
# APPID
appid: wx8fc3e4305d2fbf0b
# appsecret
appsecret: 3bf3dd4ec72f591432db6b28c2c044e5
# 商户ID
mch-id: 1717618860
# 商户API证书序列号

View File

@ -391,6 +391,8 @@ wxpay:
api-v3-key: asdfiuzwe3534565478WETDSAFRWEq1E
# APPID
appid: wx8fc3e4305d2fbf0b
# appsecret
appsecret: 3bf3dd4ec72f591432db6b28c2c044e5
# 商户ID
mch-id: 1717618860
# 商户API证书序列号

View File

@ -389,6 +389,8 @@ wxpay:
api-v3-key: asdfiuzwe3534565478WETDSAFRWEq1E
# APPID
appid: wx8fc3e4305d2fbf0b
# appsecret
appsecret: 3bf3dd4ec72f591432db6b28c2c044e5
# 商户ID
mch-id: 1717618860
# 商户API证书序列号