chore: build
This commit is contained in:
@@ -192,17 +192,18 @@ func ClaimMyReward(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Ajouter le produit récompense au panier si configuré
|
||||
// Ajouter les produits récompense au panier si configurés
|
||||
productAdded := false
|
||||
var productName string
|
||||
if reward.RewardProductID > 0 && reward.RewardQuantity > 0 {
|
||||
qty := reward.RewardQuantity
|
||||
if item, addErr := database.AddRewardToBasket(username, reward.RewardProductID, qty, req.PoolKey); addErr == nil {
|
||||
var productNames []string
|
||||
if len(reward.RewardItems) > 0 {
|
||||
if added, addErr := database.AddRewardsToBasket(username, reward.RewardItems, req.PoolKey); addErr == nil && len(added) > 0 {
|
||||
productAdded = true
|
||||
productName = item.ProductName
|
||||
log.Printf("✅ [CLAIM] Produit récompense id=%d (%.2f) ajouté au panier de %s", reward.RewardProductID, qty, username)
|
||||
} else {
|
||||
log.Printf("⚠️ [CLAIM] Impossible d'ajouter produit récompense: %v", addErr)
|
||||
for _, item := range added {
|
||||
productNames = append(productNames, item.ProductName)
|
||||
}
|
||||
log.Printf("✅ [CLAIM] %d produit(s) récompense ajoutés au panier de %s", len(added), username)
|
||||
} else if addErr != nil {
|
||||
log.Printf("⚠️ [CLAIM] Impossible d'ajouter produits récompense: %v", addErr)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +212,7 @@ func ClaimMyReward(c *gin.Context) {
|
||||
"description": reward.Description,
|
||||
"remaining_rewards": remaining,
|
||||
"product_added": productAdded,
|
||||
"product_name": productName,
|
||||
"product_names": productNames,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user