🐛 Fix setting post total upvote wrong

This commit is contained in:
LittleSheep 2024-12-17 21:07:26 +08:00
parent 34d166bec8
commit c31d390a0b

View File

@ -520,7 +520,7 @@ func ReactPost(user authm.Account, reaction models.Reaction) (bool, models.React
if reaction.Attitude == models.AttitudePositive { if reaction.Attitude == models.AttitudePositive {
op.TotalUpvote++ op.TotalUpvote++
database.C.Model(&op).Update("total_upvote", op.TotalDownvote) database.C.Model(&op).Update("total_upvote", op.TotalUpvote)
} else { } else {
op.TotalDownvote++ op.TotalDownvote++
database.C.Model(&op).Update("total_downvote", 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 { if reaction.Attitude == models.AttitudePositive {
op.TotalUpvote-- op.TotalUpvote--
database.C.Model(&op).Update("total_upvote", op.TotalDownvote) database.C.Model(&op).Update("total_upvote", op.TotalUpvote)
} else { } else {
op.TotalDownvote-- op.TotalDownvote--
database.C.Model(&op).Update("total_downvote", op.TotalDownvote) database.C.Model(&op).Update("total_downvote", op.TotalDownvote)