diff --git a/modules/compconfigure.go b/modules/compconfigure.go index 262bd8ffc..dd92b9b05 100644 --- a/modules/compconfigure.go +++ b/modules/compconfigure.go @@ -22,7 +22,7 @@ type MCompConfigure struct { //组件初始化接口 func (this *MCompConfigure) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { - this.ModuleCompBase.Init(service, module, comp, options) + err = this.ModuleCompBase.Init(service, module, comp, options) this.S = service.(base.IRPCXService) this.M = module.(IModule) err = this.LoadConfigure(game_global, cfg.NewGame_global) diff --git a/modules/user/api_create.go b/modules/user/api_create.go index f05962790..da2d2da96 100644 --- a/modules/user/api_create.go +++ b/modules/user/api_create.go @@ -31,14 +31,15 @@ func (this *apiComp) Create(session comm.IUserSession, result map[string]interfa if self, ok := result["self"]; ok { v := self.(*pb.DBUser) - if v.Name != "" { + if v.Created { code = pb.ErrorCode_RoleCreated return } } update := map[string]interface{}{ - "name": req.NickName, + "name": req.NickName, + "created": true, } //设置初始金币 diff --git a/modules/user/configure.go b/modules/user/configure.go index d895376ef..cc8ac1c0b 100644 --- a/modules/user/configure.go +++ b/modules/user/configure.go @@ -11,6 +11,6 @@ type configureComp struct { //组件初始化接口 func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { - err = this.MCompConfigure.Init(service, module, comp, options) + err = this.ModuleCompBase.Init(service, module, comp, options) return } diff --git a/pb/proto/user/user_db.proto b/pb/proto/user/user_db.proto index 9833e2cb9..59afbbc7b 100644 --- a/pb/proto/user/user_db.proto +++ b/pb/proto/user/user_db.proto @@ -23,4 +23,5 @@ message DBUser { int32 avatar = 12; //@go_tags(`bson:"avatar"`) 头像 int32 gold = 13; //@go_tags(`bson:"gold"`) 金币 int32 exp = 14; //@go_tags(`bson:"exp"`) 经验 + bool created = 15; //@go_tags(`bson:"created"`) 创角 } \ No newline at end of file diff --git a/pb/user_db.pb.go b/pb/user_db.pb.go index f3214d987..4424d5ddb 100644 --- a/pb/user_db.pb.go +++ b/pb/user_db.pb.go @@ -102,6 +102,7 @@ type DBUser struct { Avatar int32 `protobuf:"varint,12,opt,name=avatar,proto3" json:"avatar" bson:"avatar"` //头像 Gold int32 `protobuf:"varint,13,opt,name=gold,proto3" json:"gold" bson:"gold"` //金币 Exp int32 `protobuf:"varint,14,opt,name=exp,proto3" json:"exp" bson:"exp"` //经验 + Created bool `protobuf:"varint,15,opt,name=created,proto3" json:"created" bson:"created"` //创角 } func (x *DBUser) Reset() { @@ -234,6 +235,13 @@ func (x *DBUser) GetExp() int32 { return 0 } +func (x *DBUser) GetCreated() bool { + if x != nil { + return x.Created + } + return false +} + var File_user_user_db_proto protoreflect.FileDescriptor var file_user_user_db_proto_rawDesc = []byte{ @@ -244,7 +252,7 @@ var file_user_user_db_proto_rawDesc = []byte{ 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x47, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x22, 0xd0, 0x02, + 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x22, 0xea, 0x02, 0x0a, 0x06, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, @@ -266,7 +274,9 @@ var file_user_user_db_proto_rawDesc = []byte{ 0x28, 0x05, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x6f, 0x6c, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x67, 0x6f, 0x6c, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x78, 0x70, - 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x18, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, + 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var (