diff --git a/Proto/ServerClient/gen_proto.bat b/Proto/ServerClient/gen_proto.bat index d845d91..f617dec 100644 --- a/Proto/ServerClient/gen_proto.bat +++ b/Proto/ServerClient/gen_proto.bat @@ -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 \ No newline at end of file +protoc --proto_path=./sources --csharp_out=./gen/client ./sources/*.proto \ No newline at end of file diff --git a/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_user.pb.go b/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_user.pb.go index 59b64a9..4e96118 100644 --- a/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_user.pb.go +++ b/Proto/ServerInternal/gen/git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb/service_user.pb.go @@ -242,8 +242,8 @@ type GenerateQuestionReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Num int32 `protobuf:"varint,1,opt,name=Num,json=num,proto3" json:"Num,omitempty"` // 生成数量 - Category string `protobuf:"bytes,2,opt,name=Category,proto3" json:"Category,omitempty"` // 题目类型 + 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() { @@ -566,7 +566,7 @@ var file_service_user_proto_rawDesc = []byte{ 0x65, 0x72, 0x61, 0x74, 0x65, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x22, 0x16, + 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, diff --git a/Proto/ServerInternal/gen/service_user.swagger.json b/Proto/ServerInternal/gen/service_user.swagger.json index 5b24487..a155022 100644 --- a/Proto/ServerInternal/gen/service_user.swagger.json +++ b/Proto/ServerInternal/gen/service_user.swagger.json @@ -181,7 +181,7 @@ "format": "int32", "title": "生成数量" }, - "Category": { + "category": { "type": "string", "title": "题目类型" } diff --git a/Proto/ServerInternal/gen_proto.bat b/Proto/ServerInternal/gen_proto.bat index 9d38dfc..80d28a8 100644 --- a/Proto/ServerInternal/gen_proto.bat +++ b/Proto/ServerInternal/gen_proto.bat @@ -10,5 +10,4 @@ protoc ^ --go-grpc_out=./gen ^ --grpc-gateway_out=./gen ^ --openapiv2_out=./gen ^ -./sources/*.proto -@REM xcopy "./gen/common" "../../../Server/common" /E /I /Y /Q \ No newline at end of file +./sources/*.proto \ No newline at end of file diff --git a/Proto/ServerInternal/sources/service_user.proto b/Proto/ServerInternal/sources/service_user.proto index 16ceee7..0ff220d 100644 --- a/Proto/ServerInternal/sources/service_user.proto +++ b/Proto/ServerInternal/sources/service_user.proto @@ -54,7 +54,7 @@ message GetUserInfoResp { // ---------- GenerateQuestion ---------- message GenerateQuestionReq { int32 Num = 1 [json_name = "num"]; // 生成数量 - string Category = 2 [json_name = "Category"]; // 题目类型 + string Category = 2 [json_name = "category"]; // 题目类型 } message GenerateQuestionResp { } diff --git a/Tools/mysql_model/gen.ps1 b/Tools/mysql_model/gen.ps1 index bd2ccaf..9fd371f 100644 --- a/Tools/mysql_model/gen.ps1 +++ b/Tools/mysql_model/gen.ps1 @@ -1,10 +1,14 @@ -# 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+string\b' -and $c -notmatch 'BeforeCreate') { $c -match 'type\s+(\w+)\s+struct' | Out-Null diff --git a/Tools/mysql_model/go.mod b/Tools/mysql_model/go.mod new file mode 100644 index 0000000..77cbcd3 --- /dev/null +++ b/Tools/mysql_model/go.mod @@ -0,0 +1,3 @@ +module git.hlsq.asia/mmorpg + +go 1.23.1 diff --git a/Tools/mysql_model/user_db/query/questions.gen.go b/Tools/mysql_model/user_db/query/questions.gen.go index 9959d5b..e21f87f 100644 --- a/Tools/mysql_model/user_db/query/questions.gen.go +++ b/Tools/mysql_model/user_db/query/questions.gen.go @@ -15,6 +15,8 @@ import ( "gorm.io/gen/field" "gorm.io/plugin/dbresolver" + + "git.hlsq.asia/mmorpg/user_db/model" ) func newQuestion(db *gorm.DB, opts ...gen.DOOption) question { diff --git a/Tools/mysql_model/user_db/query/users.gen.go b/Tools/mysql_model/user_db/query/users.gen.go index e821078..370850c 100644 --- a/Tools/mysql_model/user_db/query/users.gen.go +++ b/Tools/mysql_model/user_db/query/users.gen.go @@ -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 {