参数 username 和 password 居然时有时无:
情况一:username 取到的值是 null,password 取的值是 username 的值
@At
@Aop("redis")
@Ok("json:{locked:'password',nullAsEmtry:true,compact:true}")
public Map<String, Object> bind(String username, String password,
HttpServletResponse response) {
String respText = AccountService.bindAccount(username, password);
Map<String, Object> respMap = Json.fromJsonAsMap(Object.class, respText);
if ((Integer) respMap.get("code") == 0) {
String token = R.UU32();
jedis().hset(token, "username", username);
jedis().hset(token, "password", password);
response.setHeader("Authorization", new BASE64Encoder().encode(Strings.getBytesUTF8(token)));
}
return respMap;
}
情况二:正常
@At
@Aop("redis")
@Ok("json:{locked:'password',nullAsEmtry:true,compact:true}")
public Map<String, Object> bind(String username, String password,
HttpServletResponse response) {
String respText = AccountService.bindAccount(username, password);
Map<String, Object> respMap = Json.fromJsonAsMap(Object.class, respText);
/* if ((Integer) respMap.get("code") == 0) {
String token = R.UU32();
jedis().hset(token, "username", username);
jedis().hset(token, "password", password);
response.setHeader("Authorization", new BASE64Encoder().encode(Strings.getBytesUTF8(token)));
}*/
return respMap;
}
情况三:正常
@At
@Aop("redis")
@Ok("json:{locked:'password',nullAsEmtry:true,compact:true}")
public Map<String, Object> bind(@Param("username") String username, @Param("password") String password,
HttpServletResponse response) {
String respText = AccountService.bindAccount(username, password);
Map<String, Object> respMap = Json.fromJsonAsMap(Object.class, respText);
if ((Integer) respMap.get("code") == 0) {
String token = R.UU32();
jedis().hset(token, "username", username);
jedis().hset(token, "password", password);
response.setHeader("Authorization", new BASE64Encoder().encode(Strings.getBytesUTF8(token)));
}
return respMap;
}