andy 1 year ago
parent
commit
f8081d2140
1 changed files with 7 additions and 28 deletions
  1. 7 28
      src/main/java/com/scbfkj/uni/service/SecurityService.java

+ 7 - 28
src/main/java/com/scbfkj/uni/service/SecurityService.java

@@ -553,7 +553,6 @@ public class SecurityService {
 
     //应用API及数据权限
     public Map<String, Object> changePassword(Map<String, Object> requestData) throws Exception {
-        //       Todo
         Optional<String> oldPasswordOpt = getValue("oldpassword", requestData);
         Optional<String> passwordOpt = getValue("password", requestData);
         Map<String, Object> userInfo = RequestUtil.getUserInfo();
@@ -578,27 +577,15 @@ public class SecurityService {
 
         String userToken = RequestUtil.getUserToken();
         String sessionId = RequestUtil.getSessionId();
-        String query = """
-                select loginid,
-                       userid,
-                       requestip,
-                       sessionid,
-                       logintime,
-                       usertoken,
-                       lasttime,
-                       lastheartbeat,
-                       logouttime,
-                       apptoken,
-                       isexpires,
-                       appid,
-                       expirestime
-                from userloginlog
+        String updateSql = """
+                update  userloginlog set
+                       lastheartbeat = ?
                 where isexpires=0 and usertoken=? and sessionid=?""";
-        List<Map<String, Object>> userLoginLogList = DataBase.query(Config.getSecurityConnectionStr(), query, userToken, sessionId);
-        if (userLoginLogList.isEmpty()) {
-            return UniReturnUtil.fail("查询失败");
+        boolean updated = DataBase.update(Config.getSecurityConnectionStr(), updateSql, LocalDateTime.now(), userToken, sessionId);
+        if (updated) {
+            return UniReturnUtil.success("成功");
         } else {
-            return UniReturnUtil.success("查询成功");
+            return UniReturnUtil.fail("失败");
         }
     }
 
@@ -619,9 +606,6 @@ public class SecurityService {
     }
 
     public boolean check(String code, String sessionId, String appid, String requestIp) throws Exception {
-
-
-//        String selectSql = "select count(1) as result from tempsecuritycode where securitycode=? and sessionid=? and appid=? and requestip=?";
         String deleteSql = """
                                 delete
                 from tempsecuritycode
@@ -635,10 +619,5 @@ public class SecurityService {
 
     }
 
-    public void remove(String code, String sessionId, String appid, String requestIp) throws Exception {
-        String deleteSql = "delete from tempsecuritycode where securitycode=? and sessionid=? and appid=? and requestip=?";
-        DataBase.update(Config.getSecurityConnectionStr(), deleteSql, code, sessionId, appid, requestIp);
-
-    }
 
 }