From c31d390a0b4e00d780c8d894bd474cb7b14c4795 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 17 Dec 2024 21:07:26 +0800 Subject: [PATCH] :bug: Fix setting post total upvote wrong --- pkg/internal/services/posts.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/internal/services/posts.go b/pkg/internal/services/posts.go index 15c2643..76c11d3 100644 --- a/pkg/internal/services/posts.go +++ b/pkg/internal/services/posts.go @@ -520,7 +520,7 @@ func ReactPost(user authm.Account, reaction models.Reaction) (bool, models.React if reaction.Attitude == models.AttitudePositive { op.TotalUpvote++ - database.C.Model(&op).Update("total_upvote", op.TotalDownvote) + database.C.Model(&op).Update("total_upvote", op.TotalUpvote) } else { op.TotalDownvote++ database.C.Model(&op).Update("total_downvote", op.TotalDownvote) @@ -538,7 +538,7 @@ func ReactPost(user authm.Account, reaction models.Reaction) (bool, models.React if reaction.Attitude == models.AttitudePositive { op.TotalUpvote-- - database.C.Model(&op).Update("total_upvote", op.TotalDownvote) + database.C.Model(&op).Update("total_upvote", op.TotalUpvote) } else { op.TotalDownvote-- database.C.Model(&op).Update("total_downvote", op.TotalDownvote)