读取配置文件

This commit is contained in:
meixiongfeng 2022-06-06 15:58:03 +08:00
parent 750c7756b0
commit 5e0724c795
2 changed files with 23 additions and 1 deletions

2
go.mod
View File

@ -8,6 +8,7 @@ require (
github.com/json-iterator/go v1.1.12
github.com/liwei1dao/lego v0.0.0-20220531091126-a21bb3766fbc
github.com/spf13/cobra v1.2.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.1
go.mongodb.org/mongo-driver v1.5.1
google.golang.org/protobuf v1.28.0
@ -95,7 +96,6 @@ require (
github.com/smallnest/quick v0.0.0-20220103065406-780def6371e6 // indirect
github.com/smallnest/rpcx v1.7.4 // indirect
github.com/soheilhy/cmux v0.1.5 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 // indirect
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b // indirect
github.com/tinylib/msgp v1.1.6 // indirect

View File

@ -3,8 +3,11 @@ package login
import (
"go_dreamfactory/comm"
"go_dreamfactory/modules"
"go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
"github.com/liwei1dao/lego/core"
"github.com/liwei1dao/lego/sys/log"
)
func NewModule() core.IModule {
@ -25,3 +28,22 @@ func (this *Login) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.user_comp = this.RegisterComp(new(LoginComp)).(*LoginComp)
}
func (this *Login) Start() (err error) {
if err = configure.RegisterConfigure("tbitem.json", cfg.NewTbItem); err != nil {
return
}
if data, ret := configure.GetConfigure("tbitem.json"); ret == nil {
_data := data.(*cfg.TbItem).GetDataMap()
for _, v := range _data {
if v.Id > 0 {
break
}
log.Debugf(v.Name)
}
}
return nil
}