From 45c7230e2d7c4053ce6f9272d2b2120b3bc0cc50 Mon Sep 17 00:00:00 2001 From: Hengyu Ai Date: Sun, 7 Apr 2024 23:42:50 +0800 Subject: [PATCH] fix: name consistency for "reward" --- pkg/models/reward.go | 2 +- pkg/models/user.go | 2 +- pkg/queries/reward.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/models/reward.go b/pkg/models/reward.go index 8807ac1..bf8ebe0 100644 --- a/pkg/models/reward.go +++ b/pkg/models/reward.go @@ -2,6 +2,6 @@ package models type RanklistResponse struct { NickName string `json:"nick_name"` - Rewards int `json:"reward"` + Reward int `json:"reward"` IsAnonymous bool `json:"is_anonymous"` } diff --git a/pkg/models/user.go b/pkg/models/user.go index 606b9f1..635e797 100644 --- a/pkg/models/user.go +++ b/pkg/models/user.go @@ -29,7 +29,7 @@ type User struct { IsAdmin bool `gorm:"default:false"` IsCommunityAdmin bool `gorm:"default:false"` InvitationCode string - Rewards int + Reward int } func init() { diff --git a/pkg/queries/reward.go b/pkg/queries/reward.go index 0a53cac..655c091 100644 --- a/pkg/queries/reward.go +++ b/pkg/queries/reward.go @@ -15,7 +15,7 @@ func Ranklist(db *gorm.DB) ([]models.RanklistResponse, error) { var ranklist []models.RanklistResponse result := db.Model(&models.User{}). - Select("nick_name", "rewards", "is_anonymous"). + Select("nick_name", "reward", "is_anonymous"). Order("rewards DESC"). Limit(30). Scan(&ranklist)