|
|
@@ -40,6 +40,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
import static com.fs.common.constant.LiveKeysConstant.*;
|
|
|
import static com.fs.common.constant.LiveKeysConstant.LIVE_COUPON_NUM;
|
|
|
+import static com.fs.live.websocket.service.WebSocketServer.USER_ENTRY_TIME_KEY;
|
|
|
|
|
|
@Component
|
|
|
@AllArgsConstructor
|
|
|
@@ -819,7 +820,6 @@ public class Task {
|
|
|
if (activeLives == null || activeLives.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
for (Live live : activeLives) {
|
|
|
try {
|
|
|
Long liveId = live.getLiveId();
|
|
|
@@ -862,18 +862,22 @@ public class Task {
|
|
|
}
|
|
|
|
|
|
// 获取用户的在线观看时长
|
|
|
+ String entryTimeKey = String.format(USER_ENTRY_TIME_KEY, liveId, userId);
|
|
|
+ Long existingEntryTime = redisCache.getCacheObject(entryTimeKey);
|
|
|
Long onlineSeconds = user.getOnlineSeconds();
|
|
|
+ if((onlineSeconds == null || onlineSeconds <= 0) && null != existingEntryTime){
|
|
|
+ onlineSeconds = (System.currentTimeMillis() - existingEntryTime)/1000;
|
|
|
+ }
|
|
|
if (onlineSeconds == null || onlineSeconds <= 0) {
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
// 获取用户的 companyId 和 companyUserId
|
|
|
LiveUserFirstEntry liveUserFirstEntry =
|
|
|
liveUserFirstEntryService.selectEntityByLiveIdUserIdWithCache(liveId, userId);
|
|
|
if (liveUserFirstEntry == null) {
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
Long qwUserId = liveUserFirstEntry.getQwUserId();
|
|
|
Long externalContactId = liveUserFirstEntry.getExternalContactId();
|
|
|
|