Skip to content

Commit

Permalink
fix: 修复SteamStatusAPI 返回的价格
Browse files Browse the repository at this point in the history
  • Loading branch information
pysio2007 committed Jan 14, 2025
1 parent b3dc51a commit ff3452e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,20 @@ func SteamStatus(c *gin.Context) {
}
}

// 在 SteamStatus 函数中,修改价格处理逻辑
var priceStr string
if gameData.PriceOverview.Final == 0 {
priceStr = "免费"
} else {
priceStr = fmt.Sprintf("¥%.2f", float64(gameData.PriceOverview.Final)/100)
}

c.JSON(http.StatusOK, gin.H{
"status": "在游戏中",
"game": player.GameExtraInfo,
"game_id": player.GameID,
"description": gameData.ShortDescription,
"price": fmt.Sprintf("%.2f", float64(gameData.PriceOverview.Final)/100),
"price": priceStr,
"playtime": fmt.Sprintf("%d小时%d分钟", playtime/60, playtime%60),
"achievement_percentage": fmt.Sprintf("%.1f%%", achievementPercent),
})
Expand Down

0 comments on commit ff3452e

Please sign in to comment.