框架优化

This commit is contained in:
hoteas 2022-03-13 05:13:32 +08:00
parent b7c243823a
commit 17905c2d21
2 changed files with 9 additions and 7 deletions

View File

@ -68,6 +68,14 @@ func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
for _, v := range ColumnNameType {
that.RuleConfig = append(that.RuleConfig, Map{"name": v.Name, "list": v.List, "edit": v.Edit, "info": v.Info, "must": v.Must, "strict": v.Strict, "type": v.Type})
}
if db != nil {
_ = os.MkdirAll(filepath.Dir(config.GetString("rule")), os.ModeDir)
err = ioutil.WriteFile(config.GetString("rule"), []byte(ObjToStr(that.RuleConfig)), os.ModePerm)
if err != nil {
that.Error.SetError(err)
}
}
that.Error.SetError(errors.New("rule配置文件不存在或者配置出错使用缺省默认配置"))
}
@ -540,12 +548,6 @@ func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
}
}
_ = os.MkdirAll(filepath.Dir(config.GetString("rule")), os.ModeDir)
err = ioutil.WriteFile(config.GetString("rule"), []byte(ObjToStr(that.RuleConfig)), os.ModePerm)
if err != nil {
that.Error.SetError(err)
}
//写入配置文件
//err = json.Indent(&configByte, []byte(that.Config.ToJsonString()), "", "\t")
_ = os.MkdirAll(filepath.Dir(config.GetString("config")), os.ModeDir)

View File

@ -41,7 +41,7 @@
"5": "数据结果异常"
},
"imgPath": "img/2006/01/02/",
"mode": 0,
"mode": 2,
"port": "8081",
"sessionName": "HOTIME",
"smsKey": "b0eb4bf0198b9983cffcb85b69fdf4fa",