Commit ebdc4af3 authored by 李德才's avatar 李德才

代码优化

parent a36b705e
...@@ -29,6 +29,9 @@ public class UserController extends Controller { ...@@ -29,6 +29,9 @@ public class UserController extends Controller {
@Inject @Inject
UserService userService; UserService userService;
private static final String _INFO = "_INFO";
/** /**
* 获取用户信息 * 获取用户信息
*/ */
...@@ -53,7 +56,7 @@ public class UserController extends Controller { ...@@ -53,7 +56,7 @@ public class UserController extends Controller {
return ; return ;
} }
try { try {
Redis.use().hset(username+ "_INFO", "password", password); Redis.use().hset(username+ _INFO, "password", password);
}catch (Exception e) { }catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -96,7 +99,7 @@ public class UserController extends Controller { ...@@ -96,7 +99,7 @@ public class UserController extends Controller {
userAttr = userIterator.next(); userAttr = userIterator.next();
userMap.put(userAttr.getKey().toString().trim().toLowerCase(), userAttr.getValue()); userMap.put(userAttr.getKey().toString().trim().toLowerCase(), userAttr.getValue());
} }
Redis.use().hmset(user.getUsername() + "_INFO", userMap); Redis.use().hmset(user.getUsername() + _INFO, userMap);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment