同步历史版本代码

This commit is contained in:
2026-03-03 09:32:22 -08:00
parent 7d46b31866
commit 4d8516b2e1
140 changed files with 8399 additions and 489 deletions
+9 -12
View File
@@ -6,11 +6,10 @@ import (
"time"
"github.com/go-resty/resty/v2"
"github.com/perfect-panel/server/pkg/logger"
)
const (
Url = "https://api.apilayer.com"
Url = "https://api.exchangerate.host"
)
type Response struct {
@@ -38,20 +37,18 @@ func GetExchangeRete(form, to, access string, amount float64) (float64, error) {
amountStr := strconv.FormatFloat(amount, 'f', -1, 64)
client.SetQueryParams(map[string]string{
"from": form,
"to": to,
"amount": amountStr,
"from": form,
"to": to,
"amount": amountStr,
"access_key": access,
})
result := new(Response)
resp, err := client.R().SetHeader("apikey", access).SetResult(result).Get("/currency_data/convert")
resp := new(Response)
_, err := client.R().SetResult(resp).Get("/convert")
if err != nil {
return 0, err
}
if !result.Success {
logger.Info("Exchange Rate Response: ", resp.String())
if !resp.Success {
return 0, errors.New("exchange rate failed")
}
return result.Result, nil
return resp.Result, nil
}