Compare commits
4 Commits
54bbea8a32
...
1d5bc97cdd
| Author | SHA1 | Date | |
|---|---|---|---|
| 1d5bc97cdd | |||
| 43ca340d54 | |||
| 6bc9f18199 | |||
| 63c8fb678c |
@@ -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<PositionInfo>
|
||||
|
||||
/// <summary>Field number for the "USN" field.</summary>
|
||||
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<PositionInfo>
|
||||
[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<PositionInfo>
|
||||
#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<PositionInfo>
|
||||
[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<PositionInfo>
|
||||
[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<PositionInfo>
|
||||
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<PositionInfo>
|
||||
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<PositionInfo>
|
||||
default:
|
||||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
|
||||
break;
|
||||
case 8: {
|
||||
USN = input.ReadInt64();
|
||||
case 10: {
|
||||
USN = input.ReadString();
|
||||
break;
|
||||
}
|
||||
case 16: {
|
||||
|
||||
@@ -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[] {
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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[] {
|
||||
|
||||
@@ -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{}{}
|
||||
@@ -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 (
|
||||
@@ -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 (
|
||||
@@ -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 (
|
||||
@@ -5,10 +5,8 @@ if not exist "./gen" (
|
||||
)
|
||||
|
||||
protoc --proto_path=./sources --go_out=./gen ./sources/*.proto
|
||||
@REM xcopy "./gen/common" "../../../Server/common" /E /I /Y /Q
|
||||
|
||||
if not exist "./gen/client" (
|
||||
mkdir "./gen/client"
|
||||
)
|
||||
protoc --proto_path=./sources --csharp_out=./gen/client ./sources/*.proto
|
||||
@REM xcopy "./gen/client" "../../../Client/Point/Assets/Scripts/Proto" /E /I /Y /Q
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "common/proto/sc/sc_common";
|
||||
option go_package = "git.hlsq.asia/mmorpg/service-common/proto/sc/sc_common";
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
)
|
||||
@@ -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 (
|
||||
@@ -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 (
|
||||
@@ -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,json=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, 0x63, 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
|
||||
}
|
||||
@@ -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
|
||||
)
|
||||
@@ -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",
|
||||
@@ -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 (
|
||||
@@ -25,12 +25,10 @@
|
||||
"properties": {
|
||||
"SceneSID": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "场景服务ID"
|
||||
},
|
||||
"UniqueNo": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "副本唯一编号"
|
||||
},
|
||||
"MessageID": {
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -11,4 +11,3 @@ protoc ^
|
||||
--grpc-gateway_out=./gen ^
|
||||
--openapiv2_out=./gen ^
|
||||
./sources/*.proto
|
||||
@REM xcopy "./gen/common" "../../../Server/common" /E /I /Y /Q
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 缩放)
|
||||
|
||||
@@ -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 {
|
||||
int64 USN = 1 [json_name = "usn"];
|
||||
string 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"]; // 解析
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
# gen.ps1 - 极简版
|
||||
# gen.ps1 - 支持参数版
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$dbName
|
||||
)
|
||||
& .\gentool.exe `
|
||||
-dsn "root:gR9pV4tY7zR6qL3e@tcp(47.108.184.184:3306)/user_db?charset=utf8mb4&parseTime=True&loc=Local" `
|
||||
-dsn "root:gR9pV4tY7zR6qL3e@tcp(47.108.184.184:3306)/${dbName}?charset=utf8mb4&parseTime=True&loc=Local" `
|
||||
-fieldSignable `
|
||||
-outPath "./user_db/query"
|
||||
-outPath "./${dbName}/query"
|
||||
|
||||
Get-ChildItem ./user_db/model/*.gen.go | ForEach-Object {
|
||||
Get-ChildItem ./${dbName}/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
|
||||
}
|
||||
}
|
||||
3
Tools/mysql_model/go.mod
Normal file
3
Tools/mysql_model/go.mod
Normal file
@@ -0,0 +1,3 @@
|
||||
module git.hlsq.asia/mmorpg
|
||||
|
||||
go 1.23.1
|
||||
42
Tools/mysql_model/user_db/model/questions.gen.go
Normal file
42
Tools/mysql_model/user_db/model/questions.gen.go
Normal file
@@ -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 <questions>
|
||||
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
|
||||
}
|
||||
@@ -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 <users>
|
||||
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
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
367
Tools/mysql_model/user_db/query/questions.gen.go
Normal file
367
Tools/mysql_model/user_db/query/questions.gen.go
Normal file
@@ -0,0 +1,367 @@
|
||||
// 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"
|
||||
|
||||
"git.hlsq.asia/mmorpg/user_db/model"
|
||||
)
|
||||
|
||||
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
|
||||
}
|
||||
@@ -15,6 +15,8 @@ import (
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"git.hlsq.asia/mmorpg/user_db/model"
|
||||
)
|
||||
|
||||
func newUser(db *gorm.DB, opts ...gen.DOOption) user {
|
||||
@@ -26,7 +28,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 +45,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 +68,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")
|
||||
|
||||
4
Tools/quickly/.gitignore
vendored
Normal file
4
Tools/quickly/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
build/bin
|
||||
node_modules
|
||||
frontend/dist
|
||||
.idea
|
||||
19
Tools/quickly/README.md
Normal file
19
Tools/quickly/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# README
|
||||
|
||||
## About
|
||||
|
||||
This is the official Wails Vue-TS template.
|
||||
|
||||
You can configure the project by editing `wails.json`. More information about the project settings can be found
|
||||
here: https://wails.io/docs/reference/project-config
|
||||
|
||||
## Live Development
|
||||
|
||||
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
|
||||
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
|
||||
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
|
||||
to this in your browser, and you can call your Go code from devtools.
|
||||
|
||||
## Building
|
||||
|
||||
To build a redistributable, production mode package, use `wails build`.
|
||||
14
Tools/quickly/backend/app.go
Normal file
14
Tools/quickly/backend/app.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func NewApp() *App {
|
||||
return &App{}
|
||||
}
|
||||
|
||||
func (a *App) Startup(ctx context.Context) {
|
||||
a.ctx = ctx
|
||||
a.loadSettings()
|
||||
}
|
||||
56
Tools/quickly/backend/database.go
Normal file
56
Tools/quickly/backend/database.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func (a *App) AddDatabaseConfig(name string, targetPath string, modelPackagePath string) error {
|
||||
if name == "" {
|
||||
return fmt.Errorf("database name is empty")
|
||||
}
|
||||
if targetPath == "" {
|
||||
return fmt.Errorf("target path is empty")
|
||||
}
|
||||
|
||||
for _, db := range a.settings.Databases {
|
||||
if db.Name == name {
|
||||
return fmt.Errorf("database with name '%s' already exists", name)
|
||||
}
|
||||
}
|
||||
|
||||
a.settings.Databases = append(a.settings.Databases, DatabaseConfig{
|
||||
Name: name,
|
||||
TargetPath: targetPath,
|
||||
ModelPackagePath: modelPackagePath,
|
||||
})
|
||||
return a.saveSettings()
|
||||
}
|
||||
|
||||
func (a *App) RemoveDatabaseConfig(name string) error {
|
||||
for i, db := range a.settings.Databases {
|
||||
if db.Name == name {
|
||||
a.settings.Databases = append(a.settings.Databases[:i], a.settings.Databases[i+1:]...)
|
||||
return a.saveSettings()
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("database with name '%s' not found", name)
|
||||
}
|
||||
|
||||
func (a *App) UpdateDatabaseConfig(oldName string, newName string, targetPath string, modelPackagePath string) error {
|
||||
if newName == "" {
|
||||
return fmt.Errorf("database name is empty")
|
||||
}
|
||||
if targetPath == "" {
|
||||
return fmt.Errorf("target path is empty")
|
||||
}
|
||||
|
||||
for i, db := range a.settings.Databases {
|
||||
if db.Name == oldName {
|
||||
a.settings.Databases[i].Name = newName
|
||||
a.settings.Databases[i].TargetPath = targetPath
|
||||
a.settings.Databases[i].ModelPackagePath = modelPackagePath
|
||||
return a.saveSettings()
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("database with name '%s' not found", oldName)
|
||||
}
|
||||
9
Tools/quickly/backend/greet.go
Normal file
9
Tools/quickly/backend/greet.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func (a *App) Greet(name string) string {
|
||||
return fmt.Sprintf("Hello %s, It's show time!", name)
|
||||
}
|
||||
56
Tools/quickly/backend/helpers.go
Normal file
56
Tools/quickly/backend/helpers.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func copyDir(src string, dst string) error {
|
||||
srcInfo, err := os.Stat(src)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.MkdirAll(dst, srcInfo.Mode()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
entries, err := os.ReadDir(src)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, entry := range entries {
|
||||
srcPath := filepath.Join(src, entry.Name())
|
||||
dstPath := filepath.Join(dst, entry.Name())
|
||||
|
||||
if entry.IsDir() {
|
||||
if err := copyDir(srcPath, dstPath); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if err := copyFile(srcPath, dstPath); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func copyFile(src string, dst string) error {
|
||||
source, err := os.Open(src)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer source.Close()
|
||||
|
||||
destination, err := os.Create(dst)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer destination.Close()
|
||||
|
||||
_, err = destination.ReadFrom(source)
|
||||
return err
|
||||
}
|
||||
34
Tools/quickly/backend/models.go
Normal file
34
Tools/quickly/backend/models.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type DatabaseConfig struct {
|
||||
Name string `json:"name"`
|
||||
TargetPath string `json:"targetPath"`
|
||||
ModelPackagePath string `json:"modelPackagePath"`
|
||||
}
|
||||
|
||||
type ProjectConfig struct {
|
||||
Name string `json:"name"`
|
||||
Path string `json:"path"`
|
||||
}
|
||||
|
||||
type Settings struct {
|
||||
Theme string `json:"theme"`
|
||||
Language string `json:"language"`
|
||||
Notifications bool `json:"notifications"`
|
||||
AutoStart bool `json:"autoStart"`
|
||||
MysqlModelPath string `json:"mysqlModelPath"`
|
||||
DefaultQueryPackagePath string `json:"defaultQueryPackagePath"`
|
||||
ModelBasePath string `json:"modelBasePath"`
|
||||
SwaggerDir string `json:"swaggerDir"`
|
||||
Databases []DatabaseConfig `json:"databases"`
|
||||
Projects []ProjectConfig `json:"projects"`
|
||||
}
|
||||
|
||||
type App struct {
|
||||
ctx context.Context
|
||||
settings Settings
|
||||
}
|
||||
171
Tools/quickly/backend/mysql_model.go
Normal file
171
Tools/quickly/backend/mysql_model.go
Normal file
@@ -0,0 +1,171 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
)
|
||||
|
||||
func (a *App) SelectFile(title string, defaultDir string, filter string) (string, error) {
|
||||
return runtime.OpenFileDialog(a.ctx, runtime.OpenDialogOptions{
|
||||
Title: title,
|
||||
DefaultDirectory: defaultDir,
|
||||
Filters: []runtime.FileFilter{{Pattern: filter}},
|
||||
})
|
||||
}
|
||||
|
||||
func (a *App) SelectDirectory(title string, defaultDir string) (string, error) {
|
||||
return runtime.OpenDirectoryDialog(a.ctx, runtime.OpenDialogOptions{
|
||||
Title: title,
|
||||
DefaultDirectory: defaultDir,
|
||||
})
|
||||
}
|
||||
|
||||
func (a *App) CheckGenPs1Exists(filePath string) (bool, error) {
|
||||
if filePath == "" {
|
||||
return false, fmt.Errorf("file path is empty")
|
||||
}
|
||||
|
||||
_, err := os.Stat(filePath)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (a *App) ReadGoModModule(filePath string) (string, error) {
|
||||
if filePath == "" {
|
||||
return "", fmt.Errorf("file path is empty")
|
||||
}
|
||||
|
||||
dirPath := filepath.Dir(filePath)
|
||||
goModPath := filepath.Join(dirPath, "go.mod")
|
||||
|
||||
content, err := os.ReadFile(goModPath)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("go.mod not found: %w", err)
|
||||
}
|
||||
|
||||
lines := strings.Split(string(content), "\n")
|
||||
for _, line := range lines {
|
||||
line = strings.TrimSpace(line)
|
||||
if strings.HasPrefix(line, "module ") {
|
||||
moduleName := strings.TrimPrefix(line, "module ")
|
||||
moduleName = strings.TrimSpace(moduleName)
|
||||
return moduleName, nil
|
||||
}
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("module declaration not found in go.mod")
|
||||
}
|
||||
|
||||
func (a *App) ExecuteGenPs1(genPs1Path string, dbName string, targetPath string, modelPackagePath string) (string, error) {
|
||||
if genPs1Path == "" {
|
||||
return "", fmt.Errorf("gen.ps1 path is empty")
|
||||
}
|
||||
if dbName == "" {
|
||||
return "", fmt.Errorf("database name is empty")
|
||||
}
|
||||
|
||||
if _, err := os.Stat(genPs1Path); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return "", fmt.Errorf("gen.ps1 not found")
|
||||
}
|
||||
return "", fmt.Errorf("error checking gen.ps1: %w", err)
|
||||
}
|
||||
|
||||
dirPath := filepath.Dir(genPs1Path)
|
||||
|
||||
psPath, err := exec.LookPath("powershell.exe")
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("PowerShell not found: %w", err)
|
||||
}
|
||||
|
||||
args := []string{
|
||||
"-NoProfile",
|
||||
"-ExecutionPolicy", "Bypass",
|
||||
"-Command",
|
||||
fmt.Sprintf("Set-Location -Path '%s'; & .\\gen.ps1 -dbName '%s'", dirPath, dbName),
|
||||
}
|
||||
|
||||
cmd := exec.Command(psPath, args...)
|
||||
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("script execution failed: %w\nOutput: %s", err, string(output))
|
||||
}
|
||||
|
||||
if targetPath != "" {
|
||||
sourceDir := filepath.Join(dirPath, dbName)
|
||||
if _, err := os.Stat(sourceDir); err == nil {
|
||||
modelSource := filepath.Join(sourceDir, "model")
|
||||
querySource := filepath.Join(sourceDir, "query")
|
||||
|
||||
modelTarget := filepath.Join(targetPath, "model")
|
||||
queryTarget := filepath.Join(targetPath, "query")
|
||||
|
||||
if _, err := os.Stat(modelSource); err == nil {
|
||||
if err := copyDir(modelSource, modelTarget); err != nil {
|
||||
return string(output), fmt.Errorf("failed to copy model directory: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := os.Stat(querySource); err == nil {
|
||||
if err := copyDir(querySource, queryTarget); err != nil {
|
||||
return string(output), fmt.Errorf("failed to copy query directory: %w", err)
|
||||
}
|
||||
if modelPackagePath != "" {
|
||||
if err := replaceImportPaths(queryTarget, dbName, modelPackagePath, a.settings.DefaultQueryPackagePath); err != nil {
|
||||
return string(output), fmt.Errorf("failed to replace import paths: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return string(output), nil
|
||||
}
|
||||
|
||||
func replaceImportPaths(queryDir string, dbName string, newPackagePath string, basePath string) error {
|
||||
err := filepath.Walk(queryDir, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !info.IsDir() && strings.HasSuffix(path, ".gen.go") {
|
||||
if err := replaceImportInFile(path, dbName, newPackagePath, basePath); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func replaceImportInFile(filePath string, dbName string, newPackagePath string, basePath string) error {
|
||||
content, err := os.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if basePath == "" {
|
||||
basePath = "git.hlsq.asia/mmorpg"
|
||||
}
|
||||
|
||||
oldImport := fmt.Sprintf(`"%s/%s/model"`, basePath, dbName)
|
||||
newImport := fmt.Sprintf(`"%s"`, newPackagePath)
|
||||
|
||||
newContent := bytes.ReplaceAll(content, []byte(oldImport), []byte(newImport))
|
||||
|
||||
return os.WriteFile(filePath, newContent, 0644)
|
||||
}
|
||||
73
Tools/quickly/backend/project.go
Normal file
73
Tools/quickly/backend/project.go
Normal file
@@ -0,0 +1,73 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func (a *App) AddProjectConfig(name string, path string) error {
|
||||
if path == "" {
|
||||
return fmt.Errorf("project path is empty")
|
||||
}
|
||||
|
||||
if name == "" {
|
||||
name = filepath.Base(path)
|
||||
}
|
||||
|
||||
goModPath := filepath.Join(path, "go.mod")
|
||||
if _, err := os.Stat(goModPath); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return fmt.Errorf("go.mod file not found in the specified path")
|
||||
}
|
||||
return fmt.Errorf("error checking go.mod file: %w", err)
|
||||
}
|
||||
|
||||
for _, project := range a.settings.Projects {
|
||||
if project.Name == name {
|
||||
return fmt.Errorf("project with name '%s' already exists", name)
|
||||
}
|
||||
}
|
||||
|
||||
a.settings.Projects = append(a.settings.Projects, ProjectConfig{
|
||||
Name: name,
|
||||
Path: path,
|
||||
})
|
||||
return a.saveSettings()
|
||||
}
|
||||
|
||||
func (a *App) RemoveProjectConfig(name string) error {
|
||||
for i, project := range a.settings.Projects {
|
||||
if project.Name == name {
|
||||
a.settings.Projects = append(a.settings.Projects[:i], a.settings.Projects[i+1:]...)
|
||||
return a.saveSettings()
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("project with name '%s' not found", name)
|
||||
}
|
||||
|
||||
func (a *App) UpdateProjectConfig(oldName string, newName string, path string) error {
|
||||
if newName == "" {
|
||||
return fmt.Errorf("project name is empty")
|
||||
}
|
||||
if path == "" {
|
||||
return fmt.Errorf("project path is empty")
|
||||
}
|
||||
|
||||
goModPath := filepath.Join(path, "go.mod")
|
||||
if _, err := os.Stat(goModPath); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return fmt.Errorf("go.mod file not found in the specified path")
|
||||
}
|
||||
return fmt.Errorf("error checking go.mod file: %w", err)
|
||||
}
|
||||
|
||||
for i, project := range a.settings.Projects {
|
||||
if project.Name == oldName {
|
||||
a.settings.Projects[i].Name = newName
|
||||
a.settings.Projects[i].Path = path
|
||||
return a.saveSettings()
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("project with name '%s' not found", oldName)
|
||||
}
|
||||
104
Tools/quickly/backend/settings.go
Normal file
104
Tools/quickly/backend/settings.go
Normal file
@@ -0,0 +1,104 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func (a *App) getSettingsPath() (string, error) {
|
||||
configDir, err := os.UserConfigDir()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
appConfigDir := filepath.Join(configDir, "quickly")
|
||||
if err := os.MkdirAll(appConfigDir, 0755); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return filepath.Join(appConfigDir, "settings.json"), nil
|
||||
}
|
||||
|
||||
func (a *App) loadSettings() {
|
||||
settingsPath, err := a.getSettingsPath()
|
||||
if err != nil {
|
||||
fmt.Println("Error getting settings path:", err)
|
||||
a.settings = Settings{
|
||||
Theme: "light",
|
||||
Language: "zh-CN",
|
||||
Notifications: true,
|
||||
AutoStart: false,
|
||||
MysqlModelPath: "",
|
||||
DefaultQueryPackagePath: "",
|
||||
ModelBasePath: "",
|
||||
SwaggerDir: "",
|
||||
Databases: []DatabaseConfig{},
|
||||
Projects: []ProjectConfig{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
data, err := os.ReadFile(settingsPath)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
a.settings = Settings{
|
||||
Theme: "light",
|
||||
Language: "zh-CN",
|
||||
Notifications: true,
|
||||
AutoStart: false,
|
||||
MysqlModelPath: "",
|
||||
DefaultQueryPackagePath: "",
|
||||
ModelBasePath: "",
|
||||
SwaggerDir: "",
|
||||
Databases: []DatabaseConfig{},
|
||||
Projects: []ProjectConfig{},
|
||||
}
|
||||
return
|
||||
}
|
||||
fmt.Println("Error reading settings file:", err)
|
||||
return
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(data, &a.settings); err != nil {
|
||||
fmt.Println("Error parsing settings file:", err)
|
||||
a.settings = Settings{
|
||||
Theme: "light",
|
||||
Language: "zh-CN",
|
||||
Notifications: true,
|
||||
AutoStart: false,
|
||||
MysqlModelPath: "",
|
||||
DefaultQueryPackagePath: "",
|
||||
ModelBasePath: "",
|
||||
SwaggerDir: "",
|
||||
Databases: []DatabaseConfig{},
|
||||
Projects: []ProjectConfig{},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a *App) saveSettings() error {
|
||||
settingsPath, err := a.getSettingsPath()
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting settings path: %w", err)
|
||||
}
|
||||
|
||||
data, err := json.MarshalIndent(a.settings, "", " ")
|
||||
if err != nil {
|
||||
return fmt.Errorf("error marshaling settings: %w", err)
|
||||
}
|
||||
|
||||
if err := os.WriteFile(settingsPath, data, 0644); err != nil {
|
||||
return fmt.Errorf("error writing settings file: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) GetSettings() Settings {
|
||||
return a.settings
|
||||
}
|
||||
|
||||
func (a *App) SaveSettings(settings Settings) error {
|
||||
a.settings = settings
|
||||
return a.saveSettings()
|
||||
}
|
||||
239
Tools/quickly/backend/swagger.go
Normal file
239
Tools/quickly/backend/swagger.go
Normal file
@@ -0,0 +1,239 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
type SwaggerFile struct {
|
||||
Name string `json:"name"`
|
||||
Path string `json:"path"`
|
||||
Size int64 `json:"size"`
|
||||
ModifiedTime string `json:"modifiedTime"`
|
||||
}
|
||||
|
||||
type SwaggerServer struct {
|
||||
server *http.Server
|
||||
port int
|
||||
running bool
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
var swaggerServer *SwaggerServer
|
||||
var swaggerServerMu sync.Mutex
|
||||
|
||||
func (a *App) GetSwaggerFiles(dirPath string) ([]SwaggerFile, error) {
|
||||
if dirPath == "" {
|
||||
return nil, fmt.Errorf("directory path is empty")
|
||||
}
|
||||
|
||||
var files []SwaggerFile
|
||||
|
||||
err := filepath.Walk(dirPath, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if info.IsDir() {
|
||||
return nil
|
||||
}
|
||||
|
||||
if strings.HasSuffix(strings.ToLower(info.Name()), ".swagger.json") {
|
||||
files = append(files, SwaggerFile{
|
||||
Name: info.Name(),
|
||||
Path: path,
|
||||
Size: info.Size(),
|
||||
ModifiedTime: info.ModTime().Format("2006-01-02 15:04:05"),
|
||||
})
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to walk directory: %w", err)
|
||||
}
|
||||
|
||||
return files, nil
|
||||
}
|
||||
|
||||
func (a *App) ReadSwaggerFile(filePath string) (string, error) {
|
||||
if filePath == "" {
|
||||
return "", fmt.Errorf("file path is empty")
|
||||
}
|
||||
|
||||
content, err := os.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to read file: %w", err)
|
||||
}
|
||||
|
||||
return string(content), nil
|
||||
}
|
||||
|
||||
func (a *App) StartSwaggerServer(dirPath string) (string, error) {
|
||||
if dirPath == "" {
|
||||
return "", fmt.Errorf("directory path is empty")
|
||||
}
|
||||
|
||||
swaggerServerMu.Lock()
|
||||
defer swaggerServerMu.Unlock()
|
||||
|
||||
if swaggerServer != nil && swaggerServer.running {
|
||||
return fmt.Sprintf("http://localhost:%d", swaggerServer.port), nil
|
||||
}
|
||||
|
||||
port := 8080
|
||||
for i := 0; i < 100; i++ {
|
||||
listener, err := net.Listen("tcp", fmt.Sprintf(":%d", port))
|
||||
if err == nil {
|
||||
listener.Close()
|
||||
break
|
||||
}
|
||||
port++
|
||||
}
|
||||
|
||||
mux := http.NewServeMux()
|
||||
|
||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
swaggerHTML := `<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Swagger UI</title>
|
||||
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@5.10.5/swagger-ui.css">
|
||||
<style>
|
||||
html { box-sizing: border-box; overflow: -moz-scrollbars-vertical; overflow-y: scroll; }
|
||||
*, *:before, *:after { box-sizing: inherit; }
|
||||
body { margin: 0; background: #fafafa; }
|
||||
.topbar { display: none; }
|
||||
.swagger-ui .topbar { display: none; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="swagger-ui"></div>
|
||||
<script src="https://unpkg.com/swagger-ui-dist@5.10.5/swagger-ui-bundle.js"></script>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const fileParam = urlParams.get('file');
|
||||
const swaggerUrl = fileParam ? '/swagger.json?file=' + encodeURIComponent(fileParam) : '/swagger.json';
|
||||
const ui = SwaggerUIBundle({
|
||||
url: swaggerUrl,
|
||||
dom_id: '#swagger-ui',
|
||||
presets: [
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIBundle.SwaggerUIStandalonePreset
|
||||
],
|
||||
layout: "BaseLayout",
|
||||
deepLinking: true,
|
||||
showExtensions: true,
|
||||
showCommonExtensions: true,
|
||||
docExpansion: "list",
|
||||
filter: true,
|
||||
tryItOutEnabled: true
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>`
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
w.Write([]byte(swaggerHTML))
|
||||
})
|
||||
|
||||
mux.HandleFunc("/swagger.json", func(w http.ResponseWriter, r *http.Request) {
|
||||
files, err := a.GetSwaggerFiles(dirPath)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
if len(files) == 0 {
|
||||
http.Error(w, "No swagger files found", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
fileName := r.URL.Query().Get("file")
|
||||
selectedFile := files[0]
|
||||
if fileName != "" {
|
||||
for _, file := range files {
|
||||
if file.Name == fileName {
|
||||
selectedFile = file
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
content, err := os.ReadFile(selectedFile.Path)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.Write(content)
|
||||
})
|
||||
|
||||
server := &http.Server{
|
||||
Addr: fmt.Sprintf(":%d", port),
|
||||
Handler: mux,
|
||||
ReadTimeout: 15 * time.Second,
|
||||
WriteTimeout: 15 * time.Second,
|
||||
}
|
||||
|
||||
swaggerServer = &SwaggerServer{
|
||||
server: server,
|
||||
port: port,
|
||||
running: true,
|
||||
}
|
||||
|
||||
go func() {
|
||||
if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
||||
fmt.Printf("Swagger server error: %v\n", err)
|
||||
}
|
||||
}()
|
||||
|
||||
return fmt.Sprintf("http://localhost:%d", port), nil
|
||||
}
|
||||
|
||||
func (a *App) StopSwaggerServer() error {
|
||||
swaggerServerMu.Lock()
|
||||
defer swaggerServerMu.Unlock()
|
||||
|
||||
if swaggerServer == nil || !swaggerServer.running {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := swaggerServer.server.Close(); err != nil {
|
||||
return fmt.Errorf("failed to stop server: %w", err)
|
||||
}
|
||||
|
||||
swaggerServer.running = false
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) IsSwaggerServerRunning() bool {
|
||||
swaggerServerMu.Lock()
|
||||
defer swaggerServerMu.Unlock()
|
||||
|
||||
if swaggerServer == nil {
|
||||
return false
|
||||
}
|
||||
return swaggerServer.running
|
||||
}
|
||||
|
||||
func (a *App) GetSwaggerServerURL() string {
|
||||
swaggerServerMu.Lock()
|
||||
defer swaggerServerMu.Unlock()
|
||||
|
||||
if swaggerServer == nil || !swaggerServer.running {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("http://localhost:%d", swaggerServer.port)
|
||||
}
|
||||
90
Tools/quickly/backend/update_service_common.go
Normal file
90
Tools/quickly/backend/update_service_common.go
Normal file
@@ -0,0 +1,90 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (a *App) UpdateServiceCommon(commitId string, projectNames []string) (string, error) {
|
||||
if commitId == "" {
|
||||
return "", fmt.Errorf("commit id is empty")
|
||||
}
|
||||
|
||||
if len(projectNames) == 0 {
|
||||
return "", fmt.Errorf("no projects selected")
|
||||
}
|
||||
|
||||
var results strings.Builder
|
||||
results.WriteString(fmt.Sprintf("开始更新 Common 版本: %s\n", commitId))
|
||||
results.WriteString(fmt.Sprintf("共选择 %d 个项目\n\n", len(projectNames)))
|
||||
|
||||
for _, projectName := range projectNames {
|
||||
var projectPath string
|
||||
found := false
|
||||
for _, project := range a.settings.Projects {
|
||||
if project.Name == projectName {
|
||||
projectPath = project.Path
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
results.WriteString(fmt.Sprintf("❌ 项目 '%s' 未找到配置\n\n", projectName))
|
||||
continue
|
||||
}
|
||||
|
||||
results.WriteString(fmt.Sprintf("正在更新项目: %s\n", projectName))
|
||||
results.WriteString(fmt.Sprintf("路径: %s\n", projectPath))
|
||||
|
||||
if err := updateProjectCommonVersion(projectPath, commitId, &results, a.settings.ModelBasePath); err != nil {
|
||||
results.WriteString(fmt.Sprintf("❌ 更新失败: %v\n\n", err))
|
||||
continue
|
||||
}
|
||||
|
||||
results.WriteString(fmt.Sprintf("✅ 更新成功\n\n"))
|
||||
}
|
||||
|
||||
results.WriteString("所有项目更新完成!")
|
||||
return results.String(), nil
|
||||
}
|
||||
|
||||
func updateProjectCommonVersion(projectPath string, commitId string, results *strings.Builder, moduleName string) error {
|
||||
goPath, err := exec.LookPath("go")
|
||||
if err != nil {
|
||||
return fmt.Errorf("Go not found: %w", err)
|
||||
}
|
||||
|
||||
if moduleName == "" {
|
||||
return fmt.Errorf("Go Module Name 未配置,请在设置中填写")
|
||||
}
|
||||
|
||||
results.WriteString("执行: go get -u " + moduleName + "@" + commitId + "\n")
|
||||
|
||||
cmd := exec.Command(goPath, "get", "-u", fmt.Sprintf("%s@%s", moduleName, commitId))
|
||||
cmd.Dir = projectPath
|
||||
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return fmt.Errorf("go get failed: %w\nOutput: %s", err, string(output))
|
||||
}
|
||||
|
||||
results.WriteString(string(output))
|
||||
results.WriteString("\n")
|
||||
|
||||
results.WriteString("执行: go mod tidy\n")
|
||||
|
||||
cmd = exec.Command(goPath, "mod", "tidy")
|
||||
cmd.Dir = projectPath
|
||||
|
||||
output, err = cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return fmt.Errorf("go mod tidy failed: %w\nOutput: %s", err, string(output))
|
||||
}
|
||||
|
||||
results.WriteString(string(output))
|
||||
results.WriteString("\n")
|
||||
|
||||
return nil
|
||||
}
|
||||
35
Tools/quickly/build/README.md
Normal file
35
Tools/quickly/build/README.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Build Directory
|
||||
|
||||
The build directory is used to house all the build files and assets for your application.
|
||||
|
||||
The structure is:
|
||||
|
||||
* bin - Output directory
|
||||
* darwin - macOS specific files
|
||||
* windows - Windows specific files
|
||||
|
||||
## Mac
|
||||
|
||||
The `darwin` directory holds files specific to Mac builds.
|
||||
These may be customised and used as part of the build. To return these files to the default state, simply delete them
|
||||
and
|
||||
build with `wails build`.
|
||||
|
||||
The directory contains the following files:
|
||||
|
||||
- `Info.plist` - the main plist file used for Mac builds. It is used when building using `wails build`.
|
||||
- `Info.dev.plist` - same as the main plist file but used when building using `wails dev`.
|
||||
|
||||
## Windows
|
||||
|
||||
The `windows` directory contains the manifest and rc files used when building with `wails build`.
|
||||
These may be customised for your application. To return these files to the default state, simply delete them and
|
||||
build with `wails build`.
|
||||
|
||||
- `icon.ico` - The icon used for the application. This is used when building using `wails build`. If you wish to
|
||||
use a different icon, simply replace this file with your own. If it is missing, a new `icon.ico` file
|
||||
will be created using the `appicon.png` file in the build directory.
|
||||
- `installer/*` - The files used to create the Windows installer. These are used when building using `wails build`.
|
||||
- `info.json` - Application details used for Windows builds. The data here will be used by the Windows installer,
|
||||
as well as the application itself (right click the exe -> properties -> details)
|
||||
- `wails.exe.manifest` - The main application manifest file.
|
||||
BIN
Tools/quickly/build/appicon.png
Normal file
BIN
Tools/quickly/build/appicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 130 KiB |
68
Tools/quickly/build/darwin/Info.dev.plist
Normal file
68
Tools/quickly/build/darwin/Info.dev.plist
Normal file
@@ -0,0 +1,68 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>{{.Info.ProductName}}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>{{.OutputFilename}}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.wails.{{.Name}}</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>{{.Info.ProductVersion}}</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>{{.Info.Comments}}</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>{{.Info.ProductVersion}}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>iconfile</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.13.0</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>true</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>{{.Info.Copyright}}</string>
|
||||
{{if .Info.FileAssociations}}
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
{{range .Info.FileAssociations}}
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>{{.Ext}}</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>{{.Name}}</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>{{.Role}}</string>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>{{.IconName}}</string>
|
||||
</dict>
|
||||
{{end}}
|
||||
</array>
|
||||
{{end}}
|
||||
{{if .Info.Protocols}}
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
{{range .Info.Protocols}}
|
||||
<dict>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>com.wails.{{.Scheme}}</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>{{.Scheme}}</string>
|
||||
</array>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>{{.Role}}</string>
|
||||
</dict>
|
||||
{{end}}
|
||||
</array>
|
||||
{{end}}
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsLocalNetworking</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
63
Tools/quickly/build/darwin/Info.plist
Normal file
63
Tools/quickly/build/darwin/Info.plist
Normal file
@@ -0,0 +1,63 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>{{.Info.ProductName}}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>{{.OutputFilename}}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.wails.{{.Name}}</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>{{.Info.ProductVersion}}</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>{{.Info.Comments}}</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>{{.Info.ProductVersion}}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>iconfile</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.13.0</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>true</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>{{.Info.Copyright}}</string>
|
||||
{{if .Info.FileAssociations}}
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
{{range .Info.FileAssociations}}
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>{{.Ext}}</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>{{.Name}}</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>{{.Role}}</string>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>{{.IconName}}</string>
|
||||
</dict>
|
||||
{{end}}
|
||||
</array>
|
||||
{{end}}
|
||||
{{if .Info.Protocols}}
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
{{range .Info.Protocols}}
|
||||
<dict>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>com.wails.{{.Scheme}}</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>{{.Scheme}}</string>
|
||||
</array>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>{{.Role}}</string>
|
||||
</dict>
|
||||
{{end}}
|
||||
</array>
|
||||
{{end}}
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
Tools/quickly/build/windows/icon.ico
Normal file
BIN
Tools/quickly/build/windows/icon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
15
Tools/quickly/build/windows/info.json
Normal file
15
Tools/quickly/build/windows/info.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"fixed": {
|
||||
"file_version": "{{.Info.ProductVersion}}"
|
||||
},
|
||||
"info": {
|
||||
"0000": {
|
||||
"ProductVersion": "{{.Info.ProductVersion}}",
|
||||
"CompanyName": "{{.Info.CompanyName}}",
|
||||
"FileDescription": "{{.Info.ProductName}}",
|
||||
"LegalCopyright": "{{.Info.Copyright}}",
|
||||
"ProductName": "{{.Info.ProductName}}",
|
||||
"Comments": "{{.Info.Comments}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
114
Tools/quickly/build/windows/installer/project.nsi
Normal file
114
Tools/quickly/build/windows/installer/project.nsi
Normal file
@@ -0,0 +1,114 @@
|
||||
Unicode true
|
||||
|
||||
####
|
||||
## Please note: Template replacements don't work in this file. They are provided with default defines like
|
||||
## mentioned underneath.
|
||||
## If the keyword is not defined, "wails_tools.nsh" will populate them with the values from ProjectInfo.
|
||||
## If they are defined here, "wails_tools.nsh" will not touch them. This allows to use this project.nsi manually
|
||||
## from outside of Wails for debugging and development of the installer.
|
||||
##
|
||||
## For development first make a wails nsis build to populate the "wails_tools.nsh":
|
||||
## > wails build --target windows/amd64 --nsis
|
||||
## Then you can call makensis on this file with specifying the path to your binary:
|
||||
## For a AMD64 only installer:
|
||||
## > makensis -DARG_WAILS_AMD64_BINARY=..\..\bin\app.exe
|
||||
## For a ARM64 only installer:
|
||||
## > makensis -DARG_WAILS_ARM64_BINARY=..\..\bin\app.exe
|
||||
## For a installer with both architectures:
|
||||
## > makensis -DARG_WAILS_AMD64_BINARY=..\..\bin\app-amd64.exe -DARG_WAILS_ARM64_BINARY=..\..\bin\app-arm64.exe
|
||||
####
|
||||
## The following information is taken from the ProjectInfo file, but they can be overwritten here.
|
||||
####
|
||||
## !define INFO_PROJECTNAME "MyProject" # Default "{{.Name}}"
|
||||
## !define INFO_COMPANYNAME "MyCompany" # Default "{{.Info.CompanyName}}"
|
||||
## !define INFO_PRODUCTNAME "MyProduct" # Default "{{.Info.ProductName}}"
|
||||
## !define INFO_PRODUCTVERSION "1.0.0" # Default "{{.Info.ProductVersion}}"
|
||||
## !define INFO_COPYRIGHT "Copyright" # Default "{{.Info.Copyright}}"
|
||||
###
|
||||
## !define PRODUCT_EXECUTABLE "Application.exe" # Default "${INFO_PROJECTNAME}.exe"
|
||||
## !define UNINST_KEY_NAME "UninstKeyInRegistry" # Default "${INFO_COMPANYNAME}${INFO_PRODUCTNAME}"
|
||||
####
|
||||
## !define REQUEST_EXECUTION_LEVEL "admin" # Default "admin" see also https://nsis.sourceforge.io/Docs/Chapter4.html
|
||||
####
|
||||
## Include the wails tools
|
||||
####
|
||||
!include "wails_tools.nsh"
|
||||
|
||||
# The version information for this two must consist of 4 parts
|
||||
VIProductVersion "${INFO_PRODUCTVERSION}.0"
|
||||
VIFileVersion "${INFO_PRODUCTVERSION}.0"
|
||||
|
||||
VIAddVersionKey "CompanyName" "${INFO_COMPANYNAME}"
|
||||
VIAddVersionKey "FileDescription" "${INFO_PRODUCTNAME} Installer"
|
||||
VIAddVersionKey "ProductVersion" "${INFO_PRODUCTVERSION}"
|
||||
VIAddVersionKey "FileVersion" "${INFO_PRODUCTVERSION}"
|
||||
VIAddVersionKey "LegalCopyright" "${INFO_COPYRIGHT}"
|
||||
VIAddVersionKey "ProductName" "${INFO_PRODUCTNAME}"
|
||||
|
||||
# Enable HiDPI support. https://nsis.sourceforge.io/Reference/ManifestDPIAware
|
||||
ManifestDPIAware true
|
||||
|
||||
!include "MUI.nsh"
|
||||
|
||||
!define MUI_ICON "..\icon.ico"
|
||||
!define MUI_UNICON "..\icon.ico"
|
||||
# !define MUI_WELCOMEFINISHPAGE_BITMAP "resources\leftimage.bmp" #Include this to add a bitmap on the left side of the Welcome Page. Must be a size of 164x314
|
||||
!define MUI_FINISHPAGE_NOAUTOCLOSE # Wait on the INSTFILES page so the user can take a look into the details of the installation steps
|
||||
!define MUI_ABORTWARNING # This will warn the user if they exit from the installer.
|
||||
|
||||
!insertmacro MUI_PAGE_WELCOME # Welcome to the installer page.
|
||||
# !insertmacro MUI_PAGE_LICENSE "resources\eula.txt" # Adds a EULA page to the installer
|
||||
!insertmacro MUI_PAGE_DIRECTORY # In which folder install page.
|
||||
!insertmacro MUI_PAGE_INSTFILES # Installing page.
|
||||
!insertmacro MUI_PAGE_FINISH # Finished installation page.
|
||||
|
||||
!insertmacro MUI_UNPAGE_INSTFILES # Uinstalling page
|
||||
|
||||
!insertmacro MUI_LANGUAGE "English" # Set the Language of the installer
|
||||
|
||||
## The following two statements can be used to sign the installer and the uninstaller. The path to the binaries are provided in %1
|
||||
#!uninstfinalize 'signtool --file "%1"'
|
||||
#!finalize 'signtool --file "%1"'
|
||||
|
||||
Name "${INFO_PRODUCTNAME}"
|
||||
OutFile "..\..\bin\${INFO_PROJECTNAME}-${ARCH}-installer.exe" # Name of the installer's file.
|
||||
InstallDir "$PROGRAMFILES64\${INFO_COMPANYNAME}\${INFO_PRODUCTNAME}" # Default installing folder ($PROGRAMFILES is Program Files folder).
|
||||
ShowInstDetails show # This will always show the installation details.
|
||||
|
||||
Function .onInit
|
||||
!insertmacro wails.checkArchitecture
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
!insertmacro wails.setShellContext
|
||||
|
||||
!insertmacro wails.webview2runtime
|
||||
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
!insertmacro wails.files
|
||||
|
||||
CreateShortcut "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}"
|
||||
CreateShortCut "$DESKTOP\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}"
|
||||
|
||||
!insertmacro wails.associateFiles
|
||||
!insertmacro wails.associateCustomProtocols
|
||||
|
||||
!insertmacro wails.writeUninstaller
|
||||
SectionEnd
|
||||
|
||||
Section "uninstall"
|
||||
!insertmacro wails.setShellContext
|
||||
|
||||
RMDir /r "$AppData\${PRODUCT_EXECUTABLE}" # Remove the WebView2 DataPath
|
||||
|
||||
RMDir /r $INSTDIR
|
||||
|
||||
Delete "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk"
|
||||
Delete "$DESKTOP\${INFO_PRODUCTNAME}.lnk"
|
||||
|
||||
!insertmacro wails.unassociateFiles
|
||||
!insertmacro wails.unassociateCustomProtocols
|
||||
|
||||
!insertmacro wails.deleteUninstaller
|
||||
SectionEnd
|
||||
249
Tools/quickly/build/windows/installer/wails_tools.nsh
Normal file
249
Tools/quickly/build/windows/installer/wails_tools.nsh
Normal file
@@ -0,0 +1,249 @@
|
||||
# DO NOT EDIT - Generated automatically by `wails build`
|
||||
|
||||
!include "x64.nsh"
|
||||
!include "WinVer.nsh"
|
||||
!include "FileFunc.nsh"
|
||||
|
||||
!ifndef INFO_PROJECTNAME
|
||||
!define INFO_PROJECTNAME "{{.Name}}"
|
||||
!endif
|
||||
!ifndef INFO_COMPANYNAME
|
||||
!define INFO_COMPANYNAME "{{.Info.CompanyName}}"
|
||||
!endif
|
||||
!ifndef INFO_PRODUCTNAME
|
||||
!define INFO_PRODUCTNAME "{{.Info.ProductName}}"
|
||||
!endif
|
||||
!ifndef INFO_PRODUCTVERSION
|
||||
!define INFO_PRODUCTVERSION "{{.Info.ProductVersion}}"
|
||||
!endif
|
||||
!ifndef INFO_COPYRIGHT
|
||||
!define INFO_COPYRIGHT "{{.Info.Copyright}}"
|
||||
!endif
|
||||
!ifndef PRODUCT_EXECUTABLE
|
||||
!define PRODUCT_EXECUTABLE "${INFO_PROJECTNAME}.exe"
|
||||
!endif
|
||||
!ifndef UNINST_KEY_NAME
|
||||
!define UNINST_KEY_NAME "${INFO_COMPANYNAME}${INFO_PRODUCTNAME}"
|
||||
!endif
|
||||
!define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINST_KEY_NAME}"
|
||||
|
||||
!ifndef REQUEST_EXECUTION_LEVEL
|
||||
!define REQUEST_EXECUTION_LEVEL "admin"
|
||||
!endif
|
||||
|
||||
RequestExecutionLevel "${REQUEST_EXECUTION_LEVEL}"
|
||||
|
||||
!ifdef ARG_WAILS_AMD64_BINARY
|
||||
!define SUPPORTS_AMD64
|
||||
!endif
|
||||
|
||||
!ifdef ARG_WAILS_ARM64_BINARY
|
||||
!define SUPPORTS_ARM64
|
||||
!endif
|
||||
|
||||
!ifdef SUPPORTS_AMD64
|
||||
!ifdef SUPPORTS_ARM64
|
||||
!define ARCH "amd64_arm64"
|
||||
!else
|
||||
!define ARCH "amd64"
|
||||
!endif
|
||||
!else
|
||||
!ifdef SUPPORTS_ARM64
|
||||
!define ARCH "arm64"
|
||||
!else
|
||||
!error "Wails: Undefined ARCH, please provide at least one of ARG_WAILS_AMD64_BINARY or ARG_WAILS_ARM64_BINARY"
|
||||
!endif
|
||||
!endif
|
||||
|
||||
!macro wails.checkArchitecture
|
||||
!ifndef WAILS_WIN10_REQUIRED
|
||||
!define WAILS_WIN10_REQUIRED "This product is only supported on Windows 10 (Server 2016) and later."
|
||||
!endif
|
||||
|
||||
!ifndef WAILS_ARCHITECTURE_NOT_SUPPORTED
|
||||
!define WAILS_ARCHITECTURE_NOT_SUPPORTED "This product can't be installed on the current Windows architecture. Supports: ${ARCH}"
|
||||
!endif
|
||||
|
||||
${If} ${AtLeastWin10}
|
||||
!ifdef SUPPORTS_AMD64
|
||||
${if} ${IsNativeAMD64}
|
||||
Goto ok
|
||||
${EndIf}
|
||||
!endif
|
||||
|
||||
!ifdef SUPPORTS_ARM64
|
||||
${if} ${IsNativeARM64}
|
||||
Goto ok
|
||||
${EndIf}
|
||||
!endif
|
||||
|
||||
IfSilent silentArch notSilentArch
|
||||
silentArch:
|
||||
SetErrorLevel 65
|
||||
Abort
|
||||
notSilentArch:
|
||||
MessageBox MB_OK "${WAILS_ARCHITECTURE_NOT_SUPPORTED}"
|
||||
Quit
|
||||
${else}
|
||||
IfSilent silentWin notSilentWin
|
||||
silentWin:
|
||||
SetErrorLevel 64
|
||||
Abort
|
||||
notSilentWin:
|
||||
MessageBox MB_OK "${WAILS_WIN10_REQUIRED}"
|
||||
Quit
|
||||
${EndIf}
|
||||
|
||||
ok:
|
||||
!macroend
|
||||
|
||||
!macro wails.files
|
||||
!ifdef SUPPORTS_AMD64
|
||||
${if} ${IsNativeAMD64}
|
||||
File "/oname=${PRODUCT_EXECUTABLE}" "${ARG_WAILS_AMD64_BINARY}"
|
||||
${EndIf}
|
||||
!endif
|
||||
|
||||
!ifdef SUPPORTS_ARM64
|
||||
${if} ${IsNativeARM64}
|
||||
File "/oname=${PRODUCT_EXECUTABLE}" "${ARG_WAILS_ARM64_BINARY}"
|
||||
${EndIf}
|
||||
!endif
|
||||
!macroend
|
||||
|
||||
!macro wails.writeUninstaller
|
||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||
|
||||
SetRegView 64
|
||||
WriteRegStr HKLM "${UNINST_KEY}" "Publisher" "${INFO_COMPANYNAME}"
|
||||
WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "${INFO_PRODUCTNAME}"
|
||||
WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${INFO_PRODUCTVERSION}"
|
||||
WriteRegStr HKLM "${UNINST_KEY}" "DisplayIcon" "$INSTDIR\${PRODUCT_EXECUTABLE}"
|
||||
WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
|
||||
WriteRegStr HKLM "${UNINST_KEY}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
|
||||
|
||||
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
|
||||
IntFmt $0 "0x%08X" $0
|
||||
WriteRegDWORD HKLM "${UNINST_KEY}" "EstimatedSize" "$0"
|
||||
!macroend
|
||||
|
||||
!macro wails.deleteUninstaller
|
||||
Delete "$INSTDIR\uninstall.exe"
|
||||
|
||||
SetRegView 64
|
||||
DeleteRegKey HKLM "${UNINST_KEY}"
|
||||
!macroend
|
||||
|
||||
!macro wails.setShellContext
|
||||
${If} ${REQUEST_EXECUTION_LEVEL} == "admin"
|
||||
SetShellVarContext all
|
||||
${else}
|
||||
SetShellVarContext current
|
||||
${EndIf}
|
||||
!macroend
|
||||
|
||||
# Install webview2 by launching the bootstrapper
|
||||
# See https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#online-only-deployment
|
||||
!macro wails.webview2runtime
|
||||
!ifndef WAILS_INSTALL_WEBVIEW_DETAILPRINT
|
||||
!define WAILS_INSTALL_WEBVIEW_DETAILPRINT "Installing: WebView2 Runtime"
|
||||
!endif
|
||||
|
||||
SetRegView 64
|
||||
# If the admin key exists and is not empty then webview2 is already installed
|
||||
ReadRegStr $0 HKLM "SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
|
||||
${If} $0 != ""
|
||||
Goto ok
|
||||
${EndIf}
|
||||
|
||||
${If} ${REQUEST_EXECUTION_LEVEL} == "user"
|
||||
# If the installer is run in user level, check the user specific key exists and is not empty then webview2 is already installed
|
||||
ReadRegStr $0 HKCU "Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
|
||||
${If} $0 != ""
|
||||
Goto ok
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
|
||||
SetDetailsPrint both
|
||||
DetailPrint "${WAILS_INSTALL_WEBVIEW_DETAILPRINT}"
|
||||
SetDetailsPrint listonly
|
||||
|
||||
InitPluginsDir
|
||||
CreateDirectory "$pluginsdir\webview2bootstrapper"
|
||||
SetOutPath "$pluginsdir\webview2bootstrapper"
|
||||
File "tmp\MicrosoftEdgeWebview2Setup.exe"
|
||||
ExecWait '"$pluginsdir\webview2bootstrapper\MicrosoftEdgeWebview2Setup.exe" /silent /install'
|
||||
|
||||
SetDetailsPrint both
|
||||
ok:
|
||||
!macroend
|
||||
|
||||
# Copy of APP_ASSOCIATE and APP_UNASSOCIATE macros from here https://gist.github.com/nikku/281d0ef126dbc215dd58bfd5b3a5cd5b
|
||||
!macro APP_ASSOCIATE EXT FILECLASS DESCRIPTION ICON COMMANDTEXT COMMAND
|
||||
; Backup the previously associated file class
|
||||
ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" ""
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "${FILECLASS}_backup" "$R0"
|
||||
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "${FILECLASS}"
|
||||
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}" "" `${DESCRIPTION}`
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\DefaultIcon" "" `${ICON}`
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell" "" "open"
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\open" "" `${COMMANDTEXT}`
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\open\command" "" `${COMMAND}`
|
||||
!macroend
|
||||
|
||||
!macro APP_UNASSOCIATE EXT FILECLASS
|
||||
; Backup the previously associated file class
|
||||
ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" `${FILECLASS}_backup`
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "$R0"
|
||||
|
||||
DeleteRegKey SHELL_CONTEXT `Software\Classes\${FILECLASS}`
|
||||
!macroend
|
||||
|
||||
!macro wails.associateFiles
|
||||
; Create file associations
|
||||
{{range .Info.FileAssociations}}
|
||||
!insertmacro APP_ASSOCIATE "{{.Ext}}" "{{.Name}}" "{{.Description}}" "$INSTDIR\{{.IconName}}.ico" "Open with ${INFO_PRODUCTNAME}" "$INSTDIR\${PRODUCT_EXECUTABLE} $\"%1$\""
|
||||
|
||||
File "..\{{.IconName}}.ico"
|
||||
{{end}}
|
||||
!macroend
|
||||
|
||||
!macro wails.unassociateFiles
|
||||
; Delete app associations
|
||||
{{range .Info.FileAssociations}}
|
||||
!insertmacro APP_UNASSOCIATE "{{.Ext}}" "{{.Name}}"
|
||||
|
||||
Delete "$INSTDIR\{{.IconName}}.ico"
|
||||
{{end}}
|
||||
!macroend
|
||||
|
||||
!macro CUSTOM_PROTOCOL_ASSOCIATE PROTOCOL DESCRIPTION ICON COMMAND
|
||||
DeleteRegKey SHELL_CONTEXT "Software\Classes\${PROTOCOL}"
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}" "" "${DESCRIPTION}"
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}" "URL Protocol" ""
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\DefaultIcon" "" "${ICON}"
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\shell" "" ""
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\shell\open" "" ""
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\shell\open\command" "" "${COMMAND}"
|
||||
!macroend
|
||||
|
||||
!macro CUSTOM_PROTOCOL_UNASSOCIATE PROTOCOL
|
||||
DeleteRegKey SHELL_CONTEXT "Software\Classes\${PROTOCOL}"
|
||||
!macroend
|
||||
|
||||
!macro wails.associateCustomProtocols
|
||||
; Create custom protocols associations
|
||||
{{range .Info.Protocols}}
|
||||
!insertmacro CUSTOM_PROTOCOL_ASSOCIATE "{{.Scheme}}" "{{.Description}}" "$INSTDIR\${PRODUCT_EXECUTABLE},0" "$INSTDIR\${PRODUCT_EXECUTABLE} $\"%1$\""
|
||||
|
||||
{{end}}
|
||||
!macroend
|
||||
|
||||
!macro wails.unassociateCustomProtocols
|
||||
; Delete app custom protocol associations
|
||||
{{range .Info.Protocols}}
|
||||
!insertmacro CUSTOM_PROTOCOL_UNASSOCIATE "{{.Scheme}}"
|
||||
{{end}}
|
||||
!macroend
|
||||
15
Tools/quickly/build/windows/wails.exe.manifest
Normal file
15
Tools/quickly/build/windows/wails.exe.manifest
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<assemblyIdentity type="win32" name="com.wails.{{.Name}}" version="{{.Info.ProductVersion}}.0" processorArchitecture="*"/>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware> <!-- fallback for Windows 7 and 8 -->
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2,permonitor</dpiAwareness> <!-- falls back to per-monitor if per-monitor v2 is not supported -->
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
23
Tools/quickly/frontend/README.md
Normal file
23
Tools/quickly/frontend/README.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Vue 3 + TypeScript + Vite
|
||||
|
||||
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue
|
||||
3 `<script setup>` SFCs, check out
|
||||
the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
||||
|
||||
## Recommended IDE Setup
|
||||
|
||||
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
|
||||
|
||||
## Type Support For `.vue` Imports in TS
|
||||
|
||||
Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type
|
||||
by default. In most cases this is fine if you don't really care about component prop types outside of templates.
|
||||
However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using
|
||||
manual `h(...)` calls), you can enable Volar's Take Over mode by following these steps:
|
||||
|
||||
1. Run `Extensions: Show Built-in Extensions` from VS Code's command palette, look
|
||||
for `TypeScript and JavaScript Language Features`, then right click and select `Disable (Workspace)`. By default,
|
||||
Take Over mode will enable itself if the default TypeScript extension is disabled.
|
||||
2. Reload the VS Code window by running `Developer: Reload Window` from the command palette.
|
||||
|
||||
You can learn more about Take Over mode [here](https://github.com/johnsoncodehk/volar/discussions/471).
|
||||
13
Tools/quickly/frontend/index.html
Normal file
13
Tools/quickly/frontend/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
||||
<title>Quickly</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="./src/main.ts" type="module"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
1319
Tools/quickly/frontend/package-lock.json
generated
Normal file
1319
Tools/quickly/frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
24
Tools/quickly/frontend/package.json
Normal file
24
Tools/quickly/frontend/package.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vue-tsc --noEmit && vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@element-plus/icons-vue": "^2.3.2",
|
||||
"element-plus": "^2.13.1",
|
||||
"vue": "^3.2.37",
|
||||
"vue-router": "^4.6.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/types": "^7.18.10",
|
||||
"@vitejs/plugin-vue": "^3.0.3",
|
||||
"typescript": "^4.6.4",
|
||||
"vite": "^3.0.7",
|
||||
"vue-tsc": "^1.8.27"
|
||||
}
|
||||
}
|
||||
1
Tools/quickly/frontend/package.json.md5
Normal file
1
Tools/quickly/frontend/package.json.md5
Normal file
@@ -0,0 +1 @@
|
||||
27251dcea746309433392e41407ed6c9
|
||||
164
Tools/quickly/frontend/src/App.vue
Normal file
164
Tools/quickly/frontend/src/App.vue
Normal file
@@ -0,0 +1,164 @@
|
||||
<script lang="ts" setup>
|
||||
import {ref} from 'vue'
|
||||
import {useRoute, useRouter} from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
const activeMenu = ref('home')
|
||||
|
||||
const menuItems = [
|
||||
{index: 'home', path: '/home', title: '主页'},
|
||||
{index: 'settings', path: '/settings', title: '设置'},
|
||||
{index: 'swagger', path: '/swagger', title: 'Swagger'},
|
||||
{index: 'mysql-model', path: '/mysql-model', title: 'MySQL Model'},
|
||||
{index: 'update-common', path: '/update-common', title: '更新 Common'}
|
||||
]
|
||||
|
||||
function handleMenuSelect(index: string) {
|
||||
activeMenu.value = index
|
||||
const menuItem = menuItems.find(item => item.index === index)
|
||||
if (menuItem) {
|
||||
router.push(menuItem.path)
|
||||
}
|
||||
}
|
||||
|
||||
router.afterEach((to) => {
|
||||
const menuItem = menuItems.find(item => item.path === to.path)
|
||||
if (menuItem) {
|
||||
activeMenu.value = menuItem.index
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-container class="app-container">
|
||||
<el-aside width="200px" class="app-aside">
|
||||
<div class="logo-container">
|
||||
<img src="./assets/images/logo-universal.png" alt="logo" class="logo"/>
|
||||
<span class="app-title">Quickly</span>
|
||||
</div>
|
||||
<el-menu
|
||||
:default-active="activeMenu"
|
||||
class="el-menu-vertical"
|
||||
@select="handleMenuSelect"
|
||||
>
|
||||
<el-menu-item index="home">
|
||||
<el-icon>
|
||||
<House/>
|
||||
</el-icon>
|
||||
<span>主页</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="settings">
|
||||
<el-icon>
|
||||
<Setting/>
|
||||
</el-icon>
|
||||
<span>设置</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="swagger">
|
||||
<el-icon>
|
||||
<Document/>
|
||||
</el-icon>
|
||||
<span>Swagger</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="mysql-model">
|
||||
<el-icon>
|
||||
<DataLine/>
|
||||
</el-icon>
|
||||
<span>MySQL Model</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="update-common">
|
||||
<el-icon>
|
||||
<Refresh/>
|
||||
</el-icon>
|
||||
<span>更新 Common</span>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</el-aside>
|
||||
<el-container class="main-container">
|
||||
<el-header class="app-header">
|
||||
<div class="header-title">{{ route.meta.title || 'Quickly 金牌助手' }}</div>
|
||||
</el-header>
|
||||
<el-main class="app-main">
|
||||
<router-view/>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.app-container {
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.app-aside {
|
||||
background-color: #1b2636;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.logo-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20px;
|
||||
gap: 10px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.app-title {
|
||||
color: #fff;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.el-menu-vertical {
|
||||
border: none;
|
||||
background-color: transparent;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.el-menu-vertical .el-menu-item {
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
|
||||
.el-menu-vertical .el-menu-item:hover {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.el-menu-vertical .el-menu-item.is-active {
|
||||
background-color: #409eff;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.main-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.app-header {
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #e4e7ed;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 20px;
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
.header-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.app-main {
|
||||
background-color: #f5f7fa;
|
||||
padding: 0;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
93
Tools/quickly/frontend/src/assets/fonts/OFL.txt
Normal file
93
Tools/quickly/frontend/src/assets/fonts/OFL.txt
Normal file
@@ -0,0 +1,93 @@
|
||||
Copyright 2016 The Nunito Project Authors (contact@sansoxygen.com),
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
Binary file not shown.
BIN
Tools/quickly/frontend/src/assets/images/logo-universal.png
Normal file
BIN
Tools/quickly/frontend/src/assets/images/logo-universal.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 136 KiB |
17
Tools/quickly/frontend/src/main.ts
Normal file
17
Tools/quickly/frontend/src/main.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import {createApp} from 'vue'
|
||||
import ElementPlus from 'element-plus'
|
||||
import 'element-plus/dist/index.css'
|
||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import './style.css'
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
app.component(key, component)
|
||||
}
|
||||
|
||||
app.use(ElementPlus)
|
||||
app.use(router)
|
||||
app.mount('#app')
|
||||
50
Tools/quickly/frontend/src/router/index.ts
Normal file
50
Tools/quickly/frontend/src/router/index.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
|
||||
import Home from '../views/Home.vue'
|
||||
import Settings from '../views/Settings.vue'
|
||||
import Swagger from '../views/Swagger.vue'
|
||||
import MySQLModel from '../views/MySQLModel.vue'
|
||||
import UpdateCommon from '../views/UpdateCommon.vue'
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '/',
|
||||
redirect: '/home'
|
||||
},
|
||||
{
|
||||
path: '/home',
|
||||
name: 'Home',
|
||||
component: Home,
|
||||
meta: { title: '主页' }
|
||||
},
|
||||
{
|
||||
path: '/settings',
|
||||
name: 'Settings',
|
||||
component: Settings,
|
||||
meta: { title: '设置' }
|
||||
},
|
||||
{
|
||||
path: '/swagger',
|
||||
name: 'Swagger',
|
||||
component: Swagger,
|
||||
meta: { title: 'Swagger' }
|
||||
},
|
||||
{
|
||||
path: '/mysql-model',
|
||||
name: 'MySQLModel',
|
||||
component: MySQLModel,
|
||||
meta: { title: 'MySQL Model' }
|
||||
},
|
||||
{
|
||||
path: '/update-common',
|
||||
name: 'UpdateCommon',
|
||||
component: UpdateCommon,
|
||||
meta: { title: '更新 Common' }
|
||||
}
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(),
|
||||
routes
|
||||
})
|
||||
|
||||
export default router
|
||||
23
Tools/quickly/frontend/src/style.css
Normal file
23
Tools/quickly/frontend/src/style.css
Normal file
@@ -0,0 +1,23 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
|
||||
"Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
|
||||
sans-serif;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Nunito";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local(""),
|
||||
url("assets/fonts/nunito-v16-latin-regular.woff2") format("woff2");
|
||||
}
|
||||
|
||||
#app {
|
||||
height: 100vh;
|
||||
}
|
||||
143
Tools/quickly/frontend/src/views/Home.vue
Normal file
143
Tools/quickly/frontend/src/views/Home.vue
Normal file
@@ -0,0 +1,143 @@
|
||||
<script lang="ts" setup>
|
||||
import {reactive} from 'vue'
|
||||
|
||||
const features = reactive([
|
||||
{
|
||||
title: '更新 Common',
|
||||
description: '批量更新多个项目中 Common 库的版本,支持自定义 Go Module Name,自动执行 go get 和 go mod tidy 命令。',
|
||||
icon: '🔄',
|
||||
path: '/update-common'
|
||||
},
|
||||
{
|
||||
title: 'MySQL Model',
|
||||
description: '执行 gen.ps1 脚本生成 model 和 query 文件,自动替换 import 路径,支持多数据库配置管理。',
|
||||
icon: '🗄️',
|
||||
path: '/mysql-model'
|
||||
},
|
||||
{
|
||||
title: 'Swagger',
|
||||
description: '配置 Swagger 目录,自动扫描所有 .swagger.json 文件,启动本地 HTTP 服务查看 API 文档。',
|
||||
icon: '📚',
|
||||
path: '/swagger'
|
||||
},
|
||||
{
|
||||
title: '设置',
|
||||
description: '自定义主题、语言、通知等应用设置,管理全局配置。',
|
||||
icon: '⚙️',
|
||||
path: '/settings'
|
||||
}
|
||||
])
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="home-container">
|
||||
<div class="welcome-section">
|
||||
<h1 class="welcome-title">欢迎使用 Quickly</h1>
|
||||
<p class="welcome-subtitle">高效开发工具,提升工作效率</p>
|
||||
</div>
|
||||
|
||||
<div class="features-section">
|
||||
<h2 class="section-title">功能介绍</h2>
|
||||
<div class="features-grid">
|
||||
<el-card v-for="(feature, index) in features" :key="index" class="feature-card">
|
||||
<div class="feature-icon">{{ feature.icon }}</div>
|
||||
<h3 class="feature-title">{{ feature.title }}</h3>
|
||||
<p class="feature-description">{{ feature.description }}</p>
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.home-container {
|
||||
padding: 20px;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.welcome-section {
|
||||
text-align: center;
|
||||
margin: 40px 0;
|
||||
}
|
||||
|
||||
.welcome-title {
|
||||
font-size: 48px;
|
||||
font-weight: 700;
|
||||
margin: 0 0 10px 0;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
}
|
||||
|
||||
.welcome-subtitle {
|
||||
font-size: 18px;
|
||||
color: #666;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.features-section {
|
||||
margin: 40px 0;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 28px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin: 0 0 30px 0;
|
||||
}
|
||||
|
||||
.features-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.feature-card {
|
||||
text-align: center;
|
||||
transition: transform 0.3s, box-shadow 0.3s;
|
||||
cursor: pointer;
|
||||
padding: 30px 20px;
|
||||
}
|
||||
|
||||
.feature-card:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.feature-icon {
|
||||
font-size: 64px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.feature-title {
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
margin: 0 0 15px 0;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.feature-description {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.info-card {
|
||||
margin: 40px 0;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.info-content {
|
||||
padding: 20px 0;
|
||||
}
|
||||
</style>
|
||||
431
Tools/quickly/frontend/src/views/MySQLModel.vue
Normal file
431
Tools/quickly/frontend/src/views/MySQLModel.vue
Normal file
@@ -0,0 +1,431 @@
|
||||
<script lang="ts" setup>
|
||||
import {onMounted, reactive, ref} from 'vue'
|
||||
import {ElMessage} from 'element-plus'
|
||||
import {
|
||||
AddDatabaseConfig,
|
||||
CheckGenPs1Exists,
|
||||
ExecuteGenPs1,
|
||||
GetSettings,
|
||||
ReadGoModModule,
|
||||
RemoveDatabaseConfig,
|
||||
SaveSettings,
|
||||
SelectDirectory,
|
||||
SelectFile,
|
||||
UpdateDatabaseConfig
|
||||
} from '../../wailsjs/go/backend/App'
|
||||
|
||||
interface DatabaseConfig {
|
||||
name: string
|
||||
targetPath: string
|
||||
modelPackagePath: string
|
||||
}
|
||||
|
||||
interface AppSettings {
|
||||
theme: string
|
||||
language: string
|
||||
notifications: boolean
|
||||
autoStart: boolean
|
||||
mysqlModelPath: string
|
||||
defaultQueryPackagePath: string
|
||||
databases: DatabaseConfig[]
|
||||
}
|
||||
|
||||
const settings = reactive<AppSettings>({
|
||||
theme: 'light',
|
||||
language: 'zh-CN',
|
||||
notifications: true,
|
||||
autoStart: false,
|
||||
mysqlModelPath: '',
|
||||
defaultQueryPackagePath: '',
|
||||
databases: []
|
||||
})
|
||||
|
||||
const dbForm = reactive<DatabaseConfig>({
|
||||
name: '',
|
||||
targetPath: '',
|
||||
modelPackagePath: ''
|
||||
})
|
||||
|
||||
const scriptForm = reactive({
|
||||
selectedDbName: '',
|
||||
output: ''
|
||||
})
|
||||
|
||||
const isExecuting = ref(false)
|
||||
const dialogVisible = ref(false)
|
||||
const editingIndex = ref(-1)
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const loadedSettings = await GetSettings() as any
|
||||
settings.theme = loadedSettings.theme
|
||||
settings.language = loadedSettings.language
|
||||
settings.notifications = loadedSettings.notifications
|
||||
settings.autoStart = loadedSettings.autoStart
|
||||
settings.mysqlModelPath = loadedSettings.mysqlModelPath
|
||||
settings.defaultQueryPackagePath = loadedSettings.defaultQueryPackagePath || ''
|
||||
if (loadedSettings.databases) {
|
||||
settings.databases = loadedSettings.databases
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load settings:', error)
|
||||
}
|
||||
})
|
||||
|
||||
async function validatePath(path: string): Promise<boolean> {
|
||||
if (!path) {
|
||||
return false
|
||||
}
|
||||
|
||||
try {
|
||||
const exists = await CheckGenPs1Exists(path)
|
||||
if (!exists) {
|
||||
ElMessage.warning('所选文件不是有效的 gen.ps1 文件')
|
||||
}
|
||||
return exists
|
||||
} catch (error) {
|
||||
console.error('Failed to check gen.ps1:', error)
|
||||
ElMessage.error('检查文件时出错')
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
async function selectMysqlModelPath() {
|
||||
try {
|
||||
const path = await SelectFile('选择 gen.ps1 文件', settings.mysqlModelPath, '*.ps1')
|
||||
if (path) {
|
||||
const isValid = await validatePath(path)
|
||||
if (isValid) {
|
||||
settings.mysqlModelPath = path
|
||||
|
||||
try {
|
||||
const modulePath = await ReadGoModModule(path)
|
||||
if (modulePath) {
|
||||
settings.defaultQueryPackagePath = modulePath
|
||||
ElMessage.success(`已自动读取 go.mod 中的 module: ${modulePath}`)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to read go.mod:', error)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to select file:', error)
|
||||
}
|
||||
}
|
||||
|
||||
async function handlePathChange() {
|
||||
if (settings.mysqlModelPath) {
|
||||
await validatePath(settings.mysqlModelPath)
|
||||
}
|
||||
}
|
||||
|
||||
async function saveSettings() {
|
||||
if (!settings.mysqlModelPath) {
|
||||
ElMessage.warning('请先设置 MySQL Model 路径')
|
||||
return
|
||||
}
|
||||
|
||||
const isValid = await validatePath(settings.mysqlModelPath)
|
||||
if (!isValid) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const currentSettings = await GetSettings() as any
|
||||
currentSettings.mysqlModelPath = settings.mysqlModelPath
|
||||
currentSettings.defaultQueryPackagePath = settings.defaultQueryPackagePath
|
||||
currentSettings.databases = settings.databases
|
||||
await SaveSettings(currentSettings)
|
||||
ElMessage.success('设置保存成功')
|
||||
} catch (error) {
|
||||
console.error('Failed to save settings:', error)
|
||||
ElMessage.error('设置保存失败')
|
||||
}
|
||||
}
|
||||
|
||||
async function selectTargetPath() {
|
||||
try {
|
||||
const path = await SelectDirectory('选择生成文件目标路径', dbForm.targetPath)
|
||||
if (path) {
|
||||
dbForm.targetPath = path
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to select directory:', error)
|
||||
}
|
||||
}
|
||||
|
||||
function openAddDialog() {
|
||||
editingIndex.value = -1
|
||||
dbForm.name = ''
|
||||
dbForm.targetPath = ''
|
||||
dbForm.modelPackagePath = ''
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
function openEditDialog(index: number) {
|
||||
editingIndex.value = index
|
||||
const db = settings.databases[index]
|
||||
dbForm.name = db.name
|
||||
dbForm.targetPath = db.targetPath
|
||||
dbForm.modelPackagePath = db.modelPackagePath || ''
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
async function handleAddDb() {
|
||||
if (!dbForm.name) {
|
||||
ElMessage.warning('请输入数据库名称')
|
||||
return
|
||||
}
|
||||
|
||||
if (!dbForm.targetPath) {
|
||||
ElMessage.warning('请选择目标路径')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
if (editingIndex.value === -1) {
|
||||
await AddDatabaseConfig(dbForm.name, dbForm.targetPath, dbForm.modelPackagePath)
|
||||
ElMessage.success('添加成功')
|
||||
} else {
|
||||
await UpdateDatabaseConfig(settings.databases[editingIndex.value].name, dbForm.name, dbForm.targetPath, dbForm.modelPackagePath)
|
||||
ElMessage.success('更新成功')
|
||||
}
|
||||
dialogVisible.value = false
|
||||
|
||||
const loadedSettings = await GetSettings() as any
|
||||
settings.theme = loadedSettings.theme
|
||||
settings.language = loadedSettings.language
|
||||
settings.notifications = loadedSettings.notifications
|
||||
settings.autoStart = loadedSettings.autoStart
|
||||
settings.mysqlModelPath = loadedSettings.mysqlModelPath
|
||||
settings.defaultQueryPackagePath = loadedSettings.defaultQueryPackagePath || ''
|
||||
if (loadedSettings.databases) {
|
||||
settings.databases = loadedSettings.databases
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to save database config:', error)
|
||||
ElMessage.error('保存失败')
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDeleteDb(index: number) {
|
||||
const db = settings.databases[index]
|
||||
try {
|
||||
await RemoveDatabaseConfig(db.name)
|
||||
ElMessage.success('删除成功')
|
||||
|
||||
const loadedSettings = await GetSettings() as any
|
||||
settings.theme = loadedSettings.theme
|
||||
settings.language = loadedSettings.language
|
||||
settings.notifications = loadedSettings.notifications
|
||||
settings.autoStart = loadedSettings.autoStart
|
||||
settings.mysqlModelPath = loadedSettings.mysqlModelPath
|
||||
if (loadedSettings.databases) {
|
||||
settings.databases = loadedSettings.databases
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to delete database config:', error)
|
||||
ElMessage.error('删除失败')
|
||||
}
|
||||
}
|
||||
|
||||
async function executeScript() {
|
||||
if (!settings.mysqlModelPath) {
|
||||
ElMessage.warning('请先设置 MySQL Model 路径')
|
||||
return
|
||||
}
|
||||
|
||||
if (!scriptForm.selectedDbName) {
|
||||
ElMessage.warning('请选择要执行的数据库')
|
||||
return
|
||||
}
|
||||
|
||||
const isValid = await validatePath(settings.mysqlModelPath)
|
||||
if (!isValid) {
|
||||
return
|
||||
}
|
||||
|
||||
const selectedDb = settings.databases.find(db => db.name === scriptForm.selectedDbName)
|
||||
if (!selectedDb) {
|
||||
ElMessage.warning('未找到数据库配置')
|
||||
return
|
||||
}
|
||||
|
||||
isExecuting.value = true
|
||||
scriptForm.output = '正在执行脚本...'
|
||||
|
||||
try {
|
||||
const output = await ExecuteGenPs1(settings.mysqlModelPath, scriptForm.selectedDbName, selectedDb.targetPath, selectedDb.modelPackagePath || '')
|
||||
scriptForm.output = output + '\n\n文件已复制到目标路径: ' + selectedDb.targetPath
|
||||
ElMessage.success('脚本执行成功')
|
||||
} catch (error) {
|
||||
console.error('Failed to execute script:', error)
|
||||
scriptForm.output = `执行失败: ${error}`
|
||||
ElMessage.error('脚本执行失败')
|
||||
} finally {
|
||||
isExecuting.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mysql-model-container">
|
||||
<el-card class="script-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>生成 model&query 文件</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-form label-width="140px" class="script-form">
|
||||
<el-form-item label="选择数据库">
|
||||
<el-select
|
||||
v-model="scriptForm.selectedDbName"
|
||||
placeholder="请选择要执行的数据库"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="db in settings.databases"
|
||||
:key="db.name"
|
||||
:label="db.name"
|
||||
:value="db.name"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="executeScript"
|
||||
:loading="isExecuting"
|
||||
>
|
||||
执行脚本
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="执行输出">
|
||||
<el-input
|
||||
v-model="scriptForm.output"
|
||||
type="textarea"
|
||||
:rows="10"
|
||||
placeholder="脚本执行结果将显示在这里"
|
||||
readonly
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="mysql-model-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>MySQL Model 设置</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-form label-width="140px" class="settings-form">
|
||||
<el-form-item label="gen.ps1 路径">
|
||||
<el-input
|
||||
v-model="settings.mysqlModelPath"
|
||||
placeholder="请输入或选择 gen.ps1 文件路径"
|
||||
clearable
|
||||
@change="handlePathChange"
|
||||
>
|
||||
<template #append>
|
||||
<el-button @click="selectMysqlModelPath">选择文件</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="Query包名">
|
||||
<el-input
|
||||
v-model="settings.defaultQueryPackagePath"
|
||||
placeholder="请输入默认 Query 包名,例如:git.hlsq.asia/mmorpg/service-user/internal/dao/model"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="saveSettings">保存设置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="database-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>数据库配置管理</span>
|
||||
<el-button type="primary" size="small" @click="openAddDialog">添加配置</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<el-table :data="settings.databases" style="width: 100%">
|
||||
<el-table-column prop="name" label="数据库名称"/>
|
||||
<el-table-column prop="targetPath" label="目标路径" show-overflow-tooltip/>
|
||||
<el-table-column prop="modelPackagePath" label="Query包名" show-overflow-tooltip/>
|
||||
<el-table-column label="操作" width="200">
|
||||
<template #default="scope">
|
||||
<el-button size="small" @click="openEditDialog(scope.$index)">编辑</el-button>
|
||||
<el-button size="small" type="danger" @click="handleDeleteDb(scope.$index)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:title="editingIndex === -1 ? '添加数据库配置' : '编辑数据库配置'"
|
||||
width="500px"
|
||||
>
|
||||
<el-form label-width="120px">
|
||||
<el-form-item label="数据库名称">
|
||||
<el-input
|
||||
v-model="dbForm.name"
|
||||
placeholder="请输入数据库名称,例如:user_db"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="目标路径">
|
||||
<el-input
|
||||
v-model="dbForm.targetPath"
|
||||
placeholder="请输入或选择生成文件的目标路径"
|
||||
clearable
|
||||
>
|
||||
<template #append>
|
||||
<el-button @click="selectTargetPath">选择文件夹</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="Query包名">
|
||||
<el-input
|
||||
v-model="dbForm.modelPackagePath"
|
||||
placeholder="请输入package name,例如:git.hlsq.asia/mmorpg/service-user/internal/dao/model"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleAddDb">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.mysql-model-container {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.mysql-model-card,
|
||||
.database-card,
|
||||
.script-card {
|
||||
max-width: 900px;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.settings-form,
|
||||
.script-form {
|
||||
padding: 20px 0;
|
||||
}
|
||||
</style>
|
||||
114
Tools/quickly/frontend/src/views/Settings.vue
Normal file
114
Tools/quickly/frontend/src/views/Settings.vue
Normal file
@@ -0,0 +1,114 @@
|
||||
<script lang="ts" setup>
|
||||
import {onMounted, reactive} from 'vue'
|
||||
import {ElMessage} from 'element-plus'
|
||||
import {GetSettings, SaveSettings} from '../../wailsjs/go/backend/App'
|
||||
|
||||
interface DatabaseConfig {
|
||||
name: string
|
||||
targetPath: string
|
||||
modelPackagePath: string
|
||||
}
|
||||
|
||||
interface AppSettings {
|
||||
theme: string
|
||||
language: string
|
||||
notifications: boolean
|
||||
autoStart: boolean
|
||||
databases?: DatabaseConfig[]
|
||||
}
|
||||
|
||||
const settings = reactive<AppSettings>({
|
||||
theme: 'light',
|
||||
language: 'zh-CN',
|
||||
notifications: true,
|
||||
autoStart: false
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const loadedSettings = await GetSettings() as any
|
||||
settings.theme = loadedSettings.theme
|
||||
settings.language = loadedSettings.language
|
||||
settings.notifications = loadedSettings.notifications
|
||||
settings.autoStart = loadedSettings.autoStart
|
||||
if (loadedSettings.databases) {
|
||||
settings.databases = loadedSettings.databases
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load settings:', error)
|
||||
}
|
||||
})
|
||||
|
||||
async function saveSettings() {
|
||||
try {
|
||||
const currentSettings = await GetSettings() as any
|
||||
currentSettings.theme = settings.theme
|
||||
currentSettings.language = settings.language
|
||||
currentSettings.notifications = settings.notifications
|
||||
currentSettings.autoStart = settings.autoStart
|
||||
await SaveSettings(currentSettings)
|
||||
ElMessage.success('设置保存成功')
|
||||
} catch (error) {
|
||||
console.error('Failed to save settings:', error)
|
||||
ElMessage.error('设置保存失败')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="settings-container">
|
||||
<el-card class="settings-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>设置</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-form label-width="120px" class="settings-form">
|
||||
<el-form-item label="主题">
|
||||
<el-select v-model="settings.theme" placeholder="选择主题">
|
||||
<el-option label="浅色" value="light"/>
|
||||
<el-option label="深色" value="dark"/>
|
||||
<el-option label="跟随系统" value="auto"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="语言">
|
||||
<el-select v-model="settings.language" placeholder="选择语言">
|
||||
<el-option label="简体中文" value="zh-CN"/>
|
||||
<el-option label="English" value="en-US"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="通知">
|
||||
<el-switch v-model="settings.notifications"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="开机自启">
|
||||
<el-switch v-model="settings.autoStart"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="saveSettings">保存设置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.settings-container {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.settings-card {
|
||||
max-width: 600px;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.settings-form {
|
||||
padding: 20px 0;
|
||||
}
|
||||
</style>
|
||||
349
Tools/quickly/frontend/src/views/Swagger.vue
Normal file
349
Tools/quickly/frontend/src/views/Swagger.vue
Normal file
@@ -0,0 +1,349 @@
|
||||
<script lang="ts" setup>
|
||||
import {onMounted, reactive, ref} from 'vue'
|
||||
import {ElMessage} from 'element-plus'
|
||||
import {
|
||||
GetSettings,
|
||||
GetSwaggerFiles,
|
||||
GetSwaggerServerURL,
|
||||
IsSwaggerServerRunning,
|
||||
ReadSwaggerFile,
|
||||
SaveSettings,
|
||||
SelectDirectory,
|
||||
StartSwaggerServer,
|
||||
StopSwaggerServer
|
||||
} from '../../wailsjs/go/backend/App'
|
||||
|
||||
interface SwaggerFile {
|
||||
name: string
|
||||
path: string
|
||||
size: number
|
||||
modifiedTime: string
|
||||
}
|
||||
|
||||
interface AppSettings {
|
||||
theme: string
|
||||
language: string
|
||||
notifications: boolean
|
||||
autoStart: boolean
|
||||
swaggerDir: string
|
||||
}
|
||||
|
||||
const settings = reactive<AppSettings>({
|
||||
theme: 'light',
|
||||
language: 'zh-CN',
|
||||
notifications: true,
|
||||
autoStart: false,
|
||||
swaggerDir: ''
|
||||
})
|
||||
|
||||
const swaggerFiles = ref<SwaggerFile[]>([])
|
||||
const selectedFile = ref<SwaggerFile | null>(null)
|
||||
const selectedSwaggerFile = ref<SwaggerFile | null>(null)
|
||||
const fileContent = ref('')
|
||||
const isLoading = ref(false)
|
||||
const serverURL = ref('')
|
||||
const isServerRunning = ref(false)
|
||||
|
||||
async function selectSwaggerDir() {
|
||||
try {
|
||||
const path = await SelectDirectory('选择 Swagger 目录', settings.swaggerDir)
|
||||
if (path) {
|
||||
settings.swaggerDir = path
|
||||
await loadSwaggerFiles()
|
||||
await saveSettings()
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to select directory:', error)
|
||||
}
|
||||
}
|
||||
|
||||
async function loadSwaggerFiles() {
|
||||
if (!settings.swaggerDir) {
|
||||
return
|
||||
}
|
||||
|
||||
isLoading.value = true
|
||||
try {
|
||||
const files = await GetSwaggerFiles(settings.swaggerDir)
|
||||
swaggerFiles.value = files
|
||||
} catch (error) {
|
||||
console.error('Failed to load swagger files:', error)
|
||||
ElMessage.error('加载 Swagger 文件失败')
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function saveSettings() {
|
||||
try {
|
||||
const currentSettings = await GetSettings() as any
|
||||
currentSettings.swaggerDir = settings.swaggerDir
|
||||
await SaveSettings(currentSettings)
|
||||
ElMessage.success('设置保存成功')
|
||||
} catch (error) {
|
||||
console.error('Failed to save settings:', error)
|
||||
ElMessage.error('设置保存失败')
|
||||
}
|
||||
}
|
||||
|
||||
async function viewFile(file: SwaggerFile) {
|
||||
selectedFile.value = file
|
||||
isLoading.value = true
|
||||
try {
|
||||
const content = await ReadSwaggerFile(file.path)
|
||||
fileContent.value = content
|
||||
} catch (error) {
|
||||
console.error('Failed to read swagger file:', error)
|
||||
ElMessage.error('读取文件失败')
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function formatFileSize(bytes: number): string {
|
||||
if (bytes < 1024) {
|
||||
return bytes + ' B'
|
||||
} else if (bytes < 1024 * 1024) {
|
||||
return (bytes / 1024).toFixed(2) + ' KB'
|
||||
} else {
|
||||
return (bytes / (1024 * 1024)).toFixed(2) + ' MB'
|
||||
}
|
||||
}
|
||||
|
||||
async function startSwaggerServer() {
|
||||
if (!settings.swaggerDir) {
|
||||
ElMessage.warning('请先配置 Swagger 目录')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const url = await StartSwaggerServer(settings.swaggerDir)
|
||||
serverURL.value = url
|
||||
isServerRunning.value = true
|
||||
if (swaggerFiles.value.length > 0) {
|
||||
selectedSwaggerFile.value = swaggerFiles.value[0]
|
||||
}
|
||||
ElMessage.success(`Swagger 服务已启动: ${url}`)
|
||||
} catch (error) {
|
||||
console.error('Failed to start swagger server:', error)
|
||||
ElMessage.error('启动 Swagger 服务失败')
|
||||
}
|
||||
}
|
||||
|
||||
async function stopSwaggerServer() {
|
||||
try {
|
||||
await StopSwaggerServer()
|
||||
serverURL.value = ''
|
||||
isServerRunning.value = false
|
||||
ElMessage.success('Swagger 服务已停止')
|
||||
} catch (error) {
|
||||
console.error('Failed to stop swagger server:', error)
|
||||
ElMessage.error('停止 Swagger 服务失败')
|
||||
}
|
||||
}
|
||||
|
||||
async function checkServerStatus() {
|
||||
try {
|
||||
const running = await IsSwaggerServerRunning()
|
||||
isServerRunning.value = running
|
||||
if (running) {
|
||||
const url = await GetSwaggerServerURL()
|
||||
serverURL.value = url
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to check server status:', error)
|
||||
}
|
||||
}
|
||||
|
||||
function openSwaggerURL() {
|
||||
if (serverURL.value) {
|
||||
window.open(serverURL.value, '_blank')
|
||||
}
|
||||
}
|
||||
|
||||
function updateServerURL() {
|
||||
if (serverURL.value && selectedSwaggerFile.value) {
|
||||
const baseUrl = serverURL.value.split('?')[0]
|
||||
serverURL.value = `${baseUrl}?file=${encodeURIComponent(selectedSwaggerFile.value.name)}`
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const loadedSettings = await GetSettings() as any
|
||||
settings.theme = loadedSettings.theme
|
||||
settings.language = loadedSettings.language
|
||||
settings.notifications = loadedSettings.notifications
|
||||
settings.autoStart = loadedSettings.autoStart
|
||||
settings.swaggerDir = loadedSettings.swaggerDir || ''
|
||||
if (settings.swaggerDir) {
|
||||
await loadSwaggerFiles()
|
||||
}
|
||||
await checkServerStatus()
|
||||
} catch (error) {
|
||||
console.error('Failed to load settings:', error)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="swagger-container">
|
||||
<el-card class="settings-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>Swagger 设置</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-form label-width="140px" class="settings-form">
|
||||
<el-form-item label="Swagger 目录">
|
||||
<el-input
|
||||
v-model="settings.swaggerDir"
|
||||
placeholder="请输入或选择 Swagger 文件目录"
|
||||
clearable
|
||||
>
|
||||
<template #append>
|
||||
<el-button @click="selectSwaggerDir">选择文件夹</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="Swagger 服务">
|
||||
<div class="server-controls">
|
||||
<el-button
|
||||
v-if="!isServerRunning"
|
||||
type="primary"
|
||||
@click="startSwaggerServer"
|
||||
>
|
||||
启动服务
|
||||
</el-button>
|
||||
<el-button
|
||||
v-else
|
||||
type="danger"
|
||||
@click="stopSwaggerServer"
|
||||
>
|
||||
停止服务
|
||||
</el-button>
|
||||
<el-select
|
||||
v-if="isServerRunning && swaggerFiles.length > 1"
|
||||
v-model="selectedSwaggerFile"
|
||||
placeholder="选择 Swagger 文件"
|
||||
class="file-select"
|
||||
@change="updateServerURL"
|
||||
>
|
||||
<el-option
|
||||
v-for="file in swaggerFiles"
|
||||
:key="file.name"
|
||||
:label="file.name"
|
||||
:value="file"
|
||||
/>
|
||||
</el-select>
|
||||
<el-input
|
||||
v-if="serverURL"
|
||||
v-model="serverURL"
|
||||
readonly
|
||||
class="server-url-input"
|
||||
>
|
||||
<template #append>
|
||||
<el-button @click="openSwaggerURL">打开</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="files-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>Swagger 文件列表</span>
|
||||
<el-button type="primary" size="small" @click="loadSwaggerFiles" :loading="isLoading">刷新</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<el-table :data="swaggerFiles" style="width: 100%" v-loading="isLoading">
|
||||
<el-table-column prop="name" label="文件名" show-overflow-tooltip/>
|
||||
<el-table-column prop="size" label="大小" width="120">
|
||||
<template #default="scope">
|
||||
{{ formatFileSize(scope.row.size) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="modifiedTime" label="修改时间" width="180"/>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button size="small" @click="viewFile(scope.row)">查看</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-empty v-if="swaggerFiles.length === 0 && !isLoading" description="暂无 Swagger 文件"/>
|
||||
</el-card>
|
||||
|
||||
<el-card class="content-card" v-if="selectedFile">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>{{ selectedFile.name }}</span>
|
||||
<el-button size="small" @click="selectedFile = null">关闭</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<div class="file-content" v-loading="isLoading">
|
||||
<pre>{{ fileContent }}</pre>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.swagger-container {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.settings-card {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.files-card {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.content-card {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.settings-form {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.server-controls {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.server-url-input {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.file-select {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.file-content {
|
||||
max-height: 600px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.file-content pre {
|
||||
margin: 0;
|
||||
padding: 15px;
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 4px;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
</style>
|
||||
327
Tools/quickly/frontend/src/views/UpdateCommon.vue
Normal file
327
Tools/quickly/frontend/src/views/UpdateCommon.vue
Normal file
@@ -0,0 +1,327 @@
|
||||
<script lang="ts" setup>
|
||||
import {onMounted, reactive, ref} from 'vue'
|
||||
import {ElMessage} from 'element-plus'
|
||||
import {
|
||||
SelectDirectory,
|
||||
GetSettings,
|
||||
AddProjectConfig,
|
||||
RemoveProjectConfig,
|
||||
UpdateProjectConfig,
|
||||
UpdateServiceCommon,
|
||||
SaveSettings
|
||||
} from '../../wailsjs/go/backend/App'
|
||||
|
||||
interface ProjectConfig {
|
||||
name: string
|
||||
path: string
|
||||
}
|
||||
|
||||
interface AppSettings {
|
||||
theme: string
|
||||
language: string
|
||||
notifications: boolean
|
||||
autoStart: boolean
|
||||
modelBasePath: string
|
||||
databases?: any[]
|
||||
projects?: ProjectConfig[]
|
||||
}
|
||||
|
||||
const settings = reactive<AppSettings>({
|
||||
theme: 'light',
|
||||
language: 'zh-CN',
|
||||
notifications: true,
|
||||
autoStart: false,
|
||||
modelBasePath: '',
|
||||
projects: []
|
||||
})
|
||||
|
||||
const projectForm = reactive<ProjectConfig>({
|
||||
name: '',
|
||||
path: ''
|
||||
})
|
||||
|
||||
const updateForm = reactive({
|
||||
commitId: '',
|
||||
selectedProjects: [] as string[]
|
||||
})
|
||||
|
||||
const isUpdating = ref(false)
|
||||
const output = ref('')
|
||||
const projectDialogVisible = ref(false)
|
||||
const editingProjectIndex = ref(-1)
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const loadedSettings = await GetSettings() as any
|
||||
settings.theme = loadedSettings.theme
|
||||
settings.language = loadedSettings.language
|
||||
settings.notifications = loadedSettings.notifications
|
||||
settings.autoStart = loadedSettings.autoStart
|
||||
settings.modelBasePath = loadedSettings.modelBasePath || ''
|
||||
if (loadedSettings.projects) {
|
||||
settings.projects = loadedSettings.projects
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load settings:', error)
|
||||
}
|
||||
})
|
||||
|
||||
async function selectProjectPath() {
|
||||
try {
|
||||
const path = await SelectDirectory('选择项目路径', projectForm.path)
|
||||
if (path) {
|
||||
projectForm.path = path
|
||||
const pathParts = path.replace(/\\/g, '/').split('/')
|
||||
projectForm.name = pathParts[pathParts.length - 1] || ''
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to select directory:', error)
|
||||
}
|
||||
}
|
||||
|
||||
function openAddProjectDialog() {
|
||||
editingProjectIndex.value = -1
|
||||
projectForm.name = ''
|
||||
projectForm.path = ''
|
||||
projectDialogVisible.value = true
|
||||
}
|
||||
|
||||
function openEditProjectDialog(index: number) {
|
||||
editingProjectIndex.value = index
|
||||
const project = settings.projects![index]
|
||||
projectForm.name = project.name
|
||||
projectForm.path = project.path
|
||||
projectDialogVisible.value = true
|
||||
}
|
||||
|
||||
async function handleAddProject() {
|
||||
if (!projectForm.name) {
|
||||
ElMessage.warning('请输入项目名称')
|
||||
return
|
||||
}
|
||||
|
||||
if (!projectForm.path) {
|
||||
ElMessage.warning('请选择项目路径')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
if (editingProjectIndex.value === -1) {
|
||||
await AddProjectConfig(projectForm.name, projectForm.path)
|
||||
ElMessage.success('添加成功')
|
||||
} else {
|
||||
await UpdateProjectConfig(settings.projects![editingProjectIndex.value].name, projectForm.name, projectForm.path)
|
||||
ElMessage.success('更新成功')
|
||||
}
|
||||
projectDialogVisible.value = false
|
||||
|
||||
const loadedSettings = await GetSettings() as any
|
||||
settings.theme = loadedSettings.theme
|
||||
settings.language = loadedSettings.language
|
||||
settings.notifications = loadedSettings.notifications
|
||||
settings.autoStart = loadedSettings.autoStart
|
||||
settings.modelBasePath = loadedSettings.modelBasePath || ''
|
||||
if (loadedSettings.projects) {
|
||||
settings.projects = loadedSettings.projects
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to save project config:', error)
|
||||
ElMessage.error('保存失败')
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDeleteProject(index: number) {
|
||||
const project = settings.projects![index]
|
||||
try {
|
||||
await RemoveProjectConfig(project.name)
|
||||
ElMessage.success('删除成功')
|
||||
|
||||
const loadedSettings = await GetSettings() as any
|
||||
settings.theme = loadedSettings.theme
|
||||
settings.language = loadedSettings.language
|
||||
settings.notifications = loadedSettings.notifications
|
||||
settings.autoStart = loadedSettings.autoStart
|
||||
settings.modelBasePath = loadedSettings.modelBasePath || ''
|
||||
if (loadedSettings.projects) {
|
||||
settings.projects = loadedSettings.projects
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to delete project config:', error)
|
||||
ElMessage.error('删除失败')
|
||||
}
|
||||
}
|
||||
|
||||
async function updateCommonVersion() {
|
||||
if (!updateForm.commitId) {
|
||||
ElMessage.warning('请输入 Commit ID')
|
||||
return
|
||||
}
|
||||
|
||||
if (updateForm.selectedProjects.length === 0) {
|
||||
ElMessage.warning('请至少选择一个项目')
|
||||
return
|
||||
}
|
||||
|
||||
isUpdating.value = true
|
||||
output.value = '正在更新 Common 版本...\n'
|
||||
|
||||
try {
|
||||
const result = await UpdateServiceCommon(updateForm.commitId, updateForm.selectedProjects)
|
||||
output.value = result
|
||||
} catch (error) {
|
||||
console.error('Failed to update common version:', error)
|
||||
output.value = `更新失败: ${error}`
|
||||
} finally {
|
||||
isUpdating.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function saveSettings() {
|
||||
try {
|
||||
const currentSettings = await GetSettings() as any
|
||||
currentSettings.modelBasePath = settings.modelBasePath
|
||||
currentSettings.projects = settings.projects
|
||||
await SaveSettings(currentSettings)
|
||||
ElMessage.success('设置保存成功')
|
||||
} catch (error) {
|
||||
console.error('Failed to save settings:', error)
|
||||
ElMessage.error('设置保存失败')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="update-common-container">
|
||||
<el-card class="update-version-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>更新 Common 版本</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-form label-width="140px" class="settings-form">
|
||||
<el-form-item label="Commit ID">
|
||||
<el-input
|
||||
v-model="updateForm.commitId"
|
||||
placeholder="请输入 Commit ID"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择项目">
|
||||
<el-checkbox-group v-model="updateForm.selectedProjects">
|
||||
<el-checkbox
|
||||
v-for="project in settings.projects"
|
||||
:key="project.name"
|
||||
:label="project.name"
|
||||
>
|
||||
{{ project.name }}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="updateCommonVersion"
|
||||
:loading="isUpdating"
|
||||
>
|
||||
更新 Common 版本
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="执行输出">
|
||||
<el-input
|
||||
v-model="output"
|
||||
type="textarea"
|
||||
:rows="10"
|
||||
placeholder="更新结果将显示在这里"
|
||||
readonly
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="project-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>项目配置管理</span>
|
||||
<el-button type="primary" size="small" @click="openAddProjectDialog">添加配置</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<el-form label-width="140px" class="settings-form">
|
||||
<el-form-item label="Go Module Name">
|
||||
<el-input
|
||||
v-model="settings.modelBasePath"
|
||||
placeholder="请输入 Go Module Name,例如:git.hlsq.asia/mmorpg/service-common"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="saveSettings">保存设置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table :data="settings.projects" style="width: 100%">
|
||||
<el-table-column prop="name" label="项目名称"/>
|
||||
<el-table-column prop="path" label="项目路径" show-overflow-tooltip/>
|
||||
<el-table-column label="操作" width="200">
|
||||
<template #default="scope">
|
||||
<el-button size="small" @click="openEditProjectDialog(scope.$index)">编辑</el-button>
|
||||
<el-button size="small" type="danger" @click="handleDeleteProject(scope.$index)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<el-dialog
|
||||
v-model="projectDialogVisible"
|
||||
:title="editingProjectIndex === -1 ? '添加项目配置' : '编辑项目配置'"
|
||||
width="500px"
|
||||
>
|
||||
<el-form label-width="120px">
|
||||
<el-form-item label="项目名称">
|
||||
<el-input
|
||||
v-model="projectForm.name"
|
||||
placeholder="自动从路径提取,也可手动修改"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目路径">
|
||||
<el-input
|
||||
v-model="projectForm.path"
|
||||
placeholder="请输入或选择项目路径(需包含 go.mod 文件)"
|
||||
clearable
|
||||
>
|
||||
<template #append>
|
||||
<el-button @click="selectProjectPath">选择文件夹</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="projectDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleAddProject">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.update-common-container {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.update-common-card,
|
||||
.project-card,
|
||||
.update-version-card {
|
||||
max-width: 900px;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.settings-form {
|
||||
padding: 20px 0;
|
||||
}
|
||||
</style>
|
||||
7
Tools/quickly/frontend/src/vite-env.d.ts
vendored
Normal file
7
Tools/quickly/frontend/src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare module '*.vue' {
|
||||
import type {DefineComponent} from 'vue'
|
||||
const component: DefineComponent<{}, {}, any>
|
||||
export default component
|
||||
}
|
||||
30
Tools/quickly/frontend/tsconfig.json
Normal file
30
Tools/quickly/frontend/tsconfig.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"strict": false,
|
||||
"jsx": "preserve",
|
||||
"sourceMap": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"esModuleInterop": true,
|
||||
"lib": [
|
||||
"ESNext",
|
||||
"DOM"
|
||||
],
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.d.ts",
|
||||
"src/**/*.tsx",
|
||||
"src/**/*.vue"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.node.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
11
Tools/quickly/frontend/tsconfig.node.json
Normal file
11
Tools/quickly/frontend/tsconfig.node.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"include": [
|
||||
"vite.config.ts"
|
||||
]
|
||||
}
|
||||
7
Tools/quickly/frontend/vite.config.ts
Normal file
7
Tools/quickly/frontend/vite.config.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import {defineConfig} from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [vue()]
|
||||
})
|
||||
45
Tools/quickly/frontend/wailsjs/go/backend/App.d.ts
vendored
Normal file
45
Tools/quickly/frontend/wailsjs/go/backend/App.d.ts
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
import {backend} from '../models';
|
||||
|
||||
export function AddDatabaseConfig(arg1:string,arg2:string,arg3:string):Promise<void>;
|
||||
|
||||
export function AddProjectConfig(arg1:string,arg2:string):Promise<void>;
|
||||
|
||||
export function CheckGenPs1Exists(arg1:string):Promise<boolean>;
|
||||
|
||||
export function ExecuteGenPs1(arg1:string,arg2:string,arg3:string,arg4:string):Promise<string>;
|
||||
|
||||
export function GetSettings():Promise<backend.Settings>;
|
||||
|
||||
export function GetSwaggerFiles(arg1:string):Promise<Array<backend.SwaggerFile>>;
|
||||
|
||||
export function GetSwaggerServerURL():Promise<string>;
|
||||
|
||||
export function Greet(arg1:string):Promise<string>;
|
||||
|
||||
export function IsSwaggerServerRunning():Promise<boolean>;
|
||||
|
||||
export function ReadGoModModule(arg1:string):Promise<string>;
|
||||
|
||||
export function ReadSwaggerFile(arg1:string):Promise<string>;
|
||||
|
||||
export function RemoveDatabaseConfig(arg1:string):Promise<void>;
|
||||
|
||||
export function RemoveProjectConfig(arg1:string):Promise<void>;
|
||||
|
||||
export function SaveSettings(arg1:backend.Settings):Promise<void>;
|
||||
|
||||
export function SelectDirectory(arg1:string,arg2:string):Promise<string>;
|
||||
|
||||
export function SelectFile(arg1:string,arg2:string,arg3:string):Promise<string>;
|
||||
|
||||
export function StartSwaggerServer(arg1:string):Promise<string>;
|
||||
|
||||
export function StopSwaggerServer():Promise<void>;
|
||||
|
||||
export function UpdateDatabaseConfig(arg1:string,arg2:string,arg3:string,arg4:string):Promise<void>;
|
||||
|
||||
export function UpdateProjectConfig(arg1:string,arg2:string,arg3:string):Promise<void>;
|
||||
|
||||
export function UpdateServiceCommon(arg1:string,arg2:Array<string>):Promise<string>;
|
||||
87
Tools/quickly/frontend/wailsjs/go/backend/App.js
Normal file
87
Tools/quickly/frontend/wailsjs/go/backend/App.js
Normal file
@@ -0,0 +1,87 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
export function AddDatabaseConfig(arg1, arg2, arg3) {
|
||||
return window['go']['backend']['App']['AddDatabaseConfig'](arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
export function AddProjectConfig(arg1, arg2) {
|
||||
return window['go']['backend']['App']['AddProjectConfig'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function CheckGenPs1Exists(arg1) {
|
||||
return window['go']['backend']['App']['CheckGenPs1Exists'](arg1);
|
||||
}
|
||||
|
||||
export function ExecuteGenPs1(arg1, arg2, arg3, arg4) {
|
||||
return window['go']['backend']['App']['ExecuteGenPs1'](arg1, arg2, arg3, arg4);
|
||||
}
|
||||
|
||||
export function GetSettings() {
|
||||
return window['go']['backend']['App']['GetSettings']();
|
||||
}
|
||||
|
||||
export function GetSwaggerFiles(arg1) {
|
||||
return window['go']['backend']['App']['GetSwaggerFiles'](arg1);
|
||||
}
|
||||
|
||||
export function GetSwaggerServerURL() {
|
||||
return window['go']['backend']['App']['GetSwaggerServerURL']();
|
||||
}
|
||||
|
||||
export function Greet(arg1) {
|
||||
return window['go']['backend']['App']['Greet'](arg1);
|
||||
}
|
||||
|
||||
export function IsSwaggerServerRunning() {
|
||||
return window['go']['backend']['App']['IsSwaggerServerRunning']();
|
||||
}
|
||||
|
||||
export function ReadGoModModule(arg1) {
|
||||
return window['go']['backend']['App']['ReadGoModModule'](arg1);
|
||||
}
|
||||
|
||||
export function ReadSwaggerFile(arg1) {
|
||||
return window['go']['backend']['App']['ReadSwaggerFile'](arg1);
|
||||
}
|
||||
|
||||
export function RemoveDatabaseConfig(arg1) {
|
||||
return window['go']['backend']['App']['RemoveDatabaseConfig'](arg1);
|
||||
}
|
||||
|
||||
export function RemoveProjectConfig(arg1) {
|
||||
return window['go']['backend']['App']['RemoveProjectConfig'](arg1);
|
||||
}
|
||||
|
||||
export function SaveSettings(arg1) {
|
||||
return window['go']['backend']['App']['SaveSettings'](arg1);
|
||||
}
|
||||
|
||||
export function SelectDirectory(arg1, arg2) {
|
||||
return window['go']['backend']['App']['SelectDirectory'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function SelectFile(arg1, arg2, arg3) {
|
||||
return window['go']['backend']['App']['SelectFile'](arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
export function StartSwaggerServer(arg1) {
|
||||
return window['go']['backend']['App']['StartSwaggerServer'](arg1);
|
||||
}
|
||||
|
||||
export function StopSwaggerServer() {
|
||||
return window['go']['backend']['App']['StopSwaggerServer']();
|
||||
}
|
||||
|
||||
export function UpdateDatabaseConfig(arg1, arg2, arg3, arg4) {
|
||||
return window['go']['backend']['App']['UpdateDatabaseConfig'](arg1, arg2, arg3, arg4);
|
||||
}
|
||||
|
||||
export function UpdateProjectConfig(arg1, arg2, arg3) {
|
||||
return window['go']['backend']['App']['UpdateProjectConfig'](arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
export function UpdateServiceCommon(arg1, arg2) {
|
||||
return window['go']['backend']['App']['UpdateServiceCommon'](arg1, arg2);
|
||||
}
|
||||
101
Tools/quickly/frontend/wailsjs/go/models.ts
Normal file
101
Tools/quickly/frontend/wailsjs/go/models.ts
Normal file
@@ -0,0 +1,101 @@
|
||||
export namespace backend {
|
||||
|
||||
export class DatabaseConfig {
|
||||
name: string;
|
||||
targetPath: string;
|
||||
modelPackagePath: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new DatabaseConfig(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.name = source["name"];
|
||||
this.targetPath = source["targetPath"];
|
||||
this.modelPackagePath = source["modelPackagePath"];
|
||||
}
|
||||
}
|
||||
export class ProjectConfig {
|
||||
name: string;
|
||||
path: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new ProjectConfig(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.name = source["name"];
|
||||
this.path = source["path"];
|
||||
}
|
||||
}
|
||||
export class Settings {
|
||||
theme: string;
|
||||
language: string;
|
||||
notifications: boolean;
|
||||
autoStart: boolean;
|
||||
mysqlModelPath: string;
|
||||
defaultQueryPackagePath: string;
|
||||
modelBasePath: string;
|
||||
swaggerDir: string;
|
||||
databases: DatabaseConfig[];
|
||||
projects: ProjectConfig[];
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new Settings(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.theme = source["theme"];
|
||||
this.language = source["language"];
|
||||
this.notifications = source["notifications"];
|
||||
this.autoStart = source["autoStart"];
|
||||
this.mysqlModelPath = source["mysqlModelPath"];
|
||||
this.defaultQueryPackagePath = source["defaultQueryPackagePath"];
|
||||
this.modelBasePath = source["modelBasePath"];
|
||||
this.swaggerDir = source["swaggerDir"];
|
||||
this.databases = this.convertValues(source["databases"], DatabaseConfig);
|
||||
this.projects = this.convertValues(source["projects"], ProjectConfig);
|
||||
}
|
||||
|
||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||
if (!a) {
|
||||
return a;
|
||||
}
|
||||
if (a.slice && a.map) {
|
||||
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||
} else if ("object" === typeof a) {
|
||||
if (asMap) {
|
||||
for (const key of Object.keys(a)) {
|
||||
a[key] = new classs(a[key]);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return new classs(a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
export class SwaggerFile {
|
||||
name: string;
|
||||
path: string;
|
||||
size: number;
|
||||
modifiedTime: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new SwaggerFile(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.name = source["name"];
|
||||
this.path = source["path"];
|
||||
this.size = source["size"];
|
||||
this.modifiedTime = source["modifiedTime"];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
24
Tools/quickly/frontend/wailsjs/runtime/package.json
Normal file
24
Tools/quickly/frontend/wailsjs/runtime/package.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "@wailsapp/runtime",
|
||||
"version": "2.0.0",
|
||||
"description": "Wails Javascript runtime library",
|
||||
"main": "runtime.js",
|
||||
"types": "runtime.d.ts",
|
||||
"scripts": {
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/wailsapp/wails.git"
|
||||
},
|
||||
"keywords": [
|
||||
"Wails",
|
||||
"Javascript",
|
||||
"Go"
|
||||
],
|
||||
"author": "Lea Anthony <lea.anthony@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/wailsapp/wails/issues"
|
||||
},
|
||||
"homepage": "https://github.com/wailsapp/wails#readme"
|
||||
}
|
||||
249
Tools/quickly/frontend/wailsjs/runtime/runtime.d.ts
vendored
Normal file
249
Tools/quickly/frontend/wailsjs/runtime/runtime.d.ts
vendored
Normal file
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
_ __ _ __
|
||||
| | / /___ _(_) /____
|
||||
| | /| / / __ `/ / / ___/
|
||||
| |/ |/ / /_/ / / (__ )
|
||||
|__/|__/\__,_/_/_/____/
|
||||
The electron alternative for Go
|
||||
(c) Lea Anthony 2019-present
|
||||
*/
|
||||
|
||||
export interface Position {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
export interface Size {
|
||||
w: number;
|
||||
h: number;
|
||||
}
|
||||
|
||||
export interface Screen {
|
||||
isCurrent: boolean;
|
||||
isPrimary: boolean;
|
||||
width : number
|
||||
height : number
|
||||
}
|
||||
|
||||
// Environment information such as platform, buildtype, ...
|
||||
export interface EnvironmentInfo {
|
||||
buildType: string;
|
||||
platform: string;
|
||||
arch: string;
|
||||
}
|
||||
|
||||
// [EventsEmit](https://wails.io/docs/reference/runtime/events#eventsemit)
|
||||
// emits the given event. Optional data may be passed with the event.
|
||||
// This will trigger any event listeners.
|
||||
export function EventsEmit(eventName: string, ...data: any): void;
|
||||
|
||||
// [EventsOn](https://wails.io/docs/reference/runtime/events#eventson) sets up a listener for the given event name.
|
||||
export function EventsOn(eventName: string, callback: (...data: any) => void): () => void;
|
||||
|
||||
// [EventsOnMultiple](https://wails.io/docs/reference/runtime/events#eventsonmultiple)
|
||||
// sets up a listener for the given event name, but will only trigger a given number times.
|
||||
export function EventsOnMultiple(eventName: string, callback: (...data: any) => void, maxCallbacks: number): () => void;
|
||||
|
||||
// [EventsOnce](https://wails.io/docs/reference/runtime/events#eventsonce)
|
||||
// sets up a listener for the given event name, but will only trigger once.
|
||||
export function EventsOnce(eventName: string, callback: (...data: any) => void): () => void;
|
||||
|
||||
// [EventsOff](https://wails.io/docs/reference/runtime/events#eventsoff)
|
||||
// unregisters the listener for the given event name.
|
||||
export function EventsOff(eventName: string, ...additionalEventNames: string[]): void;
|
||||
|
||||
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
|
||||
// unregisters all listeners.
|
||||
export function EventsOffAll(): void;
|
||||
|
||||
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
|
||||
// logs the given message as a raw message
|
||||
export function LogPrint(message: string): void;
|
||||
|
||||
// [LogTrace](https://wails.io/docs/reference/runtime/log#logtrace)
|
||||
// logs the given message at the `trace` log level.
|
||||
export function LogTrace(message: string): void;
|
||||
|
||||
// [LogDebug](https://wails.io/docs/reference/runtime/log#logdebug)
|
||||
// logs the given message at the `debug` log level.
|
||||
export function LogDebug(message: string): void;
|
||||
|
||||
// [LogError](https://wails.io/docs/reference/runtime/log#logerror)
|
||||
// logs the given message at the `error` log level.
|
||||
export function LogError(message: string): void;
|
||||
|
||||
// [LogFatal](https://wails.io/docs/reference/runtime/log#logfatal)
|
||||
// logs the given message at the `fatal` log level.
|
||||
// The application will quit after calling this method.
|
||||
export function LogFatal(message: string): void;
|
||||
|
||||
// [LogInfo](https://wails.io/docs/reference/runtime/log#loginfo)
|
||||
// logs the given message at the `info` log level.
|
||||
export function LogInfo(message: string): void;
|
||||
|
||||
// [LogWarning](https://wails.io/docs/reference/runtime/log#logwarning)
|
||||
// logs the given message at the `warning` log level.
|
||||
export function LogWarning(message: string): void;
|
||||
|
||||
// [WindowReload](https://wails.io/docs/reference/runtime/window#windowreload)
|
||||
// Forces a reload by the main application as well as connected browsers.
|
||||
export function WindowReload(): void;
|
||||
|
||||
// [WindowReloadApp](https://wails.io/docs/reference/runtime/window#windowreloadapp)
|
||||
// Reloads the application frontend.
|
||||
export function WindowReloadApp(): void;
|
||||
|
||||
// [WindowSetAlwaysOnTop](https://wails.io/docs/reference/runtime/window#windowsetalwaysontop)
|
||||
// Sets the window AlwaysOnTop or not on top.
|
||||
export function WindowSetAlwaysOnTop(b: boolean): void;
|
||||
|
||||
// [WindowSetSystemDefaultTheme](https://wails.io/docs/next/reference/runtime/window#windowsetsystemdefaulttheme)
|
||||
// *Windows only*
|
||||
// Sets window theme to system default (dark/light).
|
||||
export function WindowSetSystemDefaultTheme(): void;
|
||||
|
||||
// [WindowSetLightTheme](https://wails.io/docs/next/reference/runtime/window#windowsetlighttheme)
|
||||
// *Windows only*
|
||||
// Sets window to light theme.
|
||||
export function WindowSetLightTheme(): void;
|
||||
|
||||
// [WindowSetDarkTheme](https://wails.io/docs/next/reference/runtime/window#windowsetdarktheme)
|
||||
// *Windows only*
|
||||
// Sets window to dark theme.
|
||||
export function WindowSetDarkTheme(): void;
|
||||
|
||||
// [WindowCenter](https://wails.io/docs/reference/runtime/window#windowcenter)
|
||||
// Centers the window on the monitor the window is currently on.
|
||||
export function WindowCenter(): void;
|
||||
|
||||
// [WindowSetTitle](https://wails.io/docs/reference/runtime/window#windowsettitle)
|
||||
// Sets the text in the window title bar.
|
||||
export function WindowSetTitle(title: string): void;
|
||||
|
||||
// [WindowFullscreen](https://wails.io/docs/reference/runtime/window#windowfullscreen)
|
||||
// Makes the window full screen.
|
||||
export function WindowFullscreen(): void;
|
||||
|
||||
// [WindowUnfullscreen](https://wails.io/docs/reference/runtime/window#windowunfullscreen)
|
||||
// Restores the previous window dimensions and position prior to full screen.
|
||||
export function WindowUnfullscreen(): void;
|
||||
|
||||
// [WindowIsFullscreen](https://wails.io/docs/reference/runtime/window#windowisfullscreen)
|
||||
// Returns the state of the window, i.e. whether the window is in full screen mode or not.
|
||||
export function WindowIsFullscreen(): Promise<boolean>;
|
||||
|
||||
// [WindowSetSize](https://wails.io/docs/reference/runtime/window#windowsetsize)
|
||||
// Sets the width and height of the window.
|
||||
export function WindowSetSize(width: number, height: number): void;
|
||||
|
||||
// [WindowGetSize](https://wails.io/docs/reference/runtime/window#windowgetsize)
|
||||
// Gets the width and height of the window.
|
||||
export function WindowGetSize(): Promise<Size>;
|
||||
|
||||
// [WindowSetMaxSize](https://wails.io/docs/reference/runtime/window#windowsetmaxsize)
|
||||
// Sets the maximum window size. Will resize the window if the window is currently larger than the given dimensions.
|
||||
// Setting a size of 0,0 will disable this constraint.
|
||||
export function WindowSetMaxSize(width: number, height: number): void;
|
||||
|
||||
// [WindowSetMinSize](https://wails.io/docs/reference/runtime/window#windowsetminsize)
|
||||
// Sets the minimum window size. Will resize the window if the window is currently smaller than the given dimensions.
|
||||
// Setting a size of 0,0 will disable this constraint.
|
||||
export function WindowSetMinSize(width: number, height: number): void;
|
||||
|
||||
// [WindowSetPosition](https://wails.io/docs/reference/runtime/window#windowsetposition)
|
||||
// Sets the window position relative to the monitor the window is currently on.
|
||||
export function WindowSetPosition(x: number, y: number): void;
|
||||
|
||||
// [WindowGetPosition](https://wails.io/docs/reference/runtime/window#windowgetposition)
|
||||
// Gets the window position relative to the monitor the window is currently on.
|
||||
export function WindowGetPosition(): Promise<Position>;
|
||||
|
||||
// [WindowHide](https://wails.io/docs/reference/runtime/window#windowhide)
|
||||
// Hides the window.
|
||||
export function WindowHide(): void;
|
||||
|
||||
// [WindowShow](https://wails.io/docs/reference/runtime/window#windowshow)
|
||||
// Shows the window, if it is currently hidden.
|
||||
export function WindowShow(): void;
|
||||
|
||||
// [WindowMaximise](https://wails.io/docs/reference/runtime/window#windowmaximise)
|
||||
// Maximises the window to fill the screen.
|
||||
export function WindowMaximise(): void;
|
||||
|
||||
// [WindowToggleMaximise](https://wails.io/docs/reference/runtime/window#windowtogglemaximise)
|
||||
// Toggles between Maximised and UnMaximised.
|
||||
export function WindowToggleMaximise(): void;
|
||||
|
||||
// [WindowUnmaximise](https://wails.io/docs/reference/runtime/window#windowunmaximise)
|
||||
// Restores the window to the dimensions and position prior to maximising.
|
||||
export function WindowUnmaximise(): void;
|
||||
|
||||
// [WindowIsMaximised](https://wails.io/docs/reference/runtime/window#windowismaximised)
|
||||
// Returns the state of the window, i.e. whether the window is maximised or not.
|
||||
export function WindowIsMaximised(): Promise<boolean>;
|
||||
|
||||
// [WindowMinimise](https://wails.io/docs/reference/runtime/window#windowminimise)
|
||||
// Minimises the window.
|
||||
export function WindowMinimise(): void;
|
||||
|
||||
// [WindowUnminimise](https://wails.io/docs/reference/runtime/window#windowunminimise)
|
||||
// Restores the window to the dimensions and position prior to minimising.
|
||||
export function WindowUnminimise(): void;
|
||||
|
||||
// [WindowIsMinimised](https://wails.io/docs/reference/runtime/window#windowisminimised)
|
||||
// Returns the state of the window, i.e. whether the window is minimised or not.
|
||||
export function WindowIsMinimised(): Promise<boolean>;
|
||||
|
||||
// [WindowIsNormal](https://wails.io/docs/reference/runtime/window#windowisnormal)
|
||||
// Returns the state of the window, i.e. whether the window is normal or not.
|
||||
export function WindowIsNormal(): Promise<boolean>;
|
||||
|
||||
// [WindowSetBackgroundColour](https://wails.io/docs/reference/runtime/window#windowsetbackgroundcolour)
|
||||
// Sets the background colour of the window to the given RGBA colour definition. This colour will show through for all transparent pixels.
|
||||
export function WindowSetBackgroundColour(R: number, G: number, B: number, A: number): void;
|
||||
|
||||
// [ScreenGetAll](https://wails.io/docs/reference/runtime/window#screengetall)
|
||||
// Gets the all screens. Call this anew each time you want to refresh data from the underlying windowing system.
|
||||
export function ScreenGetAll(): Promise<Screen[]>;
|
||||
|
||||
// [BrowserOpenURL](https://wails.io/docs/reference/runtime/browser#browseropenurl)
|
||||
// Opens the given URL in the system browser.
|
||||
export function BrowserOpenURL(url: string): void;
|
||||
|
||||
// [Environment](https://wails.io/docs/reference/runtime/intro#environment)
|
||||
// Returns information about the environment
|
||||
export function Environment(): Promise<EnvironmentInfo>;
|
||||
|
||||
// [Quit](https://wails.io/docs/reference/runtime/intro#quit)
|
||||
// Quits the application.
|
||||
export function Quit(): void;
|
||||
|
||||
// [Hide](https://wails.io/docs/reference/runtime/intro#hide)
|
||||
// Hides the application.
|
||||
export function Hide(): void;
|
||||
|
||||
// [Show](https://wails.io/docs/reference/runtime/intro#show)
|
||||
// Shows the application.
|
||||
export function Show(): void;
|
||||
|
||||
// [ClipboardGetText](https://wails.io/docs/reference/runtime/clipboard#clipboardgettext)
|
||||
// Returns the current text stored on clipboard
|
||||
export function ClipboardGetText(): Promise<string>;
|
||||
|
||||
// [ClipboardSetText](https://wails.io/docs/reference/runtime/clipboard#clipboardsettext)
|
||||
// Sets a text on the clipboard
|
||||
export function ClipboardSetText(text: string): Promise<boolean>;
|
||||
|
||||
// [OnFileDrop](https://wails.io/docs/reference/runtime/draganddrop#onfiledrop)
|
||||
// OnFileDrop listens to drag and drop events and calls the callback with the coordinates of the drop and an array of path strings.
|
||||
export function OnFileDrop(callback: (x: number, y: number ,paths: string[]) => void, useDropTarget: boolean) :void
|
||||
|
||||
// [OnFileDropOff](https://wails.io/docs/reference/runtime/draganddrop#dragandddropoff)
|
||||
// OnFileDropOff removes the drag and drop listeners and handlers.
|
||||
export function OnFileDropOff() :void
|
||||
|
||||
// Check if the file path resolver is available
|
||||
export function CanResolveFilePaths(): boolean;
|
||||
|
||||
// Resolves file paths for an array of files
|
||||
export function ResolveFilePaths(files: File[]): void
|
||||
242
Tools/quickly/frontend/wailsjs/runtime/runtime.js
Normal file
242
Tools/quickly/frontend/wailsjs/runtime/runtime.js
Normal file
@@ -0,0 +1,242 @@
|
||||
/*
|
||||
_ __ _ __
|
||||
| | / /___ _(_) /____
|
||||
| | /| / / __ `/ / / ___/
|
||||
| |/ |/ / /_/ / / (__ )
|
||||
|__/|__/\__,_/_/_/____/
|
||||
The electron alternative for Go
|
||||
(c) Lea Anthony 2019-present
|
||||
*/
|
||||
|
||||
export function LogPrint(message) {
|
||||
window.runtime.LogPrint(message);
|
||||
}
|
||||
|
||||
export function LogTrace(message) {
|
||||
window.runtime.LogTrace(message);
|
||||
}
|
||||
|
||||
export function LogDebug(message) {
|
||||
window.runtime.LogDebug(message);
|
||||
}
|
||||
|
||||
export function LogInfo(message) {
|
||||
window.runtime.LogInfo(message);
|
||||
}
|
||||
|
||||
export function LogWarning(message) {
|
||||
window.runtime.LogWarning(message);
|
||||
}
|
||||
|
||||
export function LogError(message) {
|
||||
window.runtime.LogError(message);
|
||||
}
|
||||
|
||||
export function LogFatal(message) {
|
||||
window.runtime.LogFatal(message);
|
||||
}
|
||||
|
||||
export function EventsOnMultiple(eventName, callback, maxCallbacks) {
|
||||
return window.runtime.EventsOnMultiple(eventName, callback, maxCallbacks);
|
||||
}
|
||||
|
||||
export function EventsOn(eventName, callback) {
|
||||
return EventsOnMultiple(eventName, callback, -1);
|
||||
}
|
||||
|
||||
export function EventsOff(eventName, ...additionalEventNames) {
|
||||
return window.runtime.EventsOff(eventName, ...additionalEventNames);
|
||||
}
|
||||
|
||||
export function EventsOffAll() {
|
||||
return window.runtime.EventsOffAll();
|
||||
}
|
||||
|
||||
export function EventsOnce(eventName, callback) {
|
||||
return EventsOnMultiple(eventName, callback, 1);
|
||||
}
|
||||
|
||||
export function EventsEmit(eventName) {
|
||||
let args = [eventName].slice.call(arguments);
|
||||
return window.runtime.EventsEmit.apply(null, args);
|
||||
}
|
||||
|
||||
export function WindowReload() {
|
||||
window.runtime.WindowReload();
|
||||
}
|
||||
|
||||
export function WindowReloadApp() {
|
||||
window.runtime.WindowReloadApp();
|
||||
}
|
||||
|
||||
export function WindowSetAlwaysOnTop(b) {
|
||||
window.runtime.WindowSetAlwaysOnTop(b);
|
||||
}
|
||||
|
||||
export function WindowSetSystemDefaultTheme() {
|
||||
window.runtime.WindowSetSystemDefaultTheme();
|
||||
}
|
||||
|
||||
export function WindowSetLightTheme() {
|
||||
window.runtime.WindowSetLightTheme();
|
||||
}
|
||||
|
||||
export function WindowSetDarkTheme() {
|
||||
window.runtime.WindowSetDarkTheme();
|
||||
}
|
||||
|
||||
export function WindowCenter() {
|
||||
window.runtime.WindowCenter();
|
||||
}
|
||||
|
||||
export function WindowSetTitle(title) {
|
||||
window.runtime.WindowSetTitle(title);
|
||||
}
|
||||
|
||||
export function WindowFullscreen() {
|
||||
window.runtime.WindowFullscreen();
|
||||
}
|
||||
|
||||
export function WindowUnfullscreen() {
|
||||
window.runtime.WindowUnfullscreen();
|
||||
}
|
||||
|
||||
export function WindowIsFullscreen() {
|
||||
return window.runtime.WindowIsFullscreen();
|
||||
}
|
||||
|
||||
export function WindowGetSize() {
|
||||
return window.runtime.WindowGetSize();
|
||||
}
|
||||
|
||||
export function WindowSetSize(width, height) {
|
||||
window.runtime.WindowSetSize(width, height);
|
||||
}
|
||||
|
||||
export function WindowSetMaxSize(width, height) {
|
||||
window.runtime.WindowSetMaxSize(width, height);
|
||||
}
|
||||
|
||||
export function WindowSetMinSize(width, height) {
|
||||
window.runtime.WindowSetMinSize(width, height);
|
||||
}
|
||||
|
||||
export function WindowSetPosition(x, y) {
|
||||
window.runtime.WindowSetPosition(x, y);
|
||||
}
|
||||
|
||||
export function WindowGetPosition() {
|
||||
return window.runtime.WindowGetPosition();
|
||||
}
|
||||
|
||||
export function WindowHide() {
|
||||
window.runtime.WindowHide();
|
||||
}
|
||||
|
||||
export function WindowShow() {
|
||||
window.runtime.WindowShow();
|
||||
}
|
||||
|
||||
export function WindowMaximise() {
|
||||
window.runtime.WindowMaximise();
|
||||
}
|
||||
|
||||
export function WindowToggleMaximise() {
|
||||
window.runtime.WindowToggleMaximise();
|
||||
}
|
||||
|
||||
export function WindowUnmaximise() {
|
||||
window.runtime.WindowUnmaximise();
|
||||
}
|
||||
|
||||
export function WindowIsMaximised() {
|
||||
return window.runtime.WindowIsMaximised();
|
||||
}
|
||||
|
||||
export function WindowMinimise() {
|
||||
window.runtime.WindowMinimise();
|
||||
}
|
||||
|
||||
export function WindowUnminimise() {
|
||||
window.runtime.WindowUnminimise();
|
||||
}
|
||||
|
||||
export function WindowSetBackgroundColour(R, G, B, A) {
|
||||
window.runtime.WindowSetBackgroundColour(R, G, B, A);
|
||||
}
|
||||
|
||||
export function ScreenGetAll() {
|
||||
return window.runtime.ScreenGetAll();
|
||||
}
|
||||
|
||||
export function WindowIsMinimised() {
|
||||
return window.runtime.WindowIsMinimised();
|
||||
}
|
||||
|
||||
export function WindowIsNormal() {
|
||||
return window.runtime.WindowIsNormal();
|
||||
}
|
||||
|
||||
export function BrowserOpenURL(url) {
|
||||
window.runtime.BrowserOpenURL(url);
|
||||
}
|
||||
|
||||
export function Environment() {
|
||||
return window.runtime.Environment();
|
||||
}
|
||||
|
||||
export function Quit() {
|
||||
window.runtime.Quit();
|
||||
}
|
||||
|
||||
export function Hide() {
|
||||
window.runtime.Hide();
|
||||
}
|
||||
|
||||
export function Show() {
|
||||
window.runtime.Show();
|
||||
}
|
||||
|
||||
export function ClipboardGetText() {
|
||||
return window.runtime.ClipboardGetText();
|
||||
}
|
||||
|
||||
export function ClipboardSetText(text) {
|
||||
return window.runtime.ClipboardSetText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
|
||||
*
|
||||
* @export
|
||||
* @callback OnFileDropCallback
|
||||
* @param {number} x - x coordinate of the drop
|
||||
* @param {number} y - y coordinate of the drop
|
||||
* @param {string[]} paths - A list of file paths.
|
||||
*/
|
||||
|
||||
/**
|
||||
* OnFileDrop listens to drag and drop events and calls the callback with the coordinates of the drop and an array of path strings.
|
||||
*
|
||||
* @export
|
||||
* @param {OnFileDropCallback} callback - Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
|
||||
* @param {boolean} [useDropTarget=true] - Only call the callback when the drop finished on an element that has the drop target style. (--wails-drop-target)
|
||||
*/
|
||||
export function OnFileDrop(callback, useDropTarget) {
|
||||
return window.runtime.OnFileDrop(callback, useDropTarget);
|
||||
}
|
||||
|
||||
/**
|
||||
* OnFileDropOff removes the drag and drop listeners and handlers.
|
||||
*/
|
||||
export function OnFileDropOff() {
|
||||
return window.runtime.OnFileDropOff();
|
||||
}
|
||||
|
||||
export function CanResolveFilePaths() {
|
||||
return window.runtime.CanResolveFilePaths();
|
||||
}
|
||||
|
||||
export function ResolveFilePaths(files) {
|
||||
return window.runtime.ResolveFilePaths(files);
|
||||
}
|
||||
37
Tools/quickly/go.mod
Normal file
37
Tools/quickly/go.mod
Normal file
@@ -0,0 +1,37 @@
|
||||
module quickly
|
||||
|
||||
go 1.23.1
|
||||
|
||||
require github.com/wailsapp/wails/v2 v2.11.0
|
||||
|
||||
require (
|
||||
github.com/bep/debounce v1.2.1 // indirect
|
||||
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.3 // indirect
|
||||
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
|
||||
github.com/labstack/echo/v4 v4.13.3 // indirect
|
||||
github.com/labstack/gommon v0.4.2 // indirect
|
||||
github.com/leaanthony/go-ansi-parser v1.6.1 // indirect
|
||||
github.com/leaanthony/gosod v1.0.4 // indirect
|
||||
github.com/leaanthony/slicer v1.6.0 // indirect
|
||||
github.com/leaanthony/u v1.1.1 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/samber/lo v1.49.1 // indirect
|
||||
github.com/tkrajina/go-reflector v0.5.8 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/valyala/fasttemplate v1.2.2 // indirect
|
||||
github.com/wailsapp/go-webview2 v1.0.22 // indirect
|
||||
github.com/wailsapp/mimetype v1.4.1 // indirect
|
||||
golang.org/x/crypto v0.33.0 // indirect
|
||||
golang.org/x/net v0.35.0 // indirect
|
||||
golang.org/x/sys v0.30.0 // indirect
|
||||
golang.org/x/text v0.22.0 // indirect
|
||||
)
|
||||
|
||||
// replace github.com/wailsapp/wails/v2 v2.11.0 => C:\Users\Administrator\go\pkg\mod
|
||||
81
Tools/quickly/go.sum
Normal file
81
Tools/quickly/go.sum
Normal file
@@ -0,0 +1,81 @@
|
||||
github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY=
|
||||
github.com/bep/debounce v1.2.1/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
|
||||
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
|
||||
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
|
||||
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck=
|
||||
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
|
||||
github.com/labstack/echo/v4 v4.13.3 h1:pwhpCPrTl5qry5HRdM5FwdXnhXSLSY+WE+YQSeCaafY=
|
||||
github.com/labstack/echo/v4 v4.13.3/go.mod h1:o90YNEeQWjDozo584l7AwhJMHN0bOC4tAfg+Xox9q5g=
|
||||
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
|
||||
github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
|
||||
github.com/leaanthony/debme v1.2.1 h1:9Tgwf+kjcrbMQ4WnPcEIUcQuIZYqdWftzZkBr+i/oOc=
|
||||
github.com/leaanthony/debme v1.2.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
|
||||
github.com/leaanthony/go-ansi-parser v1.6.1 h1:xd8bzARK3dErqkPFtoF9F3/HgN8UQk0ed1YDKpEz01A=
|
||||
github.com/leaanthony/go-ansi-parser v1.6.1/go.mod h1:+vva/2y4alzVmmIEpk9QDhA7vLC5zKDTRwfZGOp3IWU=
|
||||
github.com/leaanthony/gosod v1.0.4 h1:YLAbVyd591MRffDgxUOU1NwLhT9T1/YiwjKZpkNFeaI=
|
||||
github.com/leaanthony/gosod v1.0.4/go.mod h1:GKuIL0zzPj3O1SdWQOdgURSuhkF+Urizzxh26t9f1cw=
|
||||
github.com/leaanthony/slicer v1.6.0 h1:1RFP5uiPJvT93TAHi+ipd3NACobkW53yUiBqZheE/Js=
|
||||
github.com/leaanthony/slicer v1.6.0/go.mod h1:o/Iz29g7LN0GqH3aMjWAe90381nyZlDNquK+mtH2Fj8=
|
||||
github.com/leaanthony/u v1.1.1 h1:TUFjwDGlNX+WuwVEzDqQwC2lOv0P4uhTQw7CMFdiK7M=
|
||||
github.com/leaanthony/u v1.1.1/go.mod h1:9+o6hejoRljvZ3BzdYlVL0JYCwtnAsVuN9pVTQcaRfI=
|
||||
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
|
||||
github.com/matryer/is v1.4.1 h1:55ehd8zaGABKLXQUe2awZ99BD/PTc2ls+KV/dXphgEQ=
|
||||
github.com/matryer/is v1.4.1/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
github.com/samber/lo v1.49.1 h1:4BIFyVfuQSEpluc7Fua+j1NolZHiEHEpaSEKdsH0tew=
|
||||
github.com/samber/lo v1.49.1/go.mod h1:dO6KHFzUKXgP8LDhU0oI8d2hekjXnGOu0DB8Jecxd6o=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/tkrajina/go-reflector v0.5.8 h1:yPADHrwmUbMq4RGEyaOUpz2H90sRsETNVpjzo3DLVQQ=
|
||||
github.com/tkrajina/go-reflector v0.5.8/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4=
|
||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
|
||||
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
||||
github.com/wailsapp/go-webview2 v1.0.22 h1:YT61F5lj+GGaat5OB96Aa3b4QA+mybD0Ggq6NZijQ58=
|
||||
github.com/wailsapp/go-webview2 v1.0.22/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc=
|
||||
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
|
||||
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
|
||||
github.com/wailsapp/wails/v2 v2.11.0 h1:seLacV8pqupq32IjS4Y7V8ucab0WZwtK6VvUVxSBtqQ=
|
||||
github.com/wailsapp/wails/v2 v2.11.0/go.mod h1:jrf0ZaM6+GBc1wRmXsM8cIvzlg0karYin3erahI4+0k=
|
||||
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
|
||||
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
|
||||
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
|
||||
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
|
||||
golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
|
||||
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
|
||||
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
33
Tools/quickly/main.go
Normal file
33
Tools/quickly/main.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"github.com/wailsapp/wails/v2"
|
||||
"github.com/wailsapp/wails/v2/pkg/options"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
||||
"quickly/backend"
|
||||
)
|
||||
|
||||
//go:embed all:frontend/dist
|
||||
var assets embed.FS
|
||||
|
||||
func main() {
|
||||
app := backend.NewApp()
|
||||
err := wails.Run(&options.App{
|
||||
Title: "Quickly 金牌助手",
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
AssetServer: &assetserver.Options{
|
||||
Assets: assets,
|
||||
},
|
||||
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
|
||||
OnStartup: app.Startup,
|
||||
Bind: []interface{}{
|
||||
app,
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
println("Error:", err.Error())
|
||||
}
|
||||
}
|
||||
13
Tools/quickly/wails.json
Normal file
13
Tools/quickly/wails.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"$schema": "https://wails.io/schemas/config.v2.json",
|
||||
"name": "quickly",
|
||||
"outputfilename": "quickly",
|
||||
"frontend:install": "npm install",
|
||||
"frontend:build": "npm run build",
|
||||
"frontend:dev:watcher": "npm run dev",
|
||||
"frontend:dev:serverUrl": "auto",
|
||||
"author": {
|
||||
"name": "DESKTOP-V763RJ7\\Administrator",
|
||||
"email": "835606593@qq.com"
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user