修复currentUserid类型为String会报错的bug

This commit is contained in:
redkale
2023-10-09 12:22:10 +08:00
parent c66aafe7fe
commit bf4920de93
2 changed files with 16 additions and 1 deletions

View File

@@ -1219,6 +1219,21 @@ public class HttpRequest extends Request<HttpContext> {
return uid.isEmpty() ? 0L : Long.parseLong(uid);
}
/**
* 获取当前用户ID的String值<br>
*
* @return 用户ID
*
* @since 2.8.0
*/
@SuppressWarnings("unchecked")
public String currentStringUserid() {
if (currentUserid == CURRUSERID_NIL || currentUserid == null) {
return null;
}
return this.currentUserid.toString();
}
/**
* 获取当前用户ID<br>
*

View File

@@ -2521,7 +2521,7 @@ public final class Rest {
} else if (ptype == long.class) {
mv.visitFieldInsn(GETSTATIC, "java/lang/Long", "TYPE", "Ljava/lang/Class;");
} else {
mv.visitLdcInsn(Type.getType(Type.getInternalName(ptype)));
mv.visitLdcInsn(Type.getType(Type.getDescriptor(ptype)));
}
mv.visitMethodInsn(INVOKEVIRTUAL, reqInternalName, "currentUserid", "(Ljava/lang/Class;)Ljava/io/Serializable;", false);
if (ptype == int.class) {