add comments

This commit is contained in:
MaysWind
2020-12-24 09:00:39 +08:00
parent 543ed4c850
commit 14b8474192
10 changed files with 68 additions and 0 deletions
+4
View File
@@ -11,14 +11,18 @@ import (
"github.com/mayswind/lab/pkg/models"
)
// EuroCentralBankExchangeRateUrl represents euro central bank exchange rate date url
const EuroCentralBankExchangeRateUrl = "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"
// ExchangeRatesApi represents exchange rate api
type ExchangeRatesApi struct{}
// Initialize a exchange rate api singleton instance
var (
ExchangeRates = &ExchangeRatesApi{}
)
// LatestExchangeRateHandler returns latest exchange rate data
func (a *ExchangeRatesApi) LatestExchangeRateHandler(c *core.Context) (interface{}, *errs.Error) {
uid := c.GetCurrentUid()
resp, err := http.Get(EuroCentralBankExchangeRateUrl)