public static String getSignToken(Map<String, String> map,String key) {
String result = “”;
try {
List<Map.Entry<String, String>> infoIds = new ArrayList<Map.Entry<String, String>>(map.entrySet());
// 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序)
Collections.sort(infoIds, new Comparator<Map.Entry<String, String>>() {
public int compare(Map.Entry<String, String> o1, Map.Entry<String, String> o2) {
return (o1.getKey()).toString().compareTo(o2.getKey());
}
});
// 构造签名键值对的格式
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String> item : infoIds) {
if (item.getKey() != null || item.getKey() != “”) {
String val = item.getValue();
if (!(val == “” || val == null)) {
sb.append(val);
}
}
}
result = sb.
彩淘H5支付签名
最新推荐文章于 2022-06-09 18:02:18 发布