From 8c10138ecac504de9aeadd4fe43fdd71fd547821 Mon Sep 17 00:00:00 2001 From: Yiyang Tan Date: Tue, 9 Apr 2024 14:21:06 +0800 Subject: [PATCH] feat(queries.getprofile): add condition to get comment reward --- pkg/queries/user.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/queries/user.go b/pkg/queries/user.go index aa87db5..27a92bd 100644 --- a/pkg/queries/user.go +++ b/pkg/queries/user.go @@ -349,6 +349,10 @@ func GetProfile(db *gorm.DB, id uint, uid uint) (models.ProfileResponse, error) r := models.ProfileResponse{ID: id, Email: user.Email, Year: user.Year, Grade: user.Grade, NickName: user.NickName, RealName: user.RealName, IsAnonymous: user.IsAnonymous, Avatar: avatar, IsAdmin: user.IsAdmin, IsCommunityAdmin: user.IsCommunityAdmin, Reward: user.Reward} if id == uid { r.InvitationCode = user.InvitationCode + r.Reward = user.Reward + } + if user.IsAdmin || user.IsCommunityAdmin { + r.Reward = user.Reward } return r, nil }