使用服务端签名一直打不开扫描,改为前端签名后可以了。如下两图
IOS签名.png image.png服务端签名为
private String createSignature(Map<String, String> map) {
String noncestr = map.get("noncestr");
String url = map.get("url");
String timestamp = map.get("timestamp");
String jsapi_ticket = map.get("jsapi_ticket");
if (!StringUtils.isEmpty(jsapi_ticket) && !StringUtils.isEmpty(url)) {
StringBuffer sb = new StringBuffer();
sb.append("jsapi_ticket=" + jsapi_ticket);
sb.append("&noncestr=" + noncestr);
sb.append("×tamp=" + timestamp);
try {
url = URLDecoder.decode(url, "utf-8");
L.info("url=" + url);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
sb.append("&url=" + url);
L.info("sha1_str=" + sb.toString());
try {
return Sha1Util.shaEncode(sb.toString());
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
return "";
}
网友评论