temp commit
This commit is contained in:
parent
19dae50c07
commit
e905eebf60
|
|
@ -270,7 +270,7 @@ func LoadLedgerAccountsMap() error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = LoadLedgerCurrencyMap(config)
|
||||
err = LoadLedgerCurrencyMap(&config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -408,7 +408,7 @@ func LoadServerCurrencyMap() {
|
|||
serverCurrencies = append(serverCurrencies, LedgerCurrency{Name: "俄罗斯卢布", Currency: "RUB", Symbol: "₽"})
|
||||
}
|
||||
|
||||
func LoadLedgerCurrencyMap(config Config) error {
|
||||
func LoadLedgerCurrencyMap(config *Config) error {
|
||||
LoadServerCurrencyMap()
|
||||
path := GetLedgerCurrenciesFilePath(config.DataPath)
|
||||
if !FileIfExist(path) {
|
||||
|
|
@ -443,7 +443,7 @@ func LoadLedgerCurrencyMap(config Config) error {
|
|||
ledgerCurrencyMap[config.Id] = currencies
|
||||
LogSystemInfo(fmt.Sprintf("Success load [%s] account type cache", config.Mail))
|
||||
// 刷新汇率
|
||||
RefreshLedgerCurrency(&config)
|
||||
RefreshLedgerCurrency(config)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ func RefreshAccountCache(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
// 加载货币缓存
|
||||
err = script.LoadLedgerCurrencyMap(*ledgerConfig)
|
||||
err = script.LoadLedgerCurrencyMap(ledgerConfig)
|
||||
if err != nil {
|
||||
InternalError(c, err.Error())
|
||||
return
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ func createNewLedger(loginForm LoginForm, ledgerId string) (*script.Config, erro
|
|||
return nil, err
|
||||
}
|
||||
// add currency cache
|
||||
err = script.LoadLedgerCurrencyMap(ledgerConfig)
|
||||
err = script.LoadLedgerCurrencyMap(&ledgerConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,5 +92,14 @@ func UpdateLedgerSourceFileContent(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
// 更新外币种源文件后,更新缓存
|
||||
if strings.Contains(updateSourceFileForm.Path, "currency.json") {
|
||||
err = script.LoadLedgerCurrencyMap(ledgerConfig)
|
||||
if err != nil {
|
||||
InternalError(c, err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
OK(c, nil)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,11 +69,12 @@ type AddTransactionForm struct {
|
|||
}
|
||||
|
||||
type AddTransactionEntryForm struct {
|
||||
Account string `form:"account" binding:"required" json:"account"`
|
||||
Number decimal.Decimal `form:"number" json:"number"`
|
||||
Currency string `form:"currency" json:"currency"`
|
||||
Price decimal.Decimal `form:"price" json:"price"`
|
||||
PriceCurrency string `form:"priceCurrency" json:"priceCurrency"`
|
||||
Account string `form:"account" binding:"required" json:"account"`
|
||||
Number decimal.Decimal `form:"number" json:"number,omitempty"`
|
||||
Currency string `form:"currency" json:"currency"`
|
||||
Price decimal.Decimal `form:"price" json:"price,omitempty"`
|
||||
PriceCurrency string `form:"priceCurrency" json:"priceCurrency,omitempty"`
|
||||
IsAnotherCurrency bool `form:"isAnotherCurrency" json:"isAnotherCurrency,omitempty"`
|
||||
}
|
||||
|
||||
func sum(entries []AddTransactionEntryForm, openingBalances string) decimal.Decimal {
|
||||
|
|
|
|||
Loading…
Reference in New Issue