From 7c20e6d0471c87b4db45ee88d826d68e7c795554 Mon Sep 17 00:00:00 2001 From: CalciumIon <1808837298@qq.com> Date: Wed, 25 Dec 2024 14:26:43 +0800 Subject: [PATCH] fix: resolve pricing calculation issue (#659) --- controller/pricing.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/controller/pricing.go b/controller/pricing.go index 1b2eddce..cea24d7b 100644 --- a/controller/pricing.go +++ b/controller/pricing.go @@ -10,18 +10,16 @@ func GetPricing(c *gin.Context) { pricing := model.GetPricing() userId, exists := c.Get("id") usableGroup := map[string]string{} - groupRatio := common.GroupRatio + groupRatio := map[string]float64{} + for s, f := range common.GroupRatio { + groupRatio[s] = f + } var group string if exists { user, err := model.GetChannelById(userId.(int), false) - if err != nil { - c.JSON(200, gin.H{ - "success": false, - "message": err.Error(), - }) - return + if err == nil { + group = user.Group } - group = user.Group } usableGroup = common.GetUserUsableGroups(group)