add refresh account api

This commit is contained in:
BaoXuebin 2021-12-14 22:09:17 +08:00
parent d97a9050e9
commit 037234e5cc
2 changed files with 12 additions and 0 deletions

View File

@ -66,6 +66,7 @@ func RegisterRouter(router *gin.Engine) {
authorized.POST("/account/close", service.CloseAccount)
authorized.POST("/account/icon", service.ChangeAccountIcon)
authorized.POST("/account/balance", service.BalanceAccount)
authorized.POST("/account/refresh", service.RefreshAccountCache)
authorized.POST("/commodity/price", service.SyncCommodityPrice)
authorized.GET("/stats/months", service.MonthsList)
authorized.GET("/stats/total", service.StatsTotal)

View File

@ -253,3 +253,14 @@ func BalanceAccount(c *gin.Context) {
result["marketCurrencySymbol"] = script.GetCommoditySymbol(ledgerConfig.OperatingCurrency)
OK(c, result)
}
func RefreshAccountCache(c *gin.Context) {
ledgerConfig := script.GetLedgerConfigFromContext(c)
// 加载账户缓存
err := script.LoadLedgerAccounts(ledgerConfig.Id)
if err != nil {
InternalError(c, err.Error())
return
}
OK(c, nil)
}