|
|
@@ -1099,6 +1099,11 @@ public class WebSocketServer {
|
|
|
}
|
|
|
|
|
|
public void sendIntegralMessage(Long liveId, Long userId, Long scoreAmount, LiveConsoleOpLog opLog) {
|
|
|
+ Live live = liveService.selectLiveByLiveId(liveId);
|
|
|
+ if (com.fs.live.utils.LiveCompletionConfigUtils.isLiveEndedForRewardPush(live)) {
|
|
|
+ log.info("[看课奖励] 直播已结束,跳过积分 WebSocket 推送, liveId={}, userId={}", liveId, userId);
|
|
|
+ return;
|
|
|
+ }
|
|
|
ConcurrentHashMap<Long, Session> room = getRoom(liveId);
|
|
|
Session session = room.get(userId);
|
|
|
if (session == null || !session.isOpen()) {
|
|
|
@@ -1121,6 +1126,11 @@ public class WebSocketServer {
|
|
|
* 发送完课积分弹窗通知给特定用户
|
|
|
*/
|
|
|
public void sendCompletionPointsMessage(Long liveId, Long userId, SendMsgVo sendMsgVo) {
|
|
|
+ Live live = liveService.selectLiveByLiveId(liveId);
|
|
|
+ if (com.fs.live.utils.LiveCompletionConfigUtils.isLiveEndedForRewardPush(live)) {
|
|
|
+ log.info("[完课积分] 直播已结束,跳过 WebSocket 推送, liveId={}, userId={}", liveId, userId);
|
|
|
+ return;
|
|
|
+ }
|
|
|
ConcurrentHashMap<Long, Session> room = getRoom(liveId);
|
|
|
Session session = room.get(userId);
|
|
|
if (session == null || !session.isOpen()) {
|
|
|
@@ -1138,6 +1148,11 @@ public class WebSocketServer {
|
|
|
* @return 是否推送成功(用户在线且发送成功)
|
|
|
*/
|
|
|
public boolean sendCompletionCouponQuestionMessage(Long liveId, Long userId, SendMsgVo sendMsgVo) {
|
|
|
+ Live live = liveService.selectLiveByLiveId(liveId);
|
|
|
+ if (com.fs.live.utils.LiveCompletionConfigUtils.isLiveEndedForRewardPush(live)) {
|
|
|
+ log.info("[完课优惠券] 直播已结束,跳过 WebSocket 推送, liveId={}, userId={}", liveId, userId);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
ConcurrentHashMap<Long, Session> room = getRoom(liveId);
|
|
|
Session session = room.get(userId);
|
|
|
if (session == null || !session.isOpen()) {
|
|
|
@@ -1882,11 +1897,19 @@ public class WebSocketServer {
|
|
|
return;
|
|
|
}
|
|
|
try {
|
|
|
+ Live live = liveService.selectLiveByLiveId(liveId);
|
|
|
+ // 直播已结束:心跳不再推送完课奖励 WebSocket,避免结束后仍可领取
|
|
|
+ if (com.fs.live.utils.LiveCompletionConfigUtils.isLiveEndedForRewardPush(live)) {
|
|
|
+ log.info("[完课心跳检查] 直播已结束,跳过推送, liveId={}, userId={}, status={}, finishTime={}",
|
|
|
+ liveId, userId,
|
|
|
+ live != null ? live.getStatus() : null,
|
|
|
+ live != null ? live.getFinishTime() : null);
|
|
|
+ return;
|
|
|
+ }
|
|
|
Long duration = liveWatchUserService.getUserWatchDuration(liveId, userId);
|
|
|
if (duration == null || duration <= 0) {
|
|
|
return;
|
|
|
}
|
|
|
- Live live = liveService.selectLiveByLiveId(liveId);
|
|
|
String configJson = live != null ? live.getConfigJson() : null;
|
|
|
// 完课积分:独立判定,写完课积分留存
|
|
|
if (com.fs.live.utils.LiveCompletionConfigUtils.isCompletionPointsMode(configJson)) {
|
|
|
@@ -1911,6 +1934,11 @@ public class WebSocketServer {
|
|
|
*/
|
|
|
private void checkAndSendCompletionPointsInRealTime(long liveId, long userId, Long duration) {
|
|
|
try {
|
|
|
+ Live live = liveService.selectLiveByLiveId(liveId);
|
|
|
+ if (com.fs.live.utils.LiveCompletionConfigUtils.isLiveEndedForRewardPush(live)) {
|
|
|
+ log.info("[实时完课推送] 直播已结束,跳过 WebSocket, liveId={}, userId={}", liveId, userId);
|
|
|
+ return;
|
|
|
+ }
|
|
|
log.debug("[实时完课检查] liveId={}, userId={}, duration={}秒", liveId, userId, duration);
|
|
|
|
|
|
// 1. 调用完课记录服务检查并创建完课记录
|