Commit 7df66a69 authored by Quxl's avatar Quxl

x

parent 16ed0cd0
......@@ -33,7 +33,7 @@ public interface MemberService {
Fc_member getMemberByToken(String token);
void updateToken(Integer member_id, String token_string);
void updateLoginInfo(Integer member_id, String login_ip, String token_string);
void updateLanguage(Integer id, String string);
......
......@@ -45,8 +45,9 @@ public class AdminTokenServiceImpl implements AdminTokenService {
session.setAttribute(TOKEN_NAME, token);
Cookie cookie = WebMvcConfig.getOrCreateUUIDCookie(LOGINID_COOKIE_NAME, "/", 60*60*24, true);
if(cookie != null) {
String sql = "update fc_admin set token = ? where adminid = ?";
jdbcTemplate.executeUpdate(sql, cookie.getValue(), adminid);
String sql = "update fc_admin set token = ?, login_ip, login_time where adminid = ?";
String loginIp = ServletUtil.remoteIp(WebMvcConfig.getRequest());
jdbcTemplate.executeUpdate(sql, cookie.getValue(), loginIp, System.currentTimeMillis()/1000, adminid);
}
return token;
} else if(state == 2) {
......
......@@ -104,9 +104,9 @@ public class MemberServiceImpl implements MemberService {
}
@Override
public void updateToken(Integer member_id, String token_string) {
String sql = "update fc_member set token = ? where id = ?";
jdbcTemplate.executeUpdate(sql, token_string, member_id);
public void updateLoginInfo(Integer member_id, String login_ip, String token_string) {
String sql = "update fc_member set token = ?, login_time = ?, login_ip = ? where id = ?";
jdbcTemplate.executeUpdate(sql, token_string, System.currentTimeMillis()/1000, login_ip, member_id);
}
@Override
......
......@@ -53,7 +53,8 @@ public class MemberTokenServiceImpl implements MemberTokenService {
session.setAttribute(TOKEN_NAME, token);
Cookie cookie = WebMvcConfig.getOrCreateUUIDCookie(LOGINID_COOKIE_NAME, "/", 60*60, true);
if(cookie != null) {
memberService.updateToken(id, cookie.getValue());
String loginIp = ServletUtil.remoteIp(WebMvcConfig.getRequest());
memberService.updateLoginInfo(id, loginIp, cookie.getValue());
}
return token;
} else {
......
......@@ -49,7 +49,9 @@ public class UserTokenServiceImpl implements UserTokenService {
session.setAttribute(TOKEN_NAME, token);
Cookie cookie = WebMvcConfig.getOrCreateUUIDCookie(LOGINID_COOKIE_NAME, "/", 60*60*24, true);
if(cookie != null) {
jdbcTemplate.executeUpdate("update fc_user set token = ? where uid = ?", cookie.getValue(), uid);
String sql = "update fc_user set token = ?, login_ip = ?, login_time = ? where uid = ?";
String loginIp = ServletUtil.remoteIp(WebMvcConfig.getRequest());
jdbcTemplate.executeUpdate(sql, cookie.getValue(), loginIp, System.currentTimeMillis()/1000, uid);
}
return token;
} else {
......
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