String wechatTicket = getWechatTicket();
int i = url.indexOf("#");
if(-1!= i){
url = url.substring(0,i);
}
String timeStamp = Long.toString(System.currentTimeMillis() / 1000);
String nonceStr = RandomUtil.randomString(16);
String signStr = "jsapi_ticket=" + wechatTicket +
"&noncestr=" + nonceStr +
"×tamp=" + timeStamp +
"&url=" + url;
String sign = null;
try {
MessageDigest crypt = MessageDigest.getInstance("SHA-1");
crypt.reset();
crypt.update(signStr.getBytes("UTF-8"));
sign = byteToHex(crypt.digest());
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
签名代码
appId: "xxxxxx"
nonceStr: "wbj8l75kr0s69j4o"
sign: "ed3a17824389c336f3f6a501ac9aedc4f88bfef0"
signStr: "jsapi_ticket=kgt8ON7yVITDhtdwci0qeTlOub9XtTpCVcCr_e3nF7g-ibPnRe-_kQBA5CsDsXN8LZVp_bcF-UwT3wMhE3ZfRA&noncestr=wbj8l75kr0s69j4o×tamp=1624590305&url=http://blindbox.brandpano.com/index.html?activityId=tmtgqlagxo1"
timestamp: "1624590305"
wechatTicket: "kgt8ON7yVITDhtdwci0qeTlOub9XtTpCVcCr_e3nF7g-ibPnRe-_kQBA5CsDsXN8LZVp_bcF-UwT3wMhE3ZfRA"
是我哪里有问题吗签名过不了?
补充票据这块也是jsapi
所以怀疑是服务器设置问题
但服务器配置访问文件没有问题
而js安全域名配置上面也有贴图
找不到问题点