|
@@ -18,6 +18,8 @@ import com.fs.live.vo.ColumnsConfigVo;
|
|
|
import com.fs.live.vo.DateRange;
|
|
import com.fs.live.vo.DateRange;
|
|
|
import com.fs.live.vo.RecentLiveDataVo;
|
|
import com.fs.live.vo.RecentLiveDataVo;
|
|
|
import com.fs.live.vo.TrendDataVO;
|
|
import com.fs.live.vo.TrendDataVO;
|
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -43,6 +45,7 @@ import static com.fs.common.constant.LiveKeysConstant.*;
|
|
|
public class LiveDataServiceImpl implements ILiveDataService {
|
|
public class LiveDataServiceImpl implements ILiveDataService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(LiveDataServiceImpl.class);
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private LiveDataMapper liveDataMapper;
|
|
private LiveDataMapper liveDataMapper;
|
|
|
private final RedisCache redisCache = SpringUtils.getBean(RedisCache.class);
|
|
private final RedisCache redisCache = SpringUtils.getBean(RedisCache.class);
|
|
@@ -436,7 +439,7 @@ public class LiveDataServiceImpl implements ILiveDataService {
|
|
|
//用户直播间第一次点赞
|
|
//用户直播间第一次点赞
|
|
|
if(firstLike) {
|
|
if(firstLike) {
|
|
|
//直播间总点赞数
|
|
//直播间总点赞数
|
|
|
- redisCache.increment("live:like:" + liveId,1);
|
|
|
|
|
|
|
+
|
|
|
liveUserLike = liveUserLikeService.selectLiveUserLikeByIds(liveId, userId);
|
|
liveUserLike = liveUserLikeService.selectLiveUserLikeByIds(liveId, userId);
|
|
|
if (liveUserLike == null) {
|
|
if (liveUserLike == null) {
|
|
|
liveUserLike = new LiveUserLike();
|
|
liveUserLike = new LiveUserLike();
|
|
@@ -450,8 +453,14 @@ public class LiveDataServiceImpl implements ILiveDataService {
|
|
|
//用户直播间点赞数
|
|
//用户直播间点赞数
|
|
|
redisCache.increment(key,1);
|
|
redisCache.increment(key,1);
|
|
|
//直播间总点赞数
|
|
//直播间总点赞数
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
redisCache.increment("live:like:" + liveId,1);
|
|
redisCache.increment("live:like:" + liveId,1);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error(e.getMessage());
|
|
|
|
|
+ redisCache.setCacheObject("live:like:" + liveId, 1L);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
return R.ok().put("like",redisCache.getCacheObject(key));
|
|
return R.ok().put("like",redisCache.getCacheObject(key));
|
|
|
}
|
|
}
|
|
|
|
|
|