update gui

更新ui展示
This commit is contained in:
谢小军
2020-01-21 17:36:22 +08:00
parent b72a40e40e
commit bb224315a1
9 changed files with 106 additions and 5 deletions

View File

@@ -2,6 +2,8 @@ package config
import (
"fmt"
"github.com/xxjwxc/public/tools"
)
// Config custom config struct
@@ -76,6 +78,11 @@ func GetSimple() bool {
return _map.Simple
}
// SetSimple simple output.简单输出
func SetSimple(b bool) {
_map.Simple = b
}
// GetIsJSONTag json tag.json标记
func GetIsJSONTag() bool {
return _map.IsJSONTag
@@ -91,6 +98,11 @@ func SetForeignKey(b bool) {
_map.IsForeignKey = b
}
// SetIsOutSQL if is output sql .
func SetIsOutSQL(b bool) {
_map.IsOutSQL = b
}
// GetIsOutSQL if is output sql .
func GetIsOutSQL() bool {
return _map.IsOutSQL
@@ -133,7 +145,11 @@ func SetURLTag(s string) {
// GetLG get language tag.
func GetLG() string {
if _map.Language != "English" && _map.Language != "中 文" {
_map.Language = "English"
if tools.GetLocalSystemLang(true) == "en" {
_map.Language = "English"
} else {
_map.Language = "中 文"
}
}
return _map.Language

View File

@@ -6,7 +6,7 @@ import (
"github.com/xxjwxc/public/dev"
"github.com/xxjwxc/public/tools"
"gopkg.in/yaml.v2"
"gopkg.in/yaml.v3"
)
// CfgBase base config struct
@@ -65,3 +65,16 @@ func GetIsDev() bool {
func SetIsDev(b bool) {
_map.IsDev = b
}
// SaveToFile save config info to file
func SaveToFile() error {
d, err := yaml.Marshal(_map)
if err != nil {
return err
}
tools.WriteFile(tools.GetModelPath()+"/config.yml", []string{
string(d),
}, true)
return nil
}