Browse Source

fix:同步签到

zhangqin 1 month ago
parent
commit
4443f4fbdb

+ 6 - 10
fs-service-system/src/main/java/com/fs/live/service/impl/LiveRedConfServiceImpl.java

@@ -303,16 +303,12 @@ public class LiveRedConfServiceImpl implements ILiveRedConfService {
 
     @Override
     public void updateRedQuantityNum() {
-        Set<String> allLiveKeys = redisCache.redisTemplate.keys(REDPACKET_REMAININGLOTS_KEY + "*");
-        Optional.ofNullable(allLiveKeys)
-                .filter(CollUtil::isNotEmpty)
-                .ifPresent(keys -> keys
-                        .parallelStream()
-                        .map(key -> key.replace(REDPACKET_REMAININGLOTS_KEY, ""))
-                        .map(Long::valueOf)
-                        .map(baseMapper::selectLiveRedConfByRedId)
-                        .filter(Objects::nonNull)
-                        .forEach(this::updateDbByRed));
+        LiveRedConf redConf = new LiveRedConf();
+        redConf.setRedStatus(1L);
+        List<LiveRedConf> liveRedConfs = baseMapper.selectLiveRedConfList(redConf);
+        for (LiveRedConf liveRedConf : liveRedConfs) {
+            updateDbByRed(liveRedConf);
+        }
     }
 
     private void updateDbByRed(LiveRedConf red) {

+ 3 - 0
fs-service-system/src/main/resources/mapper/live/LiveDataMapper.xml

@@ -245,6 +245,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="totalViews != null">total_views = #{totalViews},</if>
             <if test="uniqueViewers != null">unique_viewers = #{uniqueViewers},</if>
             <if test="peakConcurrentViewers != null">peak_concurrent_viewers = #{peakConcurrentViewers},</if>
+            <if test="likes != null">likes = #{likes},</if>
+            <if test="favouriteNum != null">favourite_num = #{favouriteNum},</if>
+            <if test="followNum != null">follow_num = #{followNum},</if>
         </trim>
         where live_id = #{liveId}
     </update>