فهرست منبع

直播积分和在线时长计算分开

yuhongqi 2 روز پیش
والد
کامیت
f6df8465ae

+ 3 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsIntegralOrderServiceImpl.java

@@ -815,6 +815,7 @@ public class FsIntegralOrderServiceImpl implements IFsIntegralOrderService
             FsUser fsUser = fsUserMapper.selectFsUserByUserId(fsIntegralOrder.getUserId());
             fsUser.setIntegral(fsUser.getIntegral()+Long.parseLong(fsIntegralOrder.getIntegral()));
             i = fsUserMapper.updateFsUser(fsUser);
+            Date now = new Date();
             //新增积分记录
             FsUserIntegralLogs fsUserIntegralLogs = new FsUserIntegralLogs();
             fsUserIntegralLogs.setBalance(fsUser.getIntegral());
@@ -824,6 +825,8 @@ public class FsIntegralOrderServiceImpl implements IFsIntegralOrderService
             fsUserIntegralLogs.setIntegral(Long.parseLong(fsIntegralOrder.getIntegral()));
             fsUserIntegralLogs.setBusinessType(2);
             fsUserIntegralLogs.setStatus(0);
+            fsUserIntegralLogs.setCreateTime(now);
+            fsUserIntegralLogs.setUpdateTime(now);
             i = fsUserIntegralLogsMapper.insertFsUserIntegralLogs(fsUserIntegralLogs);
         }
         return i;

+ 2 - 7
fs-service/src/main/java/com/fs/live/service/impl/LiveCompletionPointsRecordServiceImpl.java

@@ -298,13 +298,8 @@ public class LiveCompletionPointsRecordServiceImpl implements ILiveCompletionPoi
             }
 
             // 3. 获取观看时长(如果为null,则从数据库累计直播+回放时长)
-
-            Long actualWatchDuration = liveWatchUserService.getTotalWatchDuration(liveId, userId);
-
-            if (actualWatchDuration == null || actualWatchDuration <= 0) {
-
-                return null;
-            }
+            // 4.这个时间和liveWatchUser分开算
+            long actualWatchDuration = 0L;
 
             // 4. 获取视频总时长(秒)
             Long videoDuration = live.getDuration();

+ 1 - 2
fs-user-app/src/main/java/com/fs/app/controller/live/LiveCompletionPointsController.java

@@ -250,8 +250,7 @@ public class LiveCompletionPointsController extends AppBaseController {
             // 6. 更新完课记录中的看课时长
             if (record == null) {
                 // 如果没有记录,先创建记录
-                completionPointsRecordService.checkAndCreateCompletionRecord(liveId, userId, finalWatchDuration);
-                record = completionPointsRecordMapper.selectLatestByUserAndLiveId(liveId, userId);
+                record = completionPointsRecordService.createCompletionRecord(liveId, userId);
             } else {
                 // 更新现有记录的看课时长
                 Long currentWatchDuration = record.getWatchDuration() != null