Pārlūkot izejas kodu

用户登录多账号问题

zjy 3 nedēļas atpakaļ
vecāks
revīzija
29de219abe

+ 1 - 13
alien-gateway/src/main/java/shop/alien/gateway/service/LifeUserService.java

@@ -156,7 +156,7 @@ public class LifeUserService extends ServiceImpl<LifeUserGatewayMapper, LifeUser
             lifeUserLog.setMacIp(macIp);
             lifeUserLog.setCreatedTime(new Date());
             // 将插入操作放到新事务中,确保立即提交
-            int count = insertLifeUserLogInNewTransaction(lifeUserLog);
+            int count = lifeUserLogMapper.insert(lifeUserLog);
             if (count > 0) {
                 String startDate = LocalDateTime.now().minusHours(24L).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
                 String endDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
@@ -179,18 +179,6 @@ public class LifeUserService extends ServiceImpl<LifeUserGatewayMapper, LifeUser
     }
 
     /**
-     * 在新事务中插入用户登录日志
-     * 使用 REQUIRES_NEW 确保插入操作立即提交,便于后续查询
-     *
-     * @param lifeUserLog 用户登录日志对象
-     * @return int 插入成功的记录数
-     */
-    @Transactional(propagation = Propagation.REQUIRES_NEW)
-    public int insertLifeUserLogInNewTransaction(LifeUserLog lifeUserLog) {
-        return lifeUserLogMapper.insert(lifeUserLog);
-    }
-
-    /**
      * 在新事务中查询指定时间段内的用户登录日志
      * 使用 REQUIRES_NEW 确保能读取到已提交的最新数据
      *