上传背包系统代码

This commit is contained in:
liwei1dao 2022-06-06 17:35:15 +08:00
parent 1cdf4b29df
commit 3e39b41446
6 changed files with 34 additions and 4 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

@ -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
}
///查询用户背包数据

View File

@ -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
}

View File

@ -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)
}

View File

@ -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 {

View File

@ -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(),
)
}