-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
统一下单detail处理为"null"字符串,detail为空时,会造成签名签名错误 #73
Comments
已发布2.8.8 ,问题已修复 |
@jingdongWang92 你那边使用版本是最新的 2.8.8 吗 |
你可以尝试将 weixin-popular 在pom.xml 文件的依赖位置放到最前面,以避免其自身依赖的jar 包版本号不对。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
解决方案
weixin.popular.util.MapUtil
/**
* url 参数串连
* @param map map
* @param keyLower keyLower
* @param valueUrlencode valueUrlencode
* @return string
*/
public static String mapJoin(Map<String, String> map,boolean keyLower,boolean valueUrlencode){
StringBuilder stringBuilder = new StringBuilder();
for(String key :map.keySet()){
if(map.get(key)!=null&&!"".equals(map.get(key))&&!"null".equals(map.get(key))){
// if(map.get(key)!=null&&!"".equals(map.get(key))){
try {
String temp = (key.endsWith("_")&&key.length()>1)?key.substring(0,key.length()-1):key;
stringBuilder.append(keyLower?temp.toLowerCase():temp)
.append("=")
.append(valueUrlencode?URLEncoder.encode(map.get(key),"utf-8").replace("+", "%20"):map.get(key))
.append("&");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
if(stringBuilder.length()>0){
stringBuilder.deleteCharAt(stringBuilder.length()-1);
}
return stringBuilder.toString();
}
The text was updated successfully, but these errors were encountered: