diff --git a/go.mod b/go.mod index daf1be6cd..d3a36b9cb 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/modules/pack/api_comp.go b/modules/pack/api_comp.go index 85981792b..7de34f37a 100644 --- a/modules/pack/api_comp.go +++ b/modules/pack/api_comp.go @@ -1,4 +1,4 @@ -package login +package pack import ( "context" @@ -7,6 +7,7 @@ import ( "go_dreamfactory/pb" "go_dreamfactory/sys/cache" + "github.com/liwei1dao/lego/core" "github.com/liwei1dao/lego/sys/log" ) @@ -17,6 +18,13 @@ const ( type Api_Comp struct { modules.MComp_GateComp + module *Pack +} + +func (this *Api_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + this.MComp_GateComp.Init(service, module, comp, options) + this.module = module.(*Pack) + return } ///查询用户背包数据 diff --git a/modules/pack/configure_comp.go b/modules/pack/configure_comp.go new file mode 100644 index 000000000..cbdc1ec87 --- /dev/null +++ b/modules/pack/configure_comp.go @@ -0,0 +1,16 @@ +package pack + +import ( + "github.com/liwei1dao/lego/core" + "github.com/liwei1dao/lego/core/cbase" +) + +///背包配置管理组件 +type Configure_Comp struct { + cbase.ModuleCompBase +} + +func (this *Configure_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + this.ModuleCompBase.Init(service, module, comp, options) + return +} diff --git a/modules/pack/module.go b/modules/pack/module.go index 3b53638bb..614479cdb 100644 --- a/modules/pack/module.go +++ b/modules/pack/module.go @@ -1,4 +1,4 @@ -package login +package pack import ( "go_dreamfactory/comm" @@ -19,6 +19,8 @@ func NewModule() core.IModule { type Pack struct { modules.ModuleBase + api_comp *Api_Comp + configure_comp *Configure_Comp } func (this *Pack) GetType() core.M_Modules { @@ -27,4 +29,6 @@ func (this *Pack) GetType() core.M_Modules { func (this *Pack) OnInstallComp() { this.ModuleBase.OnInstallComp() + this.api_comp = this.RegisterComp(new(Api_Comp)).(*Api_Comp) + this.configure_comp = this.RegisterComp(new(Configure_Comp)).(*Configure_Comp) } diff --git a/modules/web/api_comp.go b/modules/web/api_comp.go index 2193112d4..ad4defd21 100644 --- a/modules/web/api_comp.go +++ b/modules/web/api_comp.go @@ -33,7 +33,7 @@ func (this *Api_Comp) Register(c *engine.Context) { rsp := &pb.UserRegisterRsp{} err := c.BindJSON(&req) if err == nil { - err := db.Defsys.CreateUser(&pb.DB_UserData{ + err := db.Defsys.User_CreateUser(&pb.DB_UserData{ Account: req.Account, }) if err != nil { diff --git a/services/worker/main.go b/services/worker/main.go index ebf9316f1..fda63a1c1 100644 --- a/services/worker/main.go +++ b/services/worker/main.go @@ -4,6 +4,7 @@ import ( "flag" "fmt" "go_dreamfactory/modules/login" + "go_dreamfactory/modules/pack" "go_dreamfactory/services" "go_dreamfactory/sys/cache" "go_dreamfactory/sys/db" @@ -30,6 +31,7 @@ func main() { lego.Run(s, //运行模块 // web.NewModule(), login.NewModule(), + pack.NewModule(), ) }