diff --git a/Proto/ServerClient/gen/client/Action.cs b/Proto/ServerClient/gen/client/Action.cs index 788354b..92fbbdf 100644 --- a/Proto/ServerClient/gen/client/Action.cs +++ b/Proto/ServerClient/gen/client/Action.cs @@ -28,11 +28,11 @@ public static partial class ActionReflection { "bhIQCghTZXF1ZW5jZRgBIAEoDRIRCglUaW1lc3RhbXAYAiABKAMSGQoGQWN0", "aW9uGAMgASgOMgkuQWN0aW9uSUQSDAoERGlyWBgEIAEoERIMCgREaXJZGAUg", "ASgREg8KB1NraWxsSUQYBiABKAUiMQoMUG9zaXRpb25JbmZvEgsKA1VTThgB", - "IAEoAxIJCgFYGAIgASgREgkKAVkYAyABKBEiKwoMUzJDX1Bvc2l0aW9uEhsK", + "IAEoCRIJCgFYGAIgASgREgkKAVkYAyABKBEiKwoMUzJDX1Bvc2l0aW9uEhsK", "BEluZm8YASADKAsyDS5Qb3NpdGlvbkluZm8qSwoIQWN0aW9uSUQSFQoRQUNU", "SU9OX0lEX0lOVkFMSUQQABISCg5BQ1RJT05fSURfTU9WRRABEhQKEEFDVElP", - "Tl9JRF9BVFRBQ0sQAkIXWhVjb21tb24vcHJvdG8vc2Mvc2NfcGJiBnByb3Rv", - "Mw==")); + "Tl9JRF9BVFRBQ0sQAkI0WjJnaXQuaGxzcS5hc2lhL21tb3JwZy9zZXJ2aWNl", + "LWNvbW1vbi9wcm90by9zYy9zY19wYmIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::ScCommonReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::ActionID), }, null, new pbr::GeneratedClrTypeInfo[] { @@ -902,13 +902,13 @@ public sealed partial class PositionInfo : pb::IMessage /// Field number for the "USN" field. public const int USNFieldNumber = 1; - private long uSN_; + private string uSN_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long USN { + public string USN { get { return uSN_; } set { - uSN_ = value; + uSN_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -961,7 +961,7 @@ public sealed partial class PositionInfo : pb::IMessage [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; - if (USN != 0L) hash ^= USN.GetHashCode(); + if (USN.Length != 0) hash ^= USN.GetHashCode(); if (X != 0) hash ^= X.GetHashCode(); if (Y != 0) hash ^= Y.GetHashCode(); if (_unknownFields != null) { @@ -982,9 +982,9 @@ public sealed partial class PositionInfo : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (USN != 0L) { - output.WriteRawTag(8); - output.WriteInt64(USN); + if (USN.Length != 0) { + output.WriteRawTag(10); + output.WriteString(USN); } if (X != 0) { output.WriteRawTag(16); @@ -1004,9 +1004,9 @@ public sealed partial class PositionInfo : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (USN != 0L) { - output.WriteRawTag(8); - output.WriteInt64(USN); + if (USN.Length != 0) { + output.WriteRawTag(10); + output.WriteString(USN); } if (X != 0) { output.WriteRawTag(16); @@ -1026,8 +1026,8 @@ public sealed partial class PositionInfo : pb::IMessage [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; - if (USN != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(USN); + if (USN.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(USN); } if (X != 0) { size += 1 + pb::CodedOutputStream.ComputeSInt32Size(X); @@ -1047,7 +1047,7 @@ public sealed partial class PositionInfo : pb::IMessage if (other == null) { return; } - if (other.USN != 0L) { + if (other.USN.Length != 0) { USN = other.USN; } if (other.X != 0) { @@ -1071,8 +1071,8 @@ public sealed partial class PositionInfo : pb::IMessage default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; - case 8: { - USN = input.ReadInt64(); + case 10: { + USN = input.ReadString(); break; } case 16: { @@ -1098,8 +1098,8 @@ public sealed partial class PositionInfo : pb::IMessage default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; - case 8: { - USN = input.ReadInt64(); + case 10: { + USN = input.ReadString(); break; } case 16: { diff --git a/Proto/ServerClient/gen/client/Define.cs b/Proto/ServerClient/gen/client/Define.cs index 29e9197..552c49e 100644 --- a/Proto/ServerClient/gen/client/Define.cs +++ b/Proto/ServerClient/gen/client/Define.cs @@ -28,7 +28,8 @@ public static partial class DefineReflection { "X0tJQ0tfT1VUEAESFwoTTUVTU0FHRV9JRF9RVUVVRV9VUBACEhwKGE1FU1NB", "R0VfSURfTE9HSU5fU1VDQ0VTUxADEh0KGU1FU1NBR0VfSURfRU5URVJfSU5T", "VEFOQ0UQZRIVChFNRVNTQUdFX0lEX0FDVElPThBmEhcKE01FU1NBR0VfSURf", - "UE9TSVRJT04QZ0IXWhVjb21tb24vcHJvdG8vc2Mvc2NfcGJiBnByb3RvMw==")); + "UE9TSVRJT04QZ0I0WjJnaXQuaGxzcS5hc2lhL21tb3JwZy9zZXJ2aWNlLWNv", + "bW1vbi9wcm90by9zYy9zY19wYmIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::ScCommonReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::MessageID), }, null, new pbr::GeneratedClrTypeInfo[] { diff --git a/Proto/ServerClient/gen/client/ScCommon.cs b/Proto/ServerClient/gen/client/ScCommon.cs index fed1db3..f699d73 100644 --- a/Proto/ServerClient/gen/client/ScCommon.cs +++ b/Proto/ServerClient/gen/client/ScCommon.cs @@ -22,8 +22,8 @@ public static partial class ScCommonReflection { static ScCommonReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Cg9zY19jb21tb24ucHJvdG9CG1oZY29tbW9uL3Byb3RvL3NjL3NjX2NvbW1v", - "bmIGcHJvdG8z")); + "Cg9zY19jb21tb24ucHJvdG9COFo2Z2l0Lmhsc3EuYXNpYS9tbW9ycGcvc2Vy", + "dmljZS1jb21tb24vcHJvdG8vc2Mvc2NfY29tbW9uYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, null, null)); diff --git a/Proto/ServerClient/gen/client/Service.cs b/Proto/ServerClient/gen/client/Service.cs index 48b68ee..ca0d3e4 100644 --- a/Proto/ServerClient/gen/client/Service.cs +++ b/Proto/ServerClient/gen/client/Service.cs @@ -29,8 +29,8 @@ public static partial class ServiceReflection { "VkFMSUQQABIfChtLSUNLX09VVF9JRF9EVVBMSUNBVEVfTE9HSU4QARIbChdL", "SUNLX09VVF9JRF9TRVJWRVJfQlVTWRACEhwKGEtJQ0tfT1VUX0lEX1NFUlZF", "Ul9DTE9TRRADEh0KGUtJQ0tfT1VUX0lEX1FVRVVFX1VQX0ZVTEwQBBIdChlL", - "SUNLX09VVF9JRF9UT0tFTl9JTlZBTElEEAVCF1oVY29tbW9uL3Byb3RvL3Nj", - "L3NjX3BiYgZwcm90bzM=")); + "SUNLX09VVF9JRF9UT0tFTl9JTlZBTElEEAVCNFoyZ2l0Lmhsc3EuYXNpYS9t", + "bW9ycGcvc2VydmljZS1jb21tb24vcHJvdG8vc2Mvc2NfcGJiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::ScCommonReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::KickOutID), }, null, new pbr::GeneratedClrTypeInfo[] { diff --git a/Proto/ServerClient/gen/common/proto/sc/sc_common/sc_common.pb.go b/Proto/ServerClient/gen/git.hlsq.asia/mmorpg/service-common/proto/sc/sc_common/sc_common.pb.go similarity index 81% rename from Proto/ServerClient/gen/common/proto/sc/sc_common/sc_common.pb.go rename to Proto/ServerClient/gen/git.hlsq.asia/mmorpg/service-common/proto/sc/sc_common/sc_common.pb.go index dccafd4..65d2c4f 100644 --- a/Proto/ServerClient/gen/common/proto/sc/sc_common/sc_common.pb.go +++ b/Proto/ServerClient/gen/git.hlsq.asia/mmorpg/service-common/proto/sc/sc_common/sc_common.pb.go @@ -23,9 +23,11 @@ var File_sc_common_proto protoreflect.FileDescriptor var file_sc_common_proto_rawDesc = []byte{ 0x0a, 0x0f, 0x73, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x42, 0x1b, 0x5a, 0x19, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2f, 0x73, 0x63, 0x2f, 0x73, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x42, 0x38, 0x5a, 0x36, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73, + 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, + 0x63, 0x2f, 0x73, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var file_sc_common_proto_goTypes = []interface{}{} diff --git a/Proto/ServerClient/gen/common/proto/sc/sc_pb/action.pb.go b/Proto/ServerClient/gen/git.hlsq.asia/mmorpg/service-common/proto/sc/sc_pb/action.pb.go similarity index 94% rename from Proto/ServerClient/gen/common/proto/sc/sc_pb/action.pb.go rename to Proto/ServerClient/gen/git.hlsq.asia/mmorpg/service-common/proto/sc/sc_pb/action.pb.go index 08ed345..a383b1f 100644 --- a/Proto/ServerClient/gen/common/proto/sc/sc_pb/action.pb.go +++ b/Proto/ServerClient/gen/git.hlsq.asia/mmorpg/service-common/proto/sc/sc_pb/action.pb.go @@ -7,7 +7,7 @@ package sc_pb import ( - _ "common/proto/sc/sc_common" + _ "git.hlsq.asia/mmorpg/service-common/proto/sc/sc_common" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -259,9 +259,9 @@ type PositionInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,omitempty"` - X int32 `protobuf:"zigzag32,2,opt,name=X,proto3" json:"X,omitempty"` - Y int32 `protobuf:"zigzag32,3,opt,name=Y,proto3" json:"Y,omitempty"` + USN string `protobuf:"bytes,1,opt,name=USN,proto3" json:"USN,omitempty"` + X int32 `protobuf:"zigzag32,2,opt,name=X,proto3" json:"X,omitempty"` + Y int32 `protobuf:"zigzag32,3,opt,name=Y,proto3" json:"Y,omitempty"` } func (x *PositionInfo) Reset() { @@ -296,11 +296,11 @@ func (*PositionInfo) Descriptor() ([]byte, []int) { return file_action_proto_rawDescGZIP(), []int{3} } -func (x *PositionInfo) GetUSN() int64 { +func (x *PositionInfo) GetUSN() string { if x != nil { return x.USN } - return 0 + return "" } func (x *PositionInfo) GetX() int32 { @@ -388,7 +388,7 @@ var file_action_proto_rawDesc = []byte{ 0x12, 0x18, 0x0a, 0x07, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x22, 0x3c, 0x0a, 0x0c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, - 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, 0x0c, 0x0a, 0x01, + 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, 0x0c, 0x0a, 0x01, 0x58, 0x18, 0x02, 0x20, 0x01, 0x28, 0x11, 0x52, 0x01, 0x58, 0x12, 0x0c, 0x0a, 0x01, 0x59, 0x18, 0x03, 0x20, 0x01, 0x28, 0x11, 0x52, 0x01, 0x59, 0x22, 0x31, 0x0a, 0x0c, 0x53, 0x32, 0x43, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, @@ -398,9 +398,11 @@ var file_action_proto_rawDesc = []byte{ 0x4e, 0x5f, 0x49, 0x44, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x44, 0x5f, 0x4d, 0x4f, 0x56, 0x45, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x44, 0x5f, - 0x41, 0x54, 0x54, 0x41, 0x43, 0x4b, 0x10, 0x02, 0x42, 0x17, 0x5a, 0x15, 0x63, 0x6f, 0x6d, 0x6d, - 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x63, 0x2f, 0x73, 0x63, 0x5f, 0x70, - 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x41, 0x54, 0x54, 0x41, 0x43, 0x4b, 0x10, 0x02, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x2e, + 0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, + 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x63, 0x2f, 0x73, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/Proto/ServerClient/gen/common/proto/sc/sc_pb/define.pb.go b/Proto/ServerClient/gen/git.hlsq.asia/mmorpg/service-common/proto/sc/sc_pb/define.pb.go similarity index 94% rename from Proto/ServerClient/gen/common/proto/sc/sc_pb/define.pb.go rename to Proto/ServerClient/gen/git.hlsq.asia/mmorpg/service-common/proto/sc/sc_pb/define.pb.go index 60b5b01..2c6ace2 100644 --- a/Proto/ServerClient/gen/common/proto/sc/sc_pb/define.pb.go +++ b/Proto/ServerClient/gen/git.hlsq.asia/mmorpg/service-common/proto/sc/sc_pb/define.pb.go @@ -7,7 +7,7 @@ package sc_pb import ( - _ "common/proto/sc/sc_common" + _ "git.hlsq.asia/mmorpg/service-common/proto/sc/sc_common" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -158,9 +158,11 @@ var file_define_proto_rawDesc = []byte{ 0x4e, 0x43, 0x45, 0x10, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x49, 0x44, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x66, 0x12, 0x17, 0x0a, 0x13, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x49, 0x44, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, - 0x49, 0x4f, 0x4e, 0x10, 0x67, 0x42, 0x17, 0x5a, 0x15, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x63, 0x2f, 0x73, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x49, 0x4f, 0x4e, 0x10, 0x67, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, + 0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x73, 0x63, 0x2f, 0x73, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/Proto/ServerClient/gen/common/proto/sc/sc_pb/service.pb.go b/Proto/ServerClient/gen/git.hlsq.asia/mmorpg/service-common/proto/sc/sc_pb/service.pb.go similarity index 95% rename from Proto/ServerClient/gen/common/proto/sc/sc_pb/service.pb.go rename to Proto/ServerClient/gen/git.hlsq.asia/mmorpg/service-common/proto/sc/sc_pb/service.pb.go index 4ba8aff..6f1e240 100644 --- a/Proto/ServerClient/gen/common/proto/sc/sc_pb/service.pb.go +++ b/Proto/ServerClient/gen/git.hlsq.asia/mmorpg/service-common/proto/sc/sc_pb/service.pb.go @@ -7,7 +7,7 @@ package sc_pb import ( - _ "common/proto/sc/sc_common" + _ "git.hlsq.asia/mmorpg/service-common/proto/sc/sc_common" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -249,9 +249,11 @@ var file_service_proto_rawDesc = []byte{ 0x54, 0x5f, 0x49, 0x44, 0x5f, 0x51, 0x55, 0x45, 0x55, 0x45, 0x5f, 0x55, 0x50, 0x5f, 0x46, 0x55, 0x4c, 0x4c, 0x10, 0x04, 0x12, 0x1d, 0x0a, 0x19, 0x4b, 0x49, 0x43, 0x4b, 0x5f, 0x4f, 0x55, 0x54, 0x5f, 0x49, 0x44, 0x5f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, - 0x44, 0x10, 0x05, 0x42, 0x17, 0x5a, 0x15, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x63, 0x2f, 0x73, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x44, 0x10, 0x05, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e, + 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x73, 0x63, 0x2f, 0x73, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/Proto/ServerClient/sources/action.proto b/Proto/ServerClient/sources/action.proto index 590ce24..cd478f9 100644 --- a/Proto/ServerClient/sources/action.proto +++ b/Proto/ServerClient/sources/action.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -option go_package = "common/proto/sc/sc_pb"; +option go_package = "git.hlsq.asia/mmorpg/service-common/proto/sc/sc_pb"; import "sc_common.proto"; // MESSAGE_ID_ENTER_INSTANCE @@ -28,7 +28,7 @@ message C2S_Action { // MESSAGE_ID_POSITION message PositionInfo { - int64 USN = 1; + string USN = 1; sint32 X = 2; sint32 Y = 3; } diff --git a/Proto/ServerClient/sources/define.proto b/Proto/ServerClient/sources/define.proto index d0fbc95..c8ac37d 100644 --- a/Proto/ServerClient/sources/define.proto +++ b/Proto/ServerClient/sources/define.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -option go_package = "common/proto/sc/sc_pb"; +option go_package = "git.hlsq.asia/mmorpg/service-common/proto/sc/sc_pb"; import "sc_common.proto"; enum MessageID { diff --git a/Proto/ServerClient/sources/sc_common.proto b/Proto/ServerClient/sources/sc_common.proto index e496d95..fb137da 100644 --- a/Proto/ServerClient/sources/sc_common.proto +++ b/Proto/ServerClient/sources/sc_common.proto @@ -1,3 +1,3 @@ syntax = "proto3"; -option go_package = "common/proto/sc/sc_common"; \ No newline at end of file +option go_package = "git.hlsq.asia/mmorpg/service-common/proto/sc/sc_common"; \ No newline at end of file diff --git a/Proto/ServerClient/sources/service.proto b/Proto/ServerClient/sources/service.proto index 021b15d..0259fa9 100644 --- a/Proto/ServerClient/sources/service.proto +++ b/Proto/ServerClient/sources/service.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -option go_package = "common/proto/sc/sc_pb"; +option go_package = "git.hlsq.asia/mmorpg/service-common/proto/sc/sc_pb"; import "sc_common.proto"; // MESSAGE_ID_KICK_OUT diff --git a/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_user.pb.go b/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_user.pb.go deleted file mode 100644 index adfb2c2..0000000 --- a/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_user.pb.go +++ /dev/null @@ -1,372 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v4.25.1 -// source: service_user.proto - -package grpc_pb - -import ( - _ "common/proto/ss/ss_common" - _ "google.golang.org/genproto/googleapis/api/annotations" - 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 LoginReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Phone string `protobuf:"bytes,1,opt,name=Phone,json=phone,proto3" json:"Phone,omitempty"` // 手机号 - Code string `protobuf:"bytes,2,opt,name=Code,json=code,proto3" json:"Code,omitempty"` // 验证码 -} - -func (x *LoginReq) Reset() { - *x = LoginReq{} - if protoimpl.UnsafeEnabled { - mi := &file_service_user_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LoginReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LoginReq) ProtoMessage() {} - -func (x *LoginReq) ProtoReflect() protoreflect.Message { - mi := &file_service_user_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 LoginReq.ProtoReflect.Descriptor instead. -func (*LoginReq) Descriptor() ([]byte, []int) { - return file_service_user_proto_rawDescGZIP(), []int{0} -} - -func (x *LoginReq) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *LoginReq) GetCode() string { - if x != nil { - return x.Code - } - return "" -} - -type LoginResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` // 用户ID - Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` // 用户名 -} - -func (x *LoginResp) Reset() { - *x = LoginResp{} - if protoimpl.UnsafeEnabled { - mi := &file_service_user_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LoginResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LoginResp) ProtoMessage() {} - -func (x *LoginResp) ProtoReflect() protoreflect.Message { - mi := &file_service_user_proto_msgTypes[1] - 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 LoginResp.ProtoReflect.Descriptor instead. -func (*LoginResp) Descriptor() ([]byte, []int) { - return file_service_user_proto_rawDescGZIP(), []int{1} -} - -func (x *LoginResp) GetUSN() int64 { - if x != nil { - return x.USN - } - return 0 -} - -func (x *LoginResp) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type GetUserInfoReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` -} - -func (x *GetUserInfoReq) Reset() { - *x = GetUserInfoReq{} - if protoimpl.UnsafeEnabled { - mi := &file_service_user_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetUserInfoReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetUserInfoReq) ProtoMessage() {} - -func (x *GetUserInfoReq) ProtoReflect() protoreflect.Message { - mi := &file_service_user_proto_msgTypes[2] - 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 GetUserInfoReq.ProtoReflect.Descriptor instead. -func (*GetUserInfoReq) Descriptor() ([]byte, []int) { - return file_service_user_proto_rawDescGZIP(), []int{2} -} - -func (x *GetUserInfoReq) GetUSN() int64 { - if x != nil { - return x.USN - } - return 0 -} - -type GetUserInfoResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` -} - -func (x *GetUserInfoResp) Reset() { - *x = GetUserInfoResp{} - if protoimpl.UnsafeEnabled { - mi := &file_service_user_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetUserInfoResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetUserInfoResp) ProtoMessage() {} - -func (x *GetUserInfoResp) ProtoReflect() protoreflect.Message { - mi := &file_service_user_proto_msgTypes[3] - 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 GetUserInfoResp.ProtoReflect.Descriptor instead. -func (*GetUserInfoResp) Descriptor() ([]byte, []int) { - return file_service_user_proto_rawDescGZIP(), []int{3} -} - -func (x *GetUserInfoResp) GetUSN() int64 { - if x != nil { - return x.USN - } - return 0 -} - -func (x *GetUserInfoResp) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -var File_service_user_proto protoreflect.FileDescriptor - -var file_service_user_proto_rawDesc = []byte{ - 0x0a, 0x12, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, - 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x31, 0x0a, 0x09, 0x4c, 0x6f, 0x67, - 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x22, 0x0a, 0x0e, - 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x10, - 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x73, 0x6e, - 0x22, 0x37, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x32, 0x71, 0x0a, 0x04, 0x55, 0x73, 0x65, - 0x72, 0x12, 0x20, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x09, 0x2e, 0x4c, 0x6f, 0x67, - 0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0a, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, - 0x70, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, - 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x65, 0x73, 0x70, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x3a, 0x01, 0x2a, - 0x22, 0x0a, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x42, 0x19, 0x5a, 0x17, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, - 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_service_user_proto_rawDescOnce sync.Once - file_service_user_proto_rawDescData = file_service_user_proto_rawDesc -) - -func file_service_user_proto_rawDescGZIP() []byte { - file_service_user_proto_rawDescOnce.Do(func() { - file_service_user_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_user_proto_rawDescData) - }) - return file_service_user_proto_rawDescData -} - -var file_service_user_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_service_user_proto_goTypes = []interface{}{ - (*LoginReq)(nil), // 0: LoginReq - (*LoginResp)(nil), // 1: LoginResp - (*GetUserInfoReq)(nil), // 2: GetUserInfoReq - (*GetUserInfoResp)(nil), // 3: GetUserInfoResp -} -var file_service_user_proto_depIdxs = []int32{ - 0, // 0: User.Login:input_type -> LoginReq - 2, // 1: User.GetUserInfo:input_type -> GetUserInfoReq - 1, // 2: User.Login:output_type -> LoginResp - 3, // 3: User.GetUserInfo:output_type -> GetUserInfoResp - 2, // [2:4] is the sub-list for method output_type - 0, // [0:2] 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_service_user_proto_init() } -func file_service_user_proto_init() { - if File_service_user_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_service_user_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LoginReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_service_user_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LoginResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_service_user_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetUserInfoReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_service_user_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetUserInfoResp); 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_service_user_proto_rawDesc, - NumEnums: 0, - NumMessages: 4, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_service_user_proto_goTypes, - DependencyIndexes: file_service_user_proto_depIdxs, - MessageInfos: file_service_user_proto_msgTypes, - }.Build() - File_service_user_proto = out.File - file_service_user_proto_rawDesc = nil - file_service_user_proto_goTypes = nil - file_service_user_proto_depIdxs = nil -} diff --git a/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_user.pb.gw.go b/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_user.pb.gw.go deleted file mode 100644 index 367d62d..0000000 --- a/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_user.pb.gw.go +++ /dev/null @@ -1,154 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: service_user.proto - -/* -Package grpc_pb is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package grpc_pb - -import ( - "context" - "errors" - "io" - "net/http" - - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" -) - -// Suppress "imported and not used" errors -var ( - _ codes.Code - _ io.Reader - _ status.Status - _ = errors.New - _ = runtime.String - _ = utilities.NewDoubleArray - _ = metadata.Join -) - -func request_User_GetUserInfo_0(ctx context.Context, marshaler runtime.Marshaler, client UserClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq GetUserInfoReq - metadata runtime.ServerMetadata - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := client.GetUserInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_User_GetUserInfo_0(ctx context.Context, marshaler runtime.Marshaler, server UserServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq GetUserInfoReq - metadata runtime.ServerMetadata - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.GetUserInfo(ctx, &protoReq) - return msg, metadata, err -} - -// RegisterUserHandlerServer registers the http handlers for service User to "mux". -// UnaryRPC :call UserServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterUserHandlerFromEndpoint instead. -// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. -func RegisterUserHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServer) error { - mux.Handle(http.MethodPost, pattern_User_GetUserInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.User/GetUserInfo", runtime.WithHTTPPathPattern("/user/info")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_User_GetUserInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_User_GetUserInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - return nil -} - -// RegisterUserHandlerFromEndpoint is same as RegisterUserHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterUserHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.NewClient(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - return RegisterUserHandler(ctx, mux, conn) -} - -// RegisterUserHandler registers the http handlers for service User to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterUserHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterUserHandlerClient(ctx, mux, NewUserClient(conn)) -} - -// RegisterUserHandlerClient registers the http handlers for service User -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "UserClient" to call the correct interceptors. This client ignores the HTTP middlewares. -func RegisterUserHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserClient) error { - mux.Handle(http.MethodPost, pattern_User_GetUserInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.User/GetUserInfo", runtime.WithHTTPPathPattern("/user/info")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_User_GetUserInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_User_GetUserInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - return nil -} - -var ( - pattern_User_GetUserInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"user", "info"}, "")) -) - -var ( - forward_User_GetUserInfo_0 = runtime.ForwardResponseMessage -) diff --git a/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_gateway.pb.go b/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_gateway.pb.go similarity index 92% rename from Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_gateway.pb.go rename to Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_gateway.pb.go index 6562b52..302d9b1 100644 --- a/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_gateway.pb.go +++ b/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_gateway.pb.go @@ -7,7 +7,7 @@ package grpc_pb import ( - _ "common/proto/ss/ss_common" + _ "git.hlsq.asia/mmorpg/service-common/proto/ss/ss_common" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -26,7 +26,7 @@ type ToClientReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,omitempty"` + USN string `protobuf:"bytes,1,opt,name=USN,proto3" json:"USN,omitempty"` MessageID int32 `protobuf:"varint,2,opt,name=MessageID,proto3" json:"MessageID,omitempty"` Payload []byte `protobuf:"bytes,3,opt,name=Payload,proto3" json:"Payload,omitempty"` } @@ -63,11 +63,11 @@ func (*ToClientReq) Descriptor() ([]byte, []int) { return file_service_gateway_proto_rawDescGZIP(), []int{0} } -func (x *ToClientReq) GetUSN() int64 { +func (x *ToClientReq) GetUSN() string { if x != nil { return x.USN } - return 0 + return "" } func (x *ToClientReq) GetMessageID() int32 { @@ -127,7 +127,7 @@ type KickUserReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,omitempty"` + USN string `protobuf:"bytes,1,opt,name=USN,proto3" json:"USN,omitempty"` } func (x *KickUserReq) Reset() { @@ -162,11 +162,11 @@ func (*KickUserReq) Descriptor() ([]byte, []int) { return file_service_gateway_proto_rawDescGZIP(), []int{2} } -func (x *KickUserReq) GetUSN() int64 { +func (x *KickUserReq) GetUSN() string { if x != nil { return x.USN } - return 0 + return "" } type KickUserResp struct { @@ -214,13 +214,13 @@ var file_service_gateway_proto_rawDesc = []byte{ 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x57, 0x0a, 0x0b, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x0e, 0x0a, 0x0c, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x1f, 0x0a, 0x0b, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, - 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x55, + 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x22, 0x0e, 0x0a, 0x0c, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x32, 0x61, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2b, 0x0a, 0x08, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x0c, 0x2e, 0x54, 0x6f, 0x43, 0x6c, @@ -228,9 +228,11 @@ var file_service_gateway_proto_rawDesc = []byte{ 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x28, 0x01, 0x12, 0x29, 0x0a, 0x08, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0c, 0x2e, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x52, - 0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x19, 0x5a, 0x17, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, + 0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_gateway_grpc.pb.go b/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_gateway_grpc.pb.go similarity index 100% rename from Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_gateway_grpc.pb.go rename to Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_gateway_grpc.pb.go diff --git a/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_scene.pb.go b/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_scene.pb.go similarity index 85% rename from Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_scene.pb.go rename to Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_scene.pb.go index 52bb24e..b678564 100644 --- a/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_scene.pb.go +++ b/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_scene.pb.go @@ -7,7 +7,7 @@ package grpc_pb import ( - _ "common/proto/ss/ss_common" + _ "git.hlsq.asia/mmorpg/service-common/proto/ss/ss_common" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -26,9 +26,9 @@ type EnterReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID - GatewaySID int64 `protobuf:"varint,2,opt,name=GatewaySID,proto3" json:"GatewaySID,omitempty"` // 网关服务ID - InstanceID int32 `protobuf:"varint,3,opt,name=InstanceID,proto3" json:"InstanceID,omitempty"` // 副本ID + USN string `protobuf:"bytes,1,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID + GatewaySID string `protobuf:"bytes,2,opt,name=GatewaySID,proto3" json:"GatewaySID,omitempty"` // 网关服务ID + InstanceID int32 `protobuf:"varint,3,opt,name=InstanceID,proto3" json:"InstanceID,omitempty"` // 副本ID } func (x *EnterReq) Reset() { @@ -63,18 +63,18 @@ func (*EnterReq) Descriptor() ([]byte, []int) { return file_service_scene_proto_rawDescGZIP(), []int{0} } -func (x *EnterReq) GetUSN() int64 { +func (x *EnterReq) GetUSN() string { if x != nil { return x.USN } - return 0 + return "" } -func (x *EnterReq) GetGatewaySID() int64 { +func (x *EnterReq) GetGatewaySID() string { if x != nil { return x.GatewaySID } - return 0 + return "" } func (x *EnterReq) GetInstanceID() int32 { @@ -89,8 +89,8 @@ type EnterResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - SceneSID int64 `protobuf:"varint,1,opt,name=SceneSID,proto3" json:"SceneSID,omitempty"` // 场景服务ID - UniqueNo int64 `protobuf:"varint,2,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号 + SceneSID string `protobuf:"bytes,1,opt,name=SceneSID,proto3" json:"SceneSID,omitempty"` // 场景服务ID + UniqueNo string `protobuf:"bytes,2,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号 MessageID int32 `protobuf:"varint,3,opt,name=MessageID,proto3" json:"MessageID,omitempty"` // 发送给客户端的消息ID Payload []byte `protobuf:"bytes,4,opt,name=Payload,proto3" json:"Payload,omitempty"` // 消息负载 } @@ -127,18 +127,18 @@ func (*EnterResp) Descriptor() ([]byte, []int) { return file_service_scene_proto_rawDescGZIP(), []int{1} } -func (x *EnterResp) GetSceneSID() int64 { +func (x *EnterResp) GetSceneSID() string { if x != nil { return x.SceneSID } - return 0 + return "" } -func (x *EnterResp) GetUniqueNo() int64 { +func (x *EnterResp) GetUniqueNo() string { if x != nil { return x.UniqueNo } - return 0 + return "" } func (x *EnterResp) GetMessageID() int32 { @@ -160,8 +160,8 @@ type LeaveReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID - UniqueNo int64 `protobuf:"varint,2,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号 + USN string `protobuf:"bytes,1,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID + UniqueNo string `protobuf:"bytes,2,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号 } func (x *LeaveReq) Reset() { @@ -196,18 +196,18 @@ func (*LeaveReq) Descriptor() ([]byte, []int) { return file_service_scene_proto_rawDescGZIP(), []int{2} } -func (x *LeaveReq) GetUSN() int64 { +func (x *LeaveReq) GetUSN() string { if x != nil { return x.USN } - return 0 + return "" } -func (x *LeaveReq) GetUniqueNo() int64 { +func (x *LeaveReq) GetUniqueNo() string { if x != nil { return x.UniqueNo } - return 0 + return "" } type LeaveResp struct { @@ -253,12 +253,12 @@ type ActionReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UniqueNo int64 `protobuf:"varint,1,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号 - USN int64 `protobuf:"varint,2,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID - Action int32 `protobuf:"varint,3,opt,name=Action,proto3" json:"Action,omitempty"` // 指令ID - DirX int32 `protobuf:"zigzag32,4,opt,name=DirX,proto3" json:"DirX,omitempty"` // 移动-X方向(×1000 缩放) - DirY int32 `protobuf:"zigzag32,5,opt,name=DirY,proto3" json:"DirY,omitempty"` // 移动-Y方向(×1000 缩放) - SkillID int32 `protobuf:"varint,6,opt,name=SkillID,proto3" json:"SkillID,omitempty"` // 攻击-技能ID + UniqueNo string `protobuf:"bytes,1,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号 + USN string `protobuf:"bytes,2,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID + Action int32 `protobuf:"varint,3,opt,name=Action,proto3" json:"Action,omitempty"` // 指令ID + DirX int32 `protobuf:"zigzag32,4,opt,name=DirX,proto3" json:"DirX,omitempty"` // 移动-X方向(×1000 缩放) + DirY int32 `protobuf:"zigzag32,5,opt,name=DirY,proto3" json:"DirY,omitempty"` // 移动-Y方向(×1000 缩放) + SkillID int32 `protobuf:"varint,6,opt,name=SkillID,proto3" json:"SkillID,omitempty"` // 攻击-技能ID } func (x *ActionReq) Reset() { @@ -293,18 +293,18 @@ func (*ActionReq) Descriptor() ([]byte, []int) { return file_service_scene_proto_rawDescGZIP(), []int{4} } -func (x *ActionReq) GetUniqueNo() int64 { +func (x *ActionReq) GetUniqueNo() string { if x != nil { return x.UniqueNo } - return 0 + return "" } -func (x *ActionReq) GetUSN() int64 { +func (x *ActionReq) GetUSN() string { if x != nil { return x.USN } - return 0 + return "" } func (x *ActionReq) GetAction() int32 { @@ -379,27 +379,27 @@ var file_service_scene_proto_rawDesc = []byte{ 0x0a, 0x13, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5c, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, 0x1e, 0x0a, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, - 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x44, 0x22, 0x7b, 0x0a, 0x09, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x53, 0x49, 0x44, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x08, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x53, 0x49, 0x44, 0x12, 0x1a, 0x0a, - 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x53, 0x49, 0x44, 0x12, 0x1a, 0x0a, + 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x38, 0x0a, 0x08, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, - 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, + 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x22, 0x0b, 0x0a, 0x09, 0x4c, + 0x09, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x22, 0x0b, 0x0a, 0x09, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x93, 0x01, 0x0a, 0x09, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, - 0x4e, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, - 0x4e, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x4e, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, + 0x4e, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x69, 0x72, 0x58, 0x18, 0x04, 0x20, 0x01, 0x28, 0x11, 0x52, 0x04, 0x44, 0x69, 0x72, 0x58, @@ -414,9 +414,10 @@ var file_service_scene_proto_rawDesc = []byte{ 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x25, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0a, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0b, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x28, 0x01, - 0x42, 0x19, 0x5a, 0x17, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x73, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73, 0x69, + 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_scene_grpc.pb.go b/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_scene_grpc.pb.go similarity index 100% rename from Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_scene_grpc.pb.go rename to Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_scene_grpc.pb.go diff --git a/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_user.pb.go b/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_user.pb.go new file mode 100644 index 0000000..59b64a9 --- /dev/null +++ b/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_user.pb.go @@ -0,0 +1,806 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.1 +// source: service_user.proto + +package grpc_pb + +import ( + _ "git.hlsq.asia/mmorpg/service-common/proto/ss/ss_common" + _ "google.golang.org/genproto/googleapis/api/annotations" + 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) +) + +// ---------- Login ---------- +type LoginReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Phone string `protobuf:"bytes,1,opt,name=Phone,json=phone,proto3" json:"Phone,omitempty"` // 手机号 + Code string `protobuf:"bytes,2,opt,name=Code,json=code,proto3" json:"Code,omitempty"` // 验证码 +} + +func (x *LoginReq) Reset() { + *x = LoginReq{} + if protoimpl.UnsafeEnabled { + mi := &file_service_user_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LoginReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginReq) ProtoMessage() {} + +func (x *LoginReq) ProtoReflect() protoreflect.Message { + mi := &file_service_user_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 LoginReq.ProtoReflect.Descriptor instead. +func (*LoginReq) Descriptor() ([]byte, []int) { + return file_service_user_proto_rawDescGZIP(), []int{0} +} + +func (x *LoginReq) GetPhone() string { + if x != nil { + return x.Phone + } + return "" +} + +func (x *LoginReq) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +type LoginResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` // 用户ID + Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` // 用户名 +} + +func (x *LoginResp) Reset() { + *x = LoginResp{} + if protoimpl.UnsafeEnabled { + mi := &file_service_user_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LoginResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginResp) ProtoMessage() {} + +func (x *LoginResp) ProtoReflect() protoreflect.Message { + mi := &file_service_user_proto_msgTypes[1] + 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 LoginResp.ProtoReflect.Descriptor instead. +func (*LoginResp) Descriptor() ([]byte, []int) { + return file_service_user_proto_rawDescGZIP(), []int{1} +} + +func (x *LoginResp) GetUSN() string { + if x != nil { + return x.USN + } + return "" +} + +func (x *LoginResp) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// ---------- GetUserInfo ---------- +type GetUserInfoReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` +} + +func (x *GetUserInfoReq) Reset() { + *x = GetUserInfoReq{} + if protoimpl.UnsafeEnabled { + mi := &file_service_user_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUserInfoReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserInfoReq) ProtoMessage() {} + +func (x *GetUserInfoReq) ProtoReflect() protoreflect.Message { + mi := &file_service_user_proto_msgTypes[2] + 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 GetUserInfoReq.ProtoReflect.Descriptor instead. +func (*GetUserInfoReq) Descriptor() ([]byte, []int) { + return file_service_user_proto_rawDescGZIP(), []int{2} +} + +func (x *GetUserInfoReq) GetUSN() string { + if x != nil { + return x.USN + } + return "" +} + +type GetUserInfoResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` + Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` +} + +func (x *GetUserInfoResp) Reset() { + *x = GetUserInfoResp{} + if protoimpl.UnsafeEnabled { + mi := &file_service_user_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUserInfoResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserInfoResp) ProtoMessage() {} + +func (x *GetUserInfoResp) ProtoReflect() protoreflect.Message { + mi := &file_service_user_proto_msgTypes[3] + 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 GetUserInfoResp.ProtoReflect.Descriptor instead. +func (*GetUserInfoResp) Descriptor() ([]byte, []int) { + return file_service_user_proto_rawDescGZIP(), []int{3} +} + +func (x *GetUserInfoResp) GetUSN() string { + if x != nil { + return x.USN + } + return "" +} + +func (x *GetUserInfoResp) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// ---------- GenerateQuestion ---------- +type GenerateQuestionReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Num int32 `protobuf:"varint,1,opt,name=Num,json=num,proto3" json:"Num,omitempty"` // 生成数量 + Category string `protobuf:"bytes,2,opt,name=Category,proto3" json:"Category,omitempty"` // 题目类型 +} + +func (x *GenerateQuestionReq) Reset() { + *x = GenerateQuestionReq{} + if protoimpl.UnsafeEnabled { + mi := &file_service_user_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenerateQuestionReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenerateQuestionReq) ProtoMessage() {} + +func (x *GenerateQuestionReq) ProtoReflect() protoreflect.Message { + mi := &file_service_user_proto_msgTypes[4] + 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 GenerateQuestionReq.ProtoReflect.Descriptor instead. +func (*GenerateQuestionReq) Descriptor() ([]byte, []int) { + return file_service_user_proto_rawDescGZIP(), []int{4} +} + +func (x *GenerateQuestionReq) GetNum() int32 { + if x != nil { + return x.Num + } + return 0 +} + +func (x *GenerateQuestionReq) GetCategory() string { + if x != nil { + return x.Category + } + return "" +} + +type GenerateQuestionResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GenerateQuestionResp) Reset() { + *x = GenerateQuestionResp{} + if protoimpl.UnsafeEnabled { + mi := &file_service_user_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenerateQuestionResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenerateQuestionResp) ProtoMessage() {} + +func (x *GenerateQuestionResp) ProtoReflect() protoreflect.Message { + mi := &file_service_user_proto_msgTypes[5] + 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 GenerateQuestionResp.ProtoReflect.Descriptor instead. +func (*GenerateQuestionResp) Descriptor() ([]byte, []int) { + return file_service_user_proto_rawDescGZIP(), []int{5} +} + +// ---------- GetQuestion ---------- +type GetQuestionReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetQuestionReq) Reset() { + *x = GetQuestionReq{} + if protoimpl.UnsafeEnabled { + mi := &file_service_user_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetQuestionReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetQuestionReq) ProtoMessage() {} + +func (x *GetQuestionReq) ProtoReflect() protoreflect.Message { + mi := &file_service_user_proto_msgTypes[6] + 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 GetQuestionReq.ProtoReflect.Descriptor instead. +func (*GetQuestionReq) Descriptor() ([]byte, []int) { + return file_service_user_proto_rawDescGZIP(), []int{6} +} + +type GetQuestionResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Sn string `protobuf:"bytes,1,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 题目唯一标识 + Question string `protobuf:"bytes,2,opt,name=Question,json=question,proto3" json:"Question,omitempty"` // 题干 + Options []string `protobuf:"bytes,3,rep,name=Options,json=options,proto3" json:"Options,omitempty"` // 选项 +} + +func (x *GetQuestionResp) Reset() { + *x = GetQuestionResp{} + if protoimpl.UnsafeEnabled { + mi := &file_service_user_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetQuestionResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetQuestionResp) ProtoMessage() {} + +func (x *GetQuestionResp) ProtoReflect() protoreflect.Message { + mi := &file_service_user_proto_msgTypes[7] + 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 GetQuestionResp.ProtoReflect.Descriptor instead. +func (*GetQuestionResp) Descriptor() ([]byte, []int) { + return file_service_user_proto_rawDescGZIP(), []int{7} +} + +func (x *GetQuestionResp) GetSn() string { + if x != nil { + return x.Sn + } + return "" +} + +func (x *GetQuestionResp) GetQuestion() string { + if x != nil { + return x.Question + } + return "" +} + +func (x *GetQuestionResp) GetOptions() []string { + if x != nil { + return x.Options + } + return nil +} + +// ---------- AnswerQuestion ---------- +type AnswerQuestionReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Sn string `protobuf:"bytes,1,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 题目唯一标识 + Answer string `protobuf:"bytes,2,opt,name=Answer,json=answer,proto3" json:"Answer,omitempty"` // 答案 +} + +func (x *AnswerQuestionReq) Reset() { + *x = AnswerQuestionReq{} + if protoimpl.UnsafeEnabled { + mi := &file_service_user_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AnswerQuestionReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AnswerQuestionReq) ProtoMessage() {} + +func (x *AnswerQuestionReq) ProtoReflect() protoreflect.Message { + mi := &file_service_user_proto_msgTypes[8] + 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 AnswerQuestionReq.ProtoReflect.Descriptor instead. +func (*AnswerQuestionReq) Descriptor() ([]byte, []int) { + return file_service_user_proto_rawDescGZIP(), []int{8} +} + +func (x *AnswerQuestionReq) GetSn() string { + if x != nil { + return x.Sn + } + return "" +} + +func (x *AnswerQuestionReq) GetAnswer() string { + if x != nil { + return x.Answer + } + return "" +} + +type AnswerQuestionResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Answer string `protobuf:"bytes,1,opt,name=Answer,json=answer,proto3" json:"Answer,omitempty"` // 答案 + Explanation string `protobuf:"bytes,2,opt,name=Explanation,json=explanation,proto3" json:"Explanation,omitempty"` // 解析 +} + +func (x *AnswerQuestionResp) Reset() { + *x = AnswerQuestionResp{} + if protoimpl.UnsafeEnabled { + mi := &file_service_user_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AnswerQuestionResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AnswerQuestionResp) ProtoMessage() {} + +func (x *AnswerQuestionResp) ProtoReflect() protoreflect.Message { + mi := &file_service_user_proto_msgTypes[9] + 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 AnswerQuestionResp.ProtoReflect.Descriptor instead. +func (*AnswerQuestionResp) Descriptor() ([]byte, []int) { + return file_service_user_proto_rawDescGZIP(), []int{9} +} + +func (x *AnswerQuestionResp) GetAnswer() string { + if x != nil { + return x.Answer + } + return "" +} + +func (x *AnswerQuestionResp) GetExplanation() string { + if x != nil { + return x.Explanation + } + return "" +} + +var File_service_user_proto protoreflect.FileDescriptor + +var file_service_user_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, + 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x31, 0x0a, 0x09, 0x4c, 0x6f, 0x67, + 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x22, 0x0a, 0x0e, + 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x10, + 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x73, 0x6e, + 0x22, 0x37, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x43, 0x0a, 0x13, 0x47, 0x65, 0x6e, + 0x65, 0x72, 0x61, 0x74, 0x65, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x12, 0x10, 0x0a, 0x03, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6e, + 0x75, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x22, 0x16, + 0x0a, 0x14, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x10, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, + 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x22, 0x57, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x51, + 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x53, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x73, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x51, + 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x22, 0x3b, 0x0a, 0x11, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x51, 0x75, 0x65, 0x73, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x53, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x73, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x22, 0x4e, + 0x0a, 0x12, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, + 0x45, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x84, + 0x03, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, + 0x12, 0x09, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0a, 0x2e, 0x4c, 0x6f, + 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x0b, 0x47, 0x65, 0x74, + 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, + 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x55, + 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x22, 0x15, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x0f, 0x3a, 0x01, 0x2a, 0x22, 0x0a, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x69, 0x6e, + 0x66, 0x6f, 0x12, 0x63, 0x0a, 0x10, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x51, 0x75, + 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, + 0x65, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x47, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x3a, 0x01, 0x2a, 0x22, 0x17, + 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4f, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x51, 0x75, + 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x73, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, + 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x17, 0x3a, 0x01, 0x2a, 0x22, 0x12, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x74, 0x5f, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x5b, 0x0a, 0x0e, 0x41, 0x6e, 0x73, 0x77, + 0x65, 0x72, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x2e, 0x41, 0x6e, 0x73, + 0x77, 0x65, 0x72, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x13, + 0x2e, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x3a, 0x01, 0x2a, 0x22, 0x15, + 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x5f, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, + 0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_service_user_proto_rawDescOnce sync.Once + file_service_user_proto_rawDescData = file_service_user_proto_rawDesc +) + +func file_service_user_proto_rawDescGZIP() []byte { + file_service_user_proto_rawDescOnce.Do(func() { + file_service_user_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_user_proto_rawDescData) + }) + return file_service_user_proto_rawDescData +} + +var file_service_user_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_service_user_proto_goTypes = []interface{}{ + (*LoginReq)(nil), // 0: LoginReq + (*LoginResp)(nil), // 1: LoginResp + (*GetUserInfoReq)(nil), // 2: GetUserInfoReq + (*GetUserInfoResp)(nil), // 3: GetUserInfoResp + (*GenerateQuestionReq)(nil), // 4: GenerateQuestionReq + (*GenerateQuestionResp)(nil), // 5: GenerateQuestionResp + (*GetQuestionReq)(nil), // 6: GetQuestionReq + (*GetQuestionResp)(nil), // 7: GetQuestionResp + (*AnswerQuestionReq)(nil), // 8: AnswerQuestionReq + (*AnswerQuestionResp)(nil), // 9: AnswerQuestionResp +} +var file_service_user_proto_depIdxs = []int32{ + 0, // 0: User.Login:input_type -> LoginReq + 2, // 1: User.GetUserInfo:input_type -> GetUserInfoReq + 4, // 2: User.GenerateQuestion:input_type -> GenerateQuestionReq + 6, // 3: User.GetQuestion:input_type -> GetQuestionReq + 8, // 4: User.AnswerQuestion:input_type -> AnswerQuestionReq + 1, // 5: User.Login:output_type -> LoginResp + 3, // 6: User.GetUserInfo:output_type -> GetUserInfoResp + 5, // 7: User.GenerateQuestion:output_type -> GenerateQuestionResp + 7, // 8: User.GetQuestion:output_type -> GetQuestionResp + 9, // 9: User.AnswerQuestion:output_type -> AnswerQuestionResp + 5, // [5:10] is the sub-list for method output_type + 0, // [0:5] 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_service_user_proto_init() } +func file_service_user_proto_init() { + if File_service_user_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_service_user_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LoginReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_user_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LoginResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_user_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUserInfoReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_user_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUserInfoResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_user_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenerateQuestionReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_user_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenerateQuestionResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_user_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetQuestionReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_user_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetQuestionResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_user_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AnswerQuestionReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_user_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AnswerQuestionResp); 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_service_user_proto_rawDesc, + NumEnums: 0, + NumMessages: 10, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_user_proto_goTypes, + DependencyIndexes: file_service_user_proto_depIdxs, + MessageInfos: file_service_user_proto_msgTypes, + }.Build() + File_service_user_proto = out.File + file_service_user_proto_rawDesc = nil + file_service_user_proto_goTypes = nil + file_service_user_proto_depIdxs = nil +} diff --git a/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_user.pb.gw.go b/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_user.pb.gw.go new file mode 100644 index 0000000..417d42a --- /dev/null +++ b/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_user.pb.gw.go @@ -0,0 +1,343 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: service_user.proto + +/* +Package grpc_pb is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package grpc_pb + +import ( + "context" + "errors" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var ( + _ codes.Code + _ io.Reader + _ status.Status + _ = errors.New + _ = runtime.String + _ = utilities.NewDoubleArray + _ = metadata.Join +) + +func request_User_GetUserInfo_0(ctx context.Context, marshaler runtime.Marshaler, client UserClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GetUserInfoReq + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.GetUserInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_User_GetUserInfo_0(ctx context.Context, marshaler runtime.Marshaler, server UserServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GetUserInfoReq + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.GetUserInfo(ctx, &protoReq) + return msg, metadata, err +} + +func request_User_GenerateQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client UserClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GenerateQuestionReq + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.GenerateQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_User_GenerateQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server UserServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GenerateQuestionReq + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.GenerateQuestion(ctx, &protoReq) + return msg, metadata, err +} + +func request_User_GetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client UserClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GetQuestionReq + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.GetQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_User_GetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server UserServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GetQuestionReq + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.GetQuestion(ctx, &protoReq) + return msg, metadata, err +} + +func request_User_AnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client UserClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq AnswerQuestionReq + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.AnswerQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_User_AnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server UserServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq AnswerQuestionReq + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.AnswerQuestion(ctx, &protoReq) + return msg, metadata, err +} + +// RegisterUserHandlerServer registers the http handlers for service User to "mux". +// UnaryRPC :call UserServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterUserHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. +func RegisterUserHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServer) error { + mux.Handle(http.MethodPost, pattern_User_GetUserInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.User/GetUserInfo", runtime.WithHTTPPathPattern("/user/info")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_User_GetUserInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_User_GetUserInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_User_GenerateQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.User/GenerateQuestion", runtime.WithHTTPPathPattern("/user/generate_question")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_User_GenerateQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_User_GenerateQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_User_GetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.User/GetQuestion", runtime.WithHTTPPathPattern("/user/get_question")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_User_GetQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_User_GetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_User_AnswerQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.User/AnswerQuestion", runtime.WithHTTPPathPattern("/user/answer_question")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_User_AnswerQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_User_AnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + + return nil +} + +// RegisterUserHandlerFromEndpoint is same as RegisterUserHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterUserHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.NewClient(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + return RegisterUserHandler(ctx, mux, conn) +} + +// RegisterUserHandler registers the http handlers for service User to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterUserHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterUserHandlerClient(ctx, mux, NewUserClient(conn)) +} + +// RegisterUserHandlerClient registers the http handlers for service User +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "UserClient" to call the correct interceptors. This client ignores the HTTP middlewares. +func RegisterUserHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserClient) error { + mux.Handle(http.MethodPost, pattern_User_GetUserInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.User/GetUserInfo", runtime.WithHTTPPathPattern("/user/info")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_User_GetUserInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_User_GetUserInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_User_GenerateQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.User/GenerateQuestion", runtime.WithHTTPPathPattern("/user/generate_question")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_User_GenerateQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_User_GenerateQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_User_GetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.User/GetQuestion", runtime.WithHTTPPathPattern("/user/get_question")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_User_GetQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_User_GetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_User_AnswerQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.User/AnswerQuestion", runtime.WithHTTPPathPattern("/user/answer_question")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_User_AnswerQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_User_AnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + return nil +} + +var ( + pattern_User_GetUserInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"user", "info"}, "")) + pattern_User_GenerateQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"user", "generate_question"}, "")) + pattern_User_GetQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"user", "get_question"}, "")) + pattern_User_AnswerQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"user", "answer_question"}, "")) +) + +var ( + forward_User_GetUserInfo_0 = runtime.ForwardResponseMessage + forward_User_GenerateQuestion_0 = runtime.ForwardResponseMessage + forward_User_GetQuestion_0 = runtime.ForwardResponseMessage + forward_User_AnswerQuestion_0 = runtime.ForwardResponseMessage +) diff --git a/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_user_grpc.pb.go b/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_user_grpc.pb.go similarity index 52% rename from Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_user_grpc.pb.go rename to Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_user_grpc.pb.go index a539483..5db4b4a 100644 --- a/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_user_grpc.pb.go +++ b/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_user_grpc.pb.go @@ -24,6 +24,9 @@ const _ = grpc.SupportPackageIsVersion7 type UserClient interface { Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error) GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error) + GenerateQuestion(ctx context.Context, in *GenerateQuestionReq, opts ...grpc.CallOption) (*GenerateQuestionResp, error) + GetQuestion(ctx context.Context, in *GetQuestionReq, opts ...grpc.CallOption) (*GetQuestionResp, error) + AnswerQuestion(ctx context.Context, in *AnswerQuestionReq, opts ...grpc.CallOption) (*AnswerQuestionResp, error) } type userClient struct { @@ -52,12 +55,42 @@ func (c *userClient) GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts . return out, nil } +func (c *userClient) GenerateQuestion(ctx context.Context, in *GenerateQuestionReq, opts ...grpc.CallOption) (*GenerateQuestionResp, error) { + out := new(GenerateQuestionResp) + err := c.cc.Invoke(ctx, "/User/GenerateQuestion", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userClient) GetQuestion(ctx context.Context, in *GetQuestionReq, opts ...grpc.CallOption) (*GetQuestionResp, error) { + out := new(GetQuestionResp) + err := c.cc.Invoke(ctx, "/User/GetQuestion", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userClient) AnswerQuestion(ctx context.Context, in *AnswerQuestionReq, opts ...grpc.CallOption) (*AnswerQuestionResp, error) { + out := new(AnswerQuestionResp) + err := c.cc.Invoke(ctx, "/User/AnswerQuestion", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // UserServer is the server API for User service. // All implementations must embed UnimplementedUserServer // for forward compatibility type UserServer interface { Login(context.Context, *LoginReq) (*LoginResp, error) GetUserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResp, error) + GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error) + GetQuestion(context.Context, *GetQuestionReq) (*GetQuestionResp, error) + AnswerQuestion(context.Context, *AnswerQuestionReq) (*AnswerQuestionResp, error) mustEmbedUnimplementedUserServer() } @@ -71,6 +104,15 @@ func (UnimplementedUserServer) Login(context.Context, *LoginReq) (*LoginResp, er func (UnimplementedUserServer) GetUserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResp, error) { return nil, status.Errorf(codes.Unimplemented, "method GetUserInfo not implemented") } +func (UnimplementedUserServer) GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method GenerateQuestion not implemented") +} +func (UnimplementedUserServer) GetQuestion(context.Context, *GetQuestionReq) (*GetQuestionResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetQuestion not implemented") +} +func (UnimplementedUserServer) AnswerQuestion(context.Context, *AnswerQuestionReq) (*AnswerQuestionResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method AnswerQuestion not implemented") +} func (UnimplementedUserServer) mustEmbedUnimplementedUserServer() {} // UnsafeUserServer may be embedded to opt out of forward compatibility for this service. @@ -120,6 +162,60 @@ func _User_GetUserInfo_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _User_GenerateQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GenerateQuestionReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServer).GenerateQuestion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/User/GenerateQuestion", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServer).GenerateQuestion(ctx, req.(*GenerateQuestionReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _User_GetQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetQuestionReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServer).GetQuestion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/User/GetQuestion", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServer).GetQuestion(ctx, req.(*GetQuestionReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _User_AnswerQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AnswerQuestionReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServer).AnswerQuestion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/User/AnswerQuestion", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServer).AnswerQuestion(ctx, req.(*AnswerQuestionReq)) + } + return interceptor(ctx, in, info, handler) +} + // User_ServiceDesc is the grpc.ServiceDesc for User service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -135,6 +231,18 @@ var User_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetUserInfo", Handler: _User_GetUserInfo_Handler, }, + { + MethodName: "GenerateQuestion", + Handler: _User_GenerateQuestion_Handler, + }, + { + MethodName: "GetQuestion", + Handler: _User_GetQuestion_Handler, + }, + { + MethodName: "AnswerQuestion", + Handler: _User_AnswerQuestion_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "service_user.proto", diff --git a/Proto/ServerInternal/gen/common/proto/ss/ss_common/ss_common.pb.go b/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/ss_common/ss_common.pb.go similarity index 90% rename from Proto/ServerInternal/gen/common/proto/ss/ss_common/ss_common.pb.go rename to Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/ss_common/ss_common.pb.go index 5881aae..186d174 100644 --- a/Proto/ServerInternal/gen/common/proto/ss/ss_common/ss_common.pb.go +++ b/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/ss_common/ss_common.pb.go @@ -82,9 +82,11 @@ var file_ss_common_proto_rawDesc = []byte{ 0x6f, 0x22, 0x31, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x4d, 0x73, 0x67, 0x42, 0x1b, 0x5a, 0x19, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, - 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x03, 0x4d, 0x73, 0x67, 0x42, 0x38, 0x5a, 0x36, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, + 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/Proto/ServerInternal/gen/service_scene.swagger.json b/Proto/ServerInternal/gen/service_scene.swagger.json index 0728fe0..5e4e7e6 100644 --- a/Proto/ServerInternal/gen/service_scene.swagger.json +++ b/Proto/ServerInternal/gen/service_scene.swagger.json @@ -25,12 +25,10 @@ "properties": { "SceneSID": { "type": "string", - "format": "int64", "title": "场景服务ID" }, "UniqueNo": { "type": "string", - "format": "int64", "title": "副本唯一编号" }, "MessageID": { diff --git a/Proto/ServerInternal/gen/service_user.swagger.json b/Proto/ServerInternal/gen/service_user.swagger.json index 3e69baf..5b24487 100644 --- a/Proto/ServerInternal/gen/service_user.swagger.json +++ b/Proto/ServerInternal/gen/service_user.swagger.json @@ -16,6 +16,102 @@ "application/json" ], "paths": { + "/user/answer_question": { + "post": { + "operationId": "User_AnswerQuestion", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/AnswerQuestionResp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AnswerQuestionReq" + } + } + ], + "tags": [ + "User" + ] + } + }, + "/user/generate_question": { + "post": { + "operationId": "User_GenerateQuestion", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/GenerateQuestionResp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/GenerateQuestionReq" + } + } + ], + "tags": [ + "User" + ] + } + }, + "/user/get_question": { + "post": { + "operationId": "User_GetQuestion", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/GetQuestionResp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/GetQuestionReq" + } + } + ], + "tags": [ + "User" + ] + } + }, "/user/info": { "post": { "operationId": "User_GetUserInfo", @@ -50,21 +146,89 @@ } }, "definitions": { + "AnswerQuestionReq": { + "type": "object", + "properties": { + "sn": { + "type": "string", + "title": "题目唯一标识" + }, + "answer": { + "type": "string", + "title": "答案" + } + }, + "title": "---------- AnswerQuestion ----------" + }, + "AnswerQuestionResp": { + "type": "object", + "properties": { + "answer": { + "type": "string", + "title": "答案" + }, + "explanation": { + "type": "string", + "title": "解析" + } + } + }, + "GenerateQuestionReq": { + "type": "object", + "properties": { + "num": { + "type": "integer", + "format": "int32", + "title": "生成数量" + }, + "Category": { + "type": "string", + "title": "题目类型" + } + }, + "title": "---------- GenerateQuestion ----------" + }, + "GenerateQuestionResp": { + "type": "object" + }, + "GetQuestionReq": { + "type": "object", + "title": "---------- GetQuestion ----------" + }, + "GetQuestionResp": { + "type": "object", + "properties": { + "sn": { + "type": "string", + "title": "题目唯一标识" + }, + "question": { + "type": "string", + "title": "题干" + }, + "options": { + "type": "array", + "items": { + "type": "string" + }, + "title": "选项" + } + } + }, "GetUserInfoReq": { "type": "object", "properties": { "usn": { - "type": "string", - "format": "int64" + "type": "string" } - } + }, + "title": "---------- GetUserInfo ----------" }, "GetUserInfoResp": { "type": "object", "properties": { "usn": { - "type": "string", - "format": "int64" + "type": "string" }, "name": { "type": "string" @@ -76,7 +240,6 @@ "properties": { "usn": { "type": "string", - "format": "int64", "title": "用户ID" }, "name": { diff --git a/Proto/ServerInternal/sources/service_gateway.proto b/Proto/ServerInternal/sources/service_gateway.proto index ab6fa53..4fedab2 100644 --- a/Proto/ServerInternal/sources/service_gateway.proto +++ b/Proto/ServerInternal/sources/service_gateway.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -option go_package = "common/proto/ss/grpc_pb"; +option go_package = "git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb"; import "ss_common.proto"; service Gateway { @@ -10,7 +10,7 @@ service Gateway { } message ToClientReq { - int64 USN = 1; + string USN = 1; int32 MessageID = 2; bytes Payload = 3; } @@ -19,7 +19,7 @@ message ToClientResp { } message KickUserReq { - int64 USN = 1; + string USN = 1; } message KickUserResp { diff --git a/Proto/ServerInternal/sources/service_scene.proto b/Proto/ServerInternal/sources/service_scene.proto index c2433df..ecdb0d5 100644 --- a/Proto/ServerInternal/sources/service_scene.proto +++ b/Proto/ServerInternal/sources/service_scene.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -option go_package = "common/proto/ss/grpc_pb"; +option go_package = "git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb"; import "ss_common.proto"; service Scene { @@ -10,29 +10,29 @@ service Scene { } message EnterReq { - int64 USN = 1; // 用户ID - int64 GatewaySID = 2; // 网关服务ID + string USN = 1; // 用户ID + string GatewaySID = 2; // 网关服务ID int32 InstanceID = 3; // 副本ID } message EnterResp { - int64 SceneSID = 1; // 场景服务ID - int64 UniqueNo = 2; // 副本唯一编号 + string SceneSID = 1; // 场景服务ID + string UniqueNo = 2; // 副本唯一编号 int32 MessageID = 3; // 发送给客户端的消息ID bytes Payload = 4; // 消息负载 } message LeaveReq { - int64 USN = 1; // 用户ID - int64 UniqueNo = 2; // 副本唯一编号 + string USN = 1; // 用户ID + string UniqueNo = 2; // 副本唯一编号 } message LeaveResp { } message ActionReq { - int64 UniqueNo = 1; // 副本唯一编号 - int64 USN = 2; // 用户ID + string UniqueNo = 1; // 副本唯一编号 + string USN = 2; // 用户ID int32 Action = 3; // 指令ID sint32 DirX = 4; // 移动-X方向(×1000 缩放) sint32 DirY = 5; // 移动-Y方向(×1000 缩放) diff --git a/Proto/ServerInternal/sources/service_user.proto b/Proto/ServerInternal/sources/service_user.proto index 0734a20..16ceee7 100644 --- a/Proto/ServerInternal/sources/service_user.proto +++ b/Proto/ServerInternal/sources/service_user.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -option go_package = "common/proto/ss/grpc_pb"; +option go_package = "git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb"; import "ss_common.proto"; import "google/api/annotations.proto"; @@ -12,23 +12,68 @@ service User { body: "*" }; } + rpc GenerateQuestion(GenerateQuestionReq) returns (GenerateQuestionResp) { + option (google.api.http) = { + post: "/user/generate_question" + body: "*" + }; + } + rpc GetQuestion(GetQuestionReq) returns (GetQuestionResp) { + option (google.api.http) = { + post: "/user/get_question" + body: "*" + }; + } + rpc AnswerQuestion(AnswerQuestionReq) returns (AnswerQuestionResp) { + option (google.api.http) = { + post: "/user/answer_question" + body: "*" + }; + } } +// ---------- Login ---------- message LoginReq { string Phone = 1 [json_name = "phone"]; // 手机号 string Code = 2 [json_name = "code"]; // 验证码 } - message LoginResp { - int64 USN = 1 [json_name = "usn"]; // 用户ID + string USN = 1 [json_name = "usn"]; // 用户ID string Name = 2 [json_name = "name"]; // 用户名 } +// ---------- GetUserInfo ---------- message GetUserInfoReq { - int64 USN = 1 [json_name = "usn"]; + string USN = 1 [json_name = "usn"]; +} +message GetUserInfoResp { + string USN = 1 [json_name = "usn"]; + string Name = 2 [json_name = "name"]; } -message GetUserInfoResp { - int64 USN = 1 [json_name = "usn"]; - string Name = 2 [json_name = "name"]; +// ---------- GenerateQuestion ---------- +message GenerateQuestionReq { + int32 Num = 1 [json_name = "num"]; // 生成数量 + string Category = 2 [json_name = "Category"]; // 题目类型 +} +message GenerateQuestionResp { +} + +// ---------- GetQuestion ---------- +message GetQuestionReq { +} +message GetQuestionResp { + string Sn = 1 [json_name = "sn"]; // 题目唯一标识 + string Question = 2 [json_name = "question"]; // 题干 + repeated string Options = 3 [json_name = "options"]; // 选项 +} + +// ---------- AnswerQuestion ---------- +message AnswerQuestionReq { + string Sn = 1 [json_name = "sn"]; // 题目唯一标识 + string Answer = 2 [json_name = "answer"]; // 答案 +} +message AnswerQuestionResp { + string Answer = 1 [json_name = "answer"]; // 答案 + string Explanation = 2 [json_name = "explanation"]; // 解析 } \ No newline at end of file diff --git a/Proto/ServerInternal/sources/ss_common.proto b/Proto/ServerInternal/sources/ss_common.proto index d3b542a..c3a0a73 100644 --- a/Proto/ServerInternal/sources/ss_common.proto +++ b/Proto/ServerInternal/sources/ss_common.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -option go_package = "common/proto/ss/ss_common"; +option go_package = "git.hlsq.asia/mmorpg/service-common/proto/ss/ss_common"; message ErrorInfo { int32 Code = 1; diff --git a/Publish/doc.txt b/Publish/doc.txt index 3cea4b1..544f1c3 100644 --- a/Publish/doc.txt +++ b/Publish/doc.txt @@ -52,13 +52,17 @@ registry验证:htpasswd -Bbn admin pD4hC1jY1bB0pY4kF4tC > ./registry_passwd Jenkins账密:admin 4f848ffe54ef45eda56eebd62bc90ea0 Grafana账密:admin pT1rA0yL0mK3iA8tJ4kE + +etcd通道 ssh -L 2379:localhost:2379 root@47.108.184.184 yT1vU8fH5mP0rQ6h - -registry命令: -curl -XGET -u admin:pD4hC1jY1bB0pY4kF4tC http://127.0.0.1:5000/v2/_catalog -curl -XGET -u admin:pD4hC1jY1bB0pY4kF4tC http://127.0.0.1:5000/v2/server-gateway/tags/list - +生成ssh ssh-keygen -t rsa -b 4096 -C "jenkins-to-aliyun" -f ~/.ssh/jenkins -N "" +生成mock代码 mockgen -source ./proto/ss/grpc_pb/service_user_grpc.pb.go -destination ./proto/ss/grpc_pb/mocks/service_user_grpc.pb.go -package mocks + +交叉编译: +sudo docker run --rm --privileged tonistiigi/binfmt --install all +sudo docker buildx create --name multi-arch-builder --use --bootstrap +sudo docker buildx inspect diff --git a/Tools/mysql_model/gen.ps1 b/Tools/mysql_model/gen.ps1 index a3a76c1..bd2ccaf 100644 --- a/Tools/mysql_model/gen.ps1 +++ b/Tools/mysql_model/gen.ps1 @@ -6,11 +6,11 @@ Get-ChildItem ./user_db/model/*.gen.go | ForEach-Object { $c = Get-Content $_.FullName -Raw -Encoding UTF8 - if ($c -match '\bSn\s+int64\b' -and $c -notmatch 'BeforeCreate') { + if ($c -match '\bSn\s+string\b' -and $c -notmatch 'BeforeCreate') { $c -match 'type\s+(\w+)\s+struct' | Out-Null $n = $matches[1] - $c = $c -replace '(?s)(import\s*\([^)]*)', "`$1`t`"common/utils`"`n" - $hook = "`n`n// auto sn`nfunc (m *$n) BeforeCreate(_ *gorm.DB) error {`n`tif m.Sn == 0 {`n`t`tm.Sn = utils.SnowflakeInstance().Generate().Int64()`n`t}`n`treturn nil`n}" + $c = $c -replace '(?s)(import\s*\([^)]*)', "`$1`t`"git.hlsq.asia/mmorpg/service-common/utils`"`n" + $hook = "`n`n// Auto sn`nfunc (m *$n) BeforeCreate(_ *gorm.DB) error {`n`tif m.Sn == `"`" {`n`t`tm.Sn = utils.SnowflakeInstance().Generate().String()`n`t}`n`treturn nil`n}" Set-Content $_.FullName ($c.TrimEnd() + $hook) -Encoding UTF8 } } \ No newline at end of file diff --git a/Tools/mysql_model/user_db/model/questions.gen.go b/Tools/mysql_model/user_db/model/questions.gen.go new file mode 100644 index 0000000..1ca8c73 --- /dev/null +++ b/Tools/mysql_model/user_db/model/questions.gen.go @@ -0,0 +1,42 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package model + +import ( + "time" + + "gorm.io/gorm" + "git.hlsq.asia/mmorpg/service-common/utils" +) + +const TableNameQuestion = "questions" + +// Question mapped from table +type Question struct { + ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"` + Sn string `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号 + Question string `gorm:"column:question;not null;comment:题干" json:"question"` // 题干 + Options string `gorm:"column:options;not null;comment:选项" json:"options"` // 选项 + Answer string `gorm:"column:answer;not null;comment:答案" json:"answer"` // 答案 + Explanation string `gorm:"column:explanation;not null;comment:解析" json:"explanation"` // 解析 + Difficulty int32 `gorm:"column:difficulty;not null;comment:难度分 0 - 100" json:"difficulty"` // 难度分 0 - 100 + Category string `gorm:"column:category;not null;comment:分类" json:"category"` // 分类 + CreatedAt time.Time `gorm:"column:created_at;not null" json:"created_at"` + UpdatedAt time.Time `gorm:"column:updated_at;not null" json:"updated_at"` + DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" json:"deleted_at"` +} + +// TableName Question's table name +func (*Question) TableName() string { + return TableNameQuestion +} + +// Auto sn +func (m *Question) BeforeCreate(_ *gorm.DB) error { + if m.Sn == "" { + m.Sn = utils.SnowflakeInstance().Generate().String() + } + return nil +} diff --git a/Tools/mysql_model/user_db/model/users.gen.go b/Tools/mysql_model/user_db/model/users.gen.go index 548d913..db3c7fa 100644 --- a/Tools/mysql_model/user_db/model/users.gen.go +++ b/Tools/mysql_model/user_db/model/users.gen.go @@ -8,7 +8,7 @@ import ( "time" "gorm.io/gorm" - "common/utils" + "git.hlsq.asia/mmorpg/service-common/utils" ) const TableNameUser = "users" @@ -16,7 +16,7 @@ const TableNameUser = "users" // User mapped from table type User struct { ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"` - Sn int64 `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号 + Sn string `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号 Name string `gorm:"column:name;not null" json:"name"` Phone string `gorm:"column:phone;not null" json:"phone"` CreatedAt time.Time `gorm:"column:created_at;not null" json:"created_at"` @@ -29,10 +29,10 @@ func (*User) TableName() string { return TableNameUser } -// auto sn +// Auto sn func (m *User) BeforeCreate(_ *gorm.DB) error { - if m.Sn == 0 { - m.Sn = utils.SnowflakeInstance().Generate().Int64() + if m.Sn == "" { + m.Sn = utils.SnowflakeInstance().Generate().String() } return nil } diff --git a/Tools/mysql_model/user_db/query/gen.go b/Tools/mysql_model/user_db/query/gen.go index d067772..4adcef8 100644 --- a/Tools/mysql_model/user_db/query/gen.go +++ b/Tools/mysql_model/user_db/query/gen.go @@ -17,23 +17,26 @@ import ( func Use(db *gorm.DB, opts ...gen.DOOption) *Query { return &Query{ - db: db, - User: newUser(db, opts...), + db: db, + Question: newQuestion(db, opts...), + User: newUser(db, opts...), } } type Query struct { db *gorm.DB - User user + Question question + User user } func (q *Query) Available() bool { return q.db != nil } func (q *Query) clone(db *gorm.DB) *Query { return &Query{ - db: db, - User: q.User.clone(db), + db: db, + Question: q.Question.clone(db), + User: q.User.clone(db), } } @@ -47,18 +50,21 @@ func (q *Query) WriteDB() *Query { func (q *Query) ReplaceDB(db *gorm.DB) *Query { return &Query{ - db: db, - User: q.User.replaceDB(db), + db: db, + Question: q.Question.replaceDB(db), + User: q.User.replaceDB(db), } } type queryCtx struct { - User *userDo + Question *questionDo + User *userDo } func (q *Query) WithContext(ctx context.Context) *queryCtx { return &queryCtx{ - User: q.User.WithContext(ctx), + Question: q.Question.WithContext(ctx), + User: q.User.WithContext(ctx), } } diff --git a/Tools/mysql_model/user_db/query/questions.gen.go b/Tools/mysql_model/user_db/query/questions.gen.go new file mode 100644 index 0000000..9959d5b --- /dev/null +++ b/Tools/mysql_model/user_db/query/questions.gen.go @@ -0,0 +1,365 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package query + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" +) + +func newQuestion(db *gorm.DB, opts ...gen.DOOption) question { + _question := question{} + + _question.questionDo.UseDB(db, opts...) + _question.questionDo.UseModel(&model.Question{}) + + tableName := _question.questionDo.TableName() + _question.ALL = field.NewAsterisk(tableName) + _question.ID = field.NewUint64(tableName, "id") + _question.Sn = field.NewString(tableName, "sn") + _question.Question = field.NewString(tableName, "question") + _question.Options = field.NewString(tableName, "options") + _question.Answer = field.NewString(tableName, "answer") + _question.Explanation = field.NewString(tableName, "explanation") + _question.Difficulty = field.NewInt32(tableName, "difficulty") + _question.Category = field.NewString(tableName, "category") + _question.CreatedAt = field.NewTime(tableName, "created_at") + _question.UpdatedAt = field.NewTime(tableName, "updated_at") + _question.DeletedAt = field.NewField(tableName, "deleted_at") + + _question.fillFieldMap() + + return _question +} + +type question struct { + questionDo questionDo + + ALL field.Asterisk + ID field.Uint64 + Sn field.String // 业务唯一编号 + Question field.String // 题干 + Options field.String // 选项 + Answer field.String // 答案 + Explanation field.String // 解析 + Difficulty field.Int32 // 难度分 0 - 100 + Category field.String // 分类 + CreatedAt field.Time + UpdatedAt field.Time + DeletedAt field.Field + + fieldMap map[string]field.Expr +} + +func (q question) Table(newTableName string) *question { + q.questionDo.UseTable(newTableName) + return q.updateTableName(newTableName) +} + +func (q question) As(alias string) *question { + q.questionDo.DO = *(q.questionDo.As(alias).(*gen.DO)) + return q.updateTableName(alias) +} + +func (q *question) updateTableName(table string) *question { + q.ALL = field.NewAsterisk(table) + q.ID = field.NewUint64(table, "id") + q.Sn = field.NewString(table, "sn") + q.Question = field.NewString(table, "question") + q.Options = field.NewString(table, "options") + q.Answer = field.NewString(table, "answer") + q.Explanation = field.NewString(table, "explanation") + q.Difficulty = field.NewInt32(table, "difficulty") + q.Category = field.NewString(table, "category") + q.CreatedAt = field.NewTime(table, "created_at") + q.UpdatedAt = field.NewTime(table, "updated_at") + q.DeletedAt = field.NewField(table, "deleted_at") + + q.fillFieldMap() + + return q +} + +func (q *question) WithContext(ctx context.Context) *questionDo { return q.questionDo.WithContext(ctx) } + +func (q question) TableName() string { return q.questionDo.TableName() } + +func (q question) Alias() string { return q.questionDo.Alias() } + +func (q question) Columns(cols ...field.Expr) gen.Columns { return q.questionDo.Columns(cols...) } + +func (q *question) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := q.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (q *question) fillFieldMap() { + q.fieldMap = make(map[string]field.Expr, 11) + q.fieldMap["id"] = q.ID + q.fieldMap["sn"] = q.Sn + q.fieldMap["question"] = q.Question + q.fieldMap["options"] = q.Options + q.fieldMap["answer"] = q.Answer + q.fieldMap["explanation"] = q.Explanation + q.fieldMap["difficulty"] = q.Difficulty + q.fieldMap["category"] = q.Category + q.fieldMap["created_at"] = q.CreatedAt + q.fieldMap["updated_at"] = q.UpdatedAt + q.fieldMap["deleted_at"] = q.DeletedAt +} + +func (q question) clone(db *gorm.DB) question { + q.questionDo.ReplaceConnPool(db.Statement.ConnPool) + return q +} + +func (q question) replaceDB(db *gorm.DB) question { + q.questionDo.ReplaceDB(db) + return q +} + +type questionDo struct{ gen.DO } + +func (q questionDo) Debug() *questionDo { + return q.withDO(q.DO.Debug()) +} + +func (q questionDo) WithContext(ctx context.Context) *questionDo { + return q.withDO(q.DO.WithContext(ctx)) +} + +func (q questionDo) ReadDB() *questionDo { + return q.Clauses(dbresolver.Read) +} + +func (q questionDo) WriteDB() *questionDo { + return q.Clauses(dbresolver.Write) +} + +func (q questionDo) Session(config *gorm.Session) *questionDo { + return q.withDO(q.DO.Session(config)) +} + +func (q questionDo) Clauses(conds ...clause.Expression) *questionDo { + return q.withDO(q.DO.Clauses(conds...)) +} + +func (q questionDo) Returning(value interface{}, columns ...string) *questionDo { + return q.withDO(q.DO.Returning(value, columns...)) +} + +func (q questionDo) Not(conds ...gen.Condition) *questionDo { + return q.withDO(q.DO.Not(conds...)) +} + +func (q questionDo) Or(conds ...gen.Condition) *questionDo { + return q.withDO(q.DO.Or(conds...)) +} + +func (q questionDo) Select(conds ...field.Expr) *questionDo { + return q.withDO(q.DO.Select(conds...)) +} + +func (q questionDo) Where(conds ...gen.Condition) *questionDo { + return q.withDO(q.DO.Where(conds...)) +} + +func (q questionDo) Order(conds ...field.Expr) *questionDo { + return q.withDO(q.DO.Order(conds...)) +} + +func (q questionDo) Distinct(cols ...field.Expr) *questionDo { + return q.withDO(q.DO.Distinct(cols...)) +} + +func (q questionDo) Omit(cols ...field.Expr) *questionDo { + return q.withDO(q.DO.Omit(cols...)) +} + +func (q questionDo) Join(table schema.Tabler, on ...field.Expr) *questionDo { + return q.withDO(q.DO.Join(table, on...)) +} + +func (q questionDo) LeftJoin(table schema.Tabler, on ...field.Expr) *questionDo { + return q.withDO(q.DO.LeftJoin(table, on...)) +} + +func (q questionDo) RightJoin(table schema.Tabler, on ...field.Expr) *questionDo { + return q.withDO(q.DO.RightJoin(table, on...)) +} + +func (q questionDo) Group(cols ...field.Expr) *questionDo { + return q.withDO(q.DO.Group(cols...)) +} + +func (q questionDo) Having(conds ...gen.Condition) *questionDo { + return q.withDO(q.DO.Having(conds...)) +} + +func (q questionDo) Limit(limit int) *questionDo { + return q.withDO(q.DO.Limit(limit)) +} + +func (q questionDo) Offset(offset int) *questionDo { + return q.withDO(q.DO.Offset(offset)) +} + +func (q questionDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *questionDo { + return q.withDO(q.DO.Scopes(funcs...)) +} + +func (q questionDo) Unscoped() *questionDo { + return q.withDO(q.DO.Unscoped()) +} + +func (q questionDo) Create(values ...*model.Question) error { + if len(values) == 0 { + return nil + } + return q.DO.Create(values) +} + +func (q questionDo) CreateInBatches(values []*model.Question, batchSize int) error { + return q.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (q questionDo) Save(values ...*model.Question) error { + if len(values) == 0 { + return nil + } + return q.DO.Save(values) +} + +func (q questionDo) First() (*model.Question, error) { + if result, err := q.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.Question), nil + } +} + +func (q questionDo) Take() (*model.Question, error) { + if result, err := q.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.Question), nil + } +} + +func (q questionDo) Last() (*model.Question, error) { + if result, err := q.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.Question), nil + } +} + +func (q questionDo) Find() ([]*model.Question, error) { + result, err := q.DO.Find() + return result.([]*model.Question), err +} + +func (q questionDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Question, err error) { + buf := make([]*model.Question, 0, batchSize) + err = q.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (q questionDo) FindInBatches(result *[]*model.Question, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return q.DO.FindInBatches(result, batchSize, fc) +} + +func (q questionDo) Attrs(attrs ...field.AssignExpr) *questionDo { + return q.withDO(q.DO.Attrs(attrs...)) +} + +func (q questionDo) Assign(attrs ...field.AssignExpr) *questionDo { + return q.withDO(q.DO.Assign(attrs...)) +} + +func (q questionDo) Joins(fields ...field.RelationField) *questionDo { + for _, _f := range fields { + q = *q.withDO(q.DO.Joins(_f)) + } + return &q +} + +func (q questionDo) Preload(fields ...field.RelationField) *questionDo { + for _, _f := range fields { + q = *q.withDO(q.DO.Preload(_f)) + } + return &q +} + +func (q questionDo) FirstOrInit() (*model.Question, error) { + if result, err := q.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.Question), nil + } +} + +func (q questionDo) FirstOrCreate() (*model.Question, error) { + if result, err := q.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.Question), nil + } +} + +func (q questionDo) FindByPage(offset int, limit int) (result []*model.Question, count int64, err error) { + result, err = q.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = q.Offset(-1).Limit(-1).Count() + return +} + +func (q questionDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = q.Count() + if err != nil { + return + } + + err = q.Offset(offset).Limit(limit).Scan(result) + return +} + +func (q questionDo) Scan(result interface{}) (err error) { + return q.DO.Scan(result) +} + +func (q questionDo) Delete(models ...*model.Question) (result gen.ResultInfo, err error) { + return q.DO.Delete(models) +} + +func (q *questionDo) withDO(do gen.Dao) *questionDo { + q.DO = *do.(*gen.DO) + return q +} diff --git a/Tools/mysql_model/user_db/query/users.gen.go b/Tools/mysql_model/user_db/query/users.gen.go index eba891f..e821078 100644 --- a/Tools/mysql_model/user_db/query/users.gen.go +++ b/Tools/mysql_model/user_db/query/users.gen.go @@ -26,7 +26,7 @@ func newUser(db *gorm.DB, opts ...gen.DOOption) user { tableName := _user.userDo.TableName() _user.ALL = field.NewAsterisk(tableName) _user.ID = field.NewUint64(tableName, "id") - _user.Sn = field.NewInt64(tableName, "sn") + _user.Sn = field.NewString(tableName, "sn") _user.Name = field.NewString(tableName, "name") _user.Phone = field.NewString(tableName, "phone") _user.CreatedAt = field.NewTime(tableName, "created_at") @@ -43,7 +43,7 @@ type user struct { ALL field.Asterisk ID field.Uint64 - Sn field.Int64 // 业务唯一编号 + Sn field.String // 业务唯一编号 Name field.String Phone field.String CreatedAt field.Time @@ -66,7 +66,7 @@ func (u user) As(alias string) *user { func (u *user) updateTableName(table string) *user { u.ALL = field.NewAsterisk(table) u.ID = field.NewUint64(table, "id") - u.Sn = field.NewInt64(table, "sn") + u.Sn = field.NewString(table, "sn") u.Name = field.NewString(table, "name") u.Phone = field.NewString(table, "phone") u.CreatedAt = field.NewTime(table, "created_at") diff --git a/Tools/tidy.bat b/Tools/tidy.bat deleted file mode 100644 index 79a6e68..0000000 --- a/Tools/tidy.bat +++ /dev/null @@ -1,16 +0,0 @@ -cd ../../Server/common -go mod tidy - -cd ../gateway -go mod tidy - -cd ../robot -go mod tidy - -cd ../scene -go mod tidy - -cd ../user -go mod tidy - -Pause \ No newline at end of file