feat(exchange): add exchange rate handling and scheduled updates

This commit is contained in:
Chang lue Tsen
2025-10-15 10:05:19 -04:00
parent 8562734fde
commit adbe9a06d8
10 changed files with 84 additions and 47 deletions
@@ -347,6 +347,11 @@ func (l *PurchaseCheckoutLogic) queryExchangeRate(to string, src int64) (amount
// Convert cents to decimal amount
amount = float64(src) / float64(100)
if l.svcCtx.ExchangeRate != 0 && to == "CNY" {
amount = amount * l.svcCtx.ExchangeRate
return amount, nil
}
// Retrieve system currency configuration
currency, err := l.svcCtx.SystemModel.GetCurrencyConfig(l.ctx)
if err != nil {