diff --git a/.gitignore b/.gitignore index 9894f773a..4ae7dda1f 100644 --- a/.gitignore +++ b/.gitignore @@ -15,5 +15,7 @@ bin/conf .vscode ./bin/conf ./bin/log +./bin/gateway +./bin/worker ~$*.xlsx cmd/luban/ \ No newline at end of file diff --git a/linux-build.bat b/linux-build.bat new file mode 100644 index 000000000..3500766cc --- /dev/null +++ b/linux-build.bat @@ -0,0 +1,6 @@ +set GOOS=linux +set CGO_ENABLED=0 +del bin/gateway,bin/worker +go build -o bin/gateway services/gateway/main.go +go build -o bin/worker services/worker/main.go +REM pause \ No newline at end of file diff --git a/modules/web/user_comp.go b/modules/web/user_comp.go index 2aa55307d..62761271a 100644 --- a/modules/web/user_comp.go +++ b/modules/web/user_comp.go @@ -24,5 +24,6 @@ func (this *User_Comp) Login(ctx context.Context, session comm.IUserSession, rsp session.SendMsg("LogigResp", &pb.UserLoginResp{ Code: 200, }) + return nil } diff --git a/services/servicebase.go b/services/servicebase.go index 9fe4ae523..1da8b2afa 100644 --- a/services/servicebase.go +++ b/services/servicebase.go @@ -2,9 +2,7 @@ package services import ( "fmt" - "go_dreamfactory/sys/cache" "go_dreamfactory/sys/configure" - "go_dreamfactory/sys/db" "github.com/liwei1dao/lego/base/rpcx" "github.com/liwei1dao/lego/sys/log" @@ -16,16 +14,6 @@ type ServiceBase struct { func (this *ServiceBase) InitSys() { this.RPCXService.InitSys() - if err := cache.OnInit(this.GetSettings().Sys["cache"]); err != nil { - panic(fmt.Sprintf("init sys.cache err: %s", err.Error())) - } else { - log.Infof("init sys.cache success!") - } - if err := db.OnInit(this.GetSettings().Sys["db"]); err != nil { - panic(fmt.Sprintf("init sys.db err: %s", err.Error())) - } else { - log.Infof("init sys.db success!") - } if err := configure.OnInit(this.GetSettings().Sys["configure"]); err != nil { panic(fmt.Sprintf("init sys.configure err: %s", err.Error())) } else { diff --git a/services/worker/main.go b/services/worker/main.go index 99a9f51f2..71fe209aa 100644 --- a/services/worker/main.go +++ b/services/worker/main.go @@ -2,12 +2,16 @@ package main import ( "flag" + "fmt" "go_dreamfactory/modules/web" "go_dreamfactory/services" + "go_dreamfactory/sys/cache" + "go_dreamfactory/sys/db" "github.com/liwei1dao/lego" "github.com/liwei1dao/lego/base/rpcx" "github.com/liwei1dao/lego/core" + "github.com/liwei1dao/lego/sys/log" ) var ( @@ -41,4 +45,14 @@ type Service struct { func (this *Service) InitSys() { this.ServiceBase.InitSys() + if err := cache.OnInit(this.GetSettings().Sys["cache"]); err != nil { + panic(fmt.Sprintf("init sys.cache err: %s", err.Error())) + } else { + log.Infof("init sys.cache success!") + } + if err := db.OnInit(this.GetSettings().Sys["db"]); err != nil { + panic(fmt.Sprintf("init sys.db err: %s", err.Error())) + } else { + log.Infof("init sys.db success!") + } } diff --git a/sys/configure/configure.go b/sys/configure/configure.go index c2bb3ccbb..6a7342c02 100644 --- a/sys/configure/configure.go +++ b/sys/configure/configure.go @@ -147,6 +147,6 @@ func (this *Configure) loaderConfigure(name string, handle *configurehandle) (er } this.clock.Lock() this.configure[name] = returnValues[0].Interface() - this.clock.Lock() + this.clock.Unlock() return }