diff --git a/bin/conf/gateway_1.yaml b/bin/conf/gateway_1.yaml index ab732c059..b6c5eebdb 100644 --- a/bin/conf/gateway_1.yaml +++ b/bin/conf/gateway_1.yaml @@ -13,6 +13,7 @@ sys: Loglevel: 0 #日志文件输出级别 LogMaxSize: 128 #日志文件最大Size LogMaxAge: 7 #日志文件最多保留天数 + Debugmode: true registry: #注册表系统 服务发现 RegistryType: 0 #服务发现系统 0 Consul 组件 Consul_Addr: "10.0.0.9:8500" diff --git a/bin/conf/worker_1.yaml b/bin/conf/worker_1.yaml index 5d4081212..41feae607 100644 --- a/bin/conf/worker_1.yaml +++ b/bin/conf/worker_1.yaml @@ -13,6 +13,7 @@ sys: Loglevel: 0 #日志文件输出级别 LogMaxSize: 128 #日志文件最大Size LogMaxAge: 7 #日志文件最多保留天数 + Debugmode: true registry: #注册表系统 服务发现 RegistryType: 0 #服务发现系统 0 Consul 组件 Consul_Addr: "10.0.0.9:8500" diff --git a/pb/proto/user_db.proto b/pb/proto/user_db.proto new file mode 100644 index 000000000..9f71de92c --- /dev/null +++ b/pb/proto/user_db.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; +option go_package = ".;pb"; + +message Cache_UserData { + uint32 UserId = 1; + string SessionId = 2; + string GatewayServiceId = 3; + string NiceName = 4; + string Email = 5; + string Password = 6; +} \ No newline at end of file diff --git a/pb/proto/user_msg.proto b/pb/proto/user_msg.proto index b7c8960b7..1aec4e531 100644 --- a/pb/proto/user_msg.proto +++ b/pb/proto/user_msg.proto @@ -4,6 +4,7 @@ option go_package = ".;pb"; message UserLoginReq { string Name = 1; } + message UserLoginResp { int32 Code = 1; } diff --git a/pb/user_db.pb.go b/pb/user_db.pb.go new file mode 100644 index 000000000..78f66f539 --- /dev/null +++ b/pb/user_db.pb.go @@ -0,0 +1,191 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.20.0 +// source: user_db.proto + +package pb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Cache_UserData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId uint32 `protobuf:"varint,1,opt,name=UserId,proto3" json:"UserId,omitempty"` + SessionId string `protobuf:"bytes,2,opt,name=SessionId,proto3" json:"SessionId,omitempty"` + GatewayServiceId string `protobuf:"bytes,3,opt,name=GatewayServiceId,proto3" json:"GatewayServiceId,omitempty"` + NiceName string `protobuf:"bytes,4,opt,name=NiceName,proto3" json:"NiceName,omitempty"` + Email string `protobuf:"bytes,5,opt,name=Email,proto3" json:"Email,omitempty"` + Password string `protobuf:"bytes,6,opt,name=Password,proto3" json:"Password,omitempty"` +} + +func (x *Cache_UserData) Reset() { + *x = Cache_UserData{} + if protoimpl.UnsafeEnabled { + mi := &file_user_db_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Cache_UserData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Cache_UserData) ProtoMessage() {} + +func (x *Cache_UserData) ProtoReflect() protoreflect.Message { + mi := &file_user_db_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Cache_UserData.ProtoReflect.Descriptor instead. +func (*Cache_UserData) Descriptor() ([]byte, []int) { + return file_user_db_proto_rawDescGZIP(), []int{0} +} + +func (x *Cache_UserData) GetUserId() uint32 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *Cache_UserData) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +func (x *Cache_UserData) GetGatewayServiceId() string { + if x != nil { + return x.GatewayServiceId + } + return "" +} + +func (x *Cache_UserData) GetNiceName() string { + if x != nil { + return x.NiceName + } + return "" +} + +func (x *Cache_UserData) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *Cache_UserData) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +var File_user_db_proto protoreflect.FileDescriptor + +var file_user_db_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0xc0, 0x01, 0x0a, 0x0e, 0x43, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x61, + 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 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, 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4e, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x14, 0x0a, 0x05, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, + 0x72, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, + 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_user_db_proto_rawDescOnce sync.Once + file_user_db_proto_rawDescData = file_user_db_proto_rawDesc +) + +func file_user_db_proto_rawDescGZIP() []byte { + file_user_db_proto_rawDescOnce.Do(func() { + file_user_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_user_db_proto_rawDescData) + }) + return file_user_db_proto_rawDescData +} + +var file_user_db_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_user_db_proto_goTypes = []interface{}{ + (*Cache_UserData)(nil), // 0: Cache_UserData +} +var file_user_db_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_user_db_proto_init() } +func file_user_db_proto_init() { + if File_user_db_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_user_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Cache_UserData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_user_db_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_user_db_proto_goTypes, + DependencyIndexes: file_user_db_proto_depIdxs, + MessageInfos: file_user_db_proto_msgTypes, + }.Build() + File_user_db_proto = out.File + file_user_db_proto_rawDesc = nil + file_user_db_proto_goTypes = nil + file_user_db_proto_depIdxs = nil +} diff --git a/pb_2.7.py b/pb_2.7.py index fab053b63..90d5f6e01 100644 --- a/pb_2.7.py +++ b/pb_2.7.py @@ -26,4 +26,5 @@ def buildProto(pbpath,outpath,pbfile): f.write(file_data) buildProto('./pb/proto','./pb','comm') +buildProto('./pb/proto','./pb','user_db') buildProto('./pb/proto','./pb','user_msg') \ No newline at end of file diff --git a/sys/cache/core.go b/sys/cache/core.go index f514cab92..570a840ac 100644 --- a/sys/cache/core.go +++ b/sys/cache/core.go @@ -5,6 +5,8 @@ type ( } ) +const () + var defsys ISys func OnInit(config map[string]interface{}, option ...Option) (err error) { diff --git a/sys/cache/user.go b/sys/cache/user.go new file mode 100644 index 000000000..801bdfd40 --- /dev/null +++ b/sys/cache/user.go @@ -0,0 +1,16 @@ +package cache + +import ( + "go_dreamfactory/pb" + + "github.com/liwei1dao/lego/core" +) + +const ( //Redis + Redis_UserCache core.Redis_Key = "user:%d" //会话列表 +) + +func (this *Cache) UpdateUserCache(data *pb.Cache_UserData) (err error) { + + return +}