fix(purchase): update gift amount deduction logic and handle zero-amount order status

This commit is contained in:
Chang lue Tsen
2025-07-15 12:03:16 -04:00
committed by Leif Draven
parent 59348c1643
commit 40c24fbc85
3 changed files with 20 additions and 5 deletions
@@ -82,7 +82,7 @@ func (l *CloseOrderLogic) CloseOrder(req *types.CloseOrderRequest) error {
return err
}
deduction := userInfo.GiftAmount + orderInfo.GiftAmount
err = tx.Model(&user.User{}).Where("id = ?", orderInfo.UserId).Update("deduction", deduction).Error
err = tx.Model(&user.User{}).Where("id = ?", orderInfo.UserId).Update("gift_amount", deduction).Error
if err != nil {
l.Errorw("[CloseOrder] Refund deduction amount failed",
logger.Field("error", err.Error()),