| | |
| | | import com.yeshi.buwan.dto.statistic.video.VideoDetailStatisticData; |
| | | import com.yeshi.buwan.util.RedisManager; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | */ |
| | | @Component |
| | | public class VideoPlayStatisticManager { |
| | | |
| | | Logger sessionLogger = LoggerFactory.getLogger("session"); |
| | | |
| | | |
| | | @Resource |
| | |
| | | } |
| | | |
| | | |
| | | public void consumeVideoDetailSession(String sessionId) { |
| | | public void consumeVideoDetailSession(String sessionId, String type) { |
| | | String key = "session-" + sessionId; |
| | | VideoDetailStatisticData data = (VideoDetailStatisticData) redisManager.getDataFromRedis(key); |
| | | redisManager.remove(key); |
| | | //TODO 做日志记录 |
| | | if (data != null) { |
| | | |
| | | String st = String.format("%s#%s#%s", type, (System.currentTimeMillis() - data.getCreateTime()), data.toString()); |
| | | sessionLogger.info(st); |
| | | } |
| | | |
| | | } |
| | | |
| | | |