|
@@ -2,11 +2,13 @@ package com.fs.live.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.fs.common.core.redis.RedisCache;
|
|
import com.fs.common.utils.DateUtils;
|
|
import com.fs.common.utils.DateUtils;
|
|
import com.fs.live.domain.LiveWatchUser;
|
|
import com.fs.live.domain.LiveWatchUser;
|
|
import com.fs.live.mapper.LiveWatchUserMapper;
|
|
import com.fs.live.mapper.LiveWatchUserMapper;
|
|
import com.fs.live.service.ILiveWatchUserService;
|
|
import com.fs.live.service.ILiveWatchUserService;
|
|
import com.fs.live.vo.LiveWatchUserVO;
|
|
import com.fs.live.vo.LiveWatchUserVO;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -22,6 +24,9 @@ import java.util.Objects;
|
|
@Service
|
|
@Service
|
|
public class LiveWatchUserServiceImpl extends ServiceImpl<LiveWatchUserMapper, LiveWatchUser> implements ILiveWatchUserService {
|
|
public class LiveWatchUserServiceImpl extends ServiceImpl<LiveWatchUserMapper, LiveWatchUser> implements ILiveWatchUserService {
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private RedisCache redisCache;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询直播间观看用户
|
|
* 查询直播间观看用户
|
|
*
|
|
*
|
|
@@ -115,24 +120,30 @@ public class LiveWatchUserServiceImpl extends ServiceImpl<LiveWatchUserMapper, L
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void join(long liveId, long userId) {
|
|
|
|
|
|
+ public LiveWatchUser join(long liveId, long userId) {
|
|
LiveWatchUser liveWatchUser = getByLiveIdAndUserId(liveId, userId);
|
|
LiveWatchUser liveWatchUser = getByLiveIdAndUserId(liveId, userId);
|
|
if(liveWatchUser != null) {
|
|
if(liveWatchUser != null) {
|
|
liveWatchUser.setUpdateTime(DateUtils.getNowDate());
|
|
liveWatchUser.setUpdateTime(DateUtils.getNowDate());
|
|
liveWatchUser.setOnline(0);
|
|
liveWatchUser.setOnline(0);
|
|
|
|
+ liveWatchUser.setUpdateTime(DateUtils.getNowDate());
|
|
}else{
|
|
}else{
|
|
liveWatchUser = new LiveWatchUser();
|
|
liveWatchUser = new LiveWatchUser();
|
|
liveWatchUser.setLiveId(liveId);
|
|
liveWatchUser.setLiveId(liveId);
|
|
liveWatchUser.setUserId(userId);
|
|
liveWatchUser.setUserId(userId);
|
|
|
|
+ liveWatchUser.setMsgStatus(0);
|
|
|
|
+ liveWatchUser.setOnline(0);
|
|
|
|
+ liveWatchUser.setCreateTime(DateUtils.getNowDate());
|
|
}
|
|
}
|
|
super.saveOrUpdate(liveWatchUser);
|
|
super.saveOrUpdate(liveWatchUser);
|
|
|
|
+ return liveWatchUser;
|
|
}
|
|
}
|
|
@Override
|
|
@Override
|
|
- public void close(long liveId, long userId) {
|
|
|
|
|
|
+ public LiveWatchUser close(long liveId, long userId) {
|
|
LiveWatchUser liveWatchUser = getByLiveIdAndUserId(liveId, userId);
|
|
LiveWatchUser liveWatchUser = getByLiveIdAndUserId(liveId, userId);
|
|
liveWatchUser.setUpdateTime(DateUtils.getNowDate());
|
|
liveWatchUser.setUpdateTime(DateUtils.getNowDate());
|
|
liveWatchUser.setOnline(1);
|
|
liveWatchUser.setOnline(1);
|
|
super.updateById(liveWatchUser);
|
|
super.updateById(liveWatchUser);
|
|
|
|
+ return liveWatchUser;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|