|
|
@@ -813,7 +813,6 @@ public class Task {
|
|
|
@DistributeLock(key = "scanLiveWatchUserStatus", scene = "task")
|
|
|
public void scanLiveWatchUserStatus() {
|
|
|
try {
|
|
|
-
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
// 查询所有正在直播的直播间
|
|
|
List<Live> activeLives = liveService.selectNoEndLiveList();
|
|
|
@@ -985,7 +984,7 @@ public class Task {
|
|
|
@DistributeLock(key = "updateLiveWatchUserStatus", scene = "task")
|
|
|
public void updateLiveWatchUserStatus() {
|
|
|
try {
|
|
|
- Set<String> keys = redisCache.redisTemplate.keys("live:user:watch:log");
|
|
|
+ Set<String> keys = redisCache.redisTemplate.keys("live:user:watch:log:*");
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
List<LiveWatchLog> updateLog = new ArrayList<>();
|
|
|
@@ -999,15 +998,15 @@ public class Task {
|
|
|
LocalDateTime cachedDateTime = LocalDateTime.parse(cacheTime, formatter);
|
|
|
// 比较时间,判断是否超过1分钟(60秒)
|
|
|
long secondsBetween = java.time.Duration.between(cachedDateTime, now).getSeconds();
|
|
|
- if (secondsBetween > 60) {
|
|
|
+ if (secondsBetween >= 60) {
|
|
|
// 距离上次记录已超过1分钟,更新状态为看课中断
|
|
|
// 查询 LiveWatchLog
|
|
|
LiveWatchLog queryLog = new LiveWatchLog();
|
|
|
- queryLog.setLiveId(Long.valueOf(split[0]));
|
|
|
- queryLog.setQwUserId(String.valueOf(split[3]));
|
|
|
- queryLog.setExternalContactId(Long.valueOf(split[2]));
|
|
|
+ queryLog.setLiveId(Long.valueOf(split[4]));
|
|
|
+ queryLog.setQwUserId(String.valueOf(split[7]));
|
|
|
+ queryLog.setExternalContactId(Long.valueOf(split[6]));
|
|
|
queryLog.setLogType(1);
|
|
|
- List<LiveWatchLog> logs = liveWatchLogService.selectLiveWatchLogByLogIdWithCache(queryLog);
|
|
|
+ List<LiveWatchLog> logs = liveWatchLogService.selectLiveWatchLogList(queryLog);
|
|
|
if (logs != null && !logs.isEmpty()) {
|
|
|
for (LiveWatchLog log : logs) {
|
|
|
if (log.getLogType() != null && log.getLogType() == 2) {
|