Kaynağa Gözat

fix:bug修改

pigflower 1 ay önce
ebeveyn
işleme
f686cb8a6b
1 değiştirilmiş dosya ile 8 ekleme ve 6 silme
  1. 8 6
      script/module/zhuanpan/ZhuanpanLogic.lua

+ 8 - 6
script/module/zhuanpan/ZhuanpanLogic.lua

@@ -1729,8 +1729,10 @@ local function updateDailyCount(field, newCount)
 	field = field or {}
 	local now = os.time()
 	if field.dayTime and Util.isSameDay(field.dayTime) then
-		-- 同一天:覆盖为最新上报值;weekTotal 不动(不含今天)
-		field.count = newCount
+		-- 同一天:仅在 newCount > 0 时更新;weekTotal 不动(不含今天)
+		if newCount > 0 then
+			field.count = newCount
+		end
 	else
 		-- 新的一天:把昨天的 count 累加到本周合计,重置今天的记录
 		local weekTotal = field.weekTotal or 0
@@ -1780,12 +1782,12 @@ function youxiTaskQuery(human, msg)
 		if msg.joinTime and msg.joinTime > 0 and not yt.joined then
 			yt.joined = true
 		end
-		-- 任务2/4:点赞
-		if msg.likeCount and msg.likeCount > 0 then
+		-- 任务2/4:点赞(count=0 时也需调用,以便跨天时将昨日 count 累入 weekTotal)
+		if msg.likeCount ~= nil then
 			yt.dailyLike = updateDailyCount(yt.dailyLike, msg.likeCount)
 		end
-		-- 任务3/5:评论
-		if msg.commentCount and msg.commentCount > 0 then
+		-- 任务3/5:评论(同上)
+		if msg.commentCount ~= nil then
 			yt.dailyComment = updateDailyCount(yt.dailyComment, msg.commentCount)
 		end
 	end