fix: resolve pricing calculation issue (#659)
Some checks failed
Publish Docker image (amd64) / Push Docker image to multiple registries (push) Has been cancelled
Publish Docker image (arm64) / Push Docker image to multiple registries (push) Has been cancelled
Linux Release / release (push) Has been cancelled
macOS Release / release (push) Has been cancelled
Windows Release / release (push) Has been cancelled

This commit is contained in:
CalciumIon 2024-12-25 14:26:43 +08:00
parent fe29ca04d5
commit f9e06342c6

View File

@ -10,18 +10,16 @@ func GetPricing(c *gin.Context) {
pricing := model.GetPricing() pricing := model.GetPricing()
userId, exists := c.Get("id") userId, exists := c.Get("id")
usableGroup := map[string]string{} usableGroup := map[string]string{}
groupRatio := common.GroupRatio groupRatio := map[string]float64{}
for s, f := range common.GroupRatio {
groupRatio[s] = f
}
var group string var group string
if exists { if exists {
user, err := model.GetChannelById(userId.(int), false) user, err := model.GetChannelById(userId.(int), false)
if err != nil { if err == nil {
c.JSON(200, gin.H{ group = user.Group
"success": false,
"message": err.Error(),
})
return
} }
group = user.Group
} }
usableGroup = common.GetUserUsableGroups(group) usableGroup = common.GetUserUsableGroups(group)