opti log info and fix file error created
This commit is contained in:
parent
8e38024d80
commit
ca17f15431
|
|
@ -2,6 +2,7 @@ package script
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
@ -187,6 +188,7 @@ func LoadLedgerAccountsMap() error {
|
||||||
// 账户按字母排序
|
// 账户按字母排序
|
||||||
sort.Sort(AccountSort(accounts))
|
sort.Sort(AccountSort(accounts))
|
||||||
ledgerAccountsMap[config.Id] = accounts
|
ledgerAccountsMap[config.Id] = accounts
|
||||||
|
LogSystemInfo(fmt.Sprintf("Success load [%s] accounts cache", config.Mail))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -207,7 +209,7 @@ func LoadLedgerAccountTypesMap(config Config) error {
|
||||||
ledgerAccountTypesMap = make(map[string]map[string]string)
|
ledgerAccountTypesMap = make(map[string]map[string]string)
|
||||||
}
|
}
|
||||||
ledgerAccountTypesMap[config.Id] = accountTypes
|
ledgerAccountTypesMap[config.Id] = accountTypes
|
||||||
LogSystemInfo("Success load ledger_config file (" + path + ")")
|
LogSystemInfo(fmt.Sprintf("Success load [%s] account type cache", config.Mail))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,12 +87,13 @@ func copyFile(sourceFilePath string, targetFilePath string, ledgerConfig script.
|
||||||
if fi.IsDir() {
|
if fi.IsDir() {
|
||||||
err = script.MkDir(newTargetFilePath)
|
err = script.MkDir(newTargetFilePath)
|
||||||
err = copyFile(newSourceFilePath, newTargetFilePath, ledgerConfig)
|
err = copyFile(newSourceFilePath, newTargetFilePath, ledgerConfig)
|
||||||
} else {
|
} else if !script.FileIfExist(newTargetFilePath) {
|
||||||
fileContent, err := script.ReadFile(newSourceFilePath)
|
fileContent, err := script.ReadFile(newSourceFilePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = script.WriteFile(newTargetFilePath, strings.ReplaceAll(strings.ReplaceAll(string(fileContent), "%startDate%", ledgerConfig.StartDate), "%operatingCurrency%", ledgerConfig.OperatingCurrency))
|
err = script.WriteFile(newTargetFilePath, strings.ReplaceAll(strings.ReplaceAll(string(fileContent), "%startDate%", ledgerConfig.StartDate), "%operatingCurrency%", ledgerConfig.OperatingCurrency))
|
||||||
|
script.LogInfo(ledgerConfig.Mail, "Success create file " + newTargetFilePath)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue