修改认证接口,添加参数

This commit is contained in:
yangjun 2025-06-09 09:57:44 +08:00
parent e96fc8cce0
commit 6961070fe8
1 changed files with 5 additions and 1 deletions

View File

@ -301,7 +301,8 @@ public class WechatPayController {
@PostMapping("/getJsApiInfo")
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");
String firstUrl = params.get("url");
System.out.println("---------firstUrl-------"+firstUrl);
System.out.println("---------token-------"+accessToken);
// 构造请求URL
String requestUrl = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + accessToken + "&type=jsapi";
@ -327,6 +328,8 @@ public class WechatPayController {
.append(nonceStr)
.append("&timestamp=")
.append(timestamp)
.append("&url=")
.append(firstUrl)
.toString();// 得到签名
String signature = encryptSHA(string1);
@ -334,6 +337,7 @@ public class WechatPayController {
map.put("signature", signature);
map.put("timestamp", timestamp);
map.put("nonceStr", nonceStr);
map.put("firstUrl", firstUrl);
System.out.println("---------jsonObject-------"+signature);
return map;