Merge branch 'master' of https://git.hlsq.asia/mmorpg/public
This commit is contained in:
@@ -25,6 +25,33 @@
|
||||
"application/json"
|
||||
],
|
||||
"paths": {
|
||||
"/qgdzs/auth/custom_answer": {
|
||||
"post": {
|
||||
"summary": "自定义问答",
|
||||
"operationId": "Qgdzs_CustomAnswerQuestion",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/CustomAnswerQuestionResp"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/CustomAnswerQuestionReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Qgdzs"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/qgdzs/auth/generate_question": {
|
||||
"post": {
|
||||
"summary": "生成题目",
|
||||
@@ -454,6 +481,25 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"CustomAnswerQuestionReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"question": {
|
||||
"type": "string",
|
||||
"title": "问题"
|
||||
}
|
||||
},
|
||||
"title": "---------- CustomAnswerQuestion ----------"
|
||||
},
|
||||
"CustomAnswerQuestionResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"answer": {
|
||||
"type": "string",
|
||||
"title": "答案"
|
||||
}
|
||||
}
|
||||
},
|
||||
"EnterResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -59,6 +59,30 @@ func local_request_Qgdzs_GenerateQuestion_0(ctx context.Context, marshaler runti
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_Qgdzs_CustomAnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq CustomAnswerQuestionReq
|
||||
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.CustomAnswerQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_Qgdzs_CustomAnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq CustomAnswerQuestionReq
|
||||
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.CustomAnswerQuestion(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_Qgdzs_RandomGetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq RandomGetQuestionReq
|
||||
@@ -349,6 +373,26 @@ func RegisterQgdzsHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
}
|
||||
forward_Qgdzs_GenerateQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_CustomAnswerQuestion_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, "/.Qgdzs/CustomAnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/auth/custom_answer"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Qgdzs_CustomAnswerQuestion_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_Qgdzs_CustomAnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_RandomGetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -626,6 +670,23 @@ func RegisterQgdzsHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
||||
}
|
||||
forward_Qgdzs_GenerateQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_CustomAnswerQuestion_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, "/.Qgdzs/CustomAnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/auth/custom_answer"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Qgdzs_CustomAnswerQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_CustomAnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_RandomGetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -818,6 +879,7 @@ func RegisterQgdzsHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
||||
|
||||
var (
|
||||
pattern_Qgdzs_GenerateQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qgdzs", "auth", "generate_question"}, ""))
|
||||
pattern_Qgdzs_CustomAnswerQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qgdzs", "auth", "custom_answer"}, ""))
|
||||
pattern_Qgdzs_RandomGetQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "random", "question"}, ""))
|
||||
pattern_Qgdzs_RandomAnswerQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "random", "answer"}, ""))
|
||||
pattern_Qgdzs_GetAllCategory_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "category", "get_category"}, ""))
|
||||
@@ -833,6 +895,7 @@ var (
|
||||
|
||||
var (
|
||||
forward_Qgdzs_GenerateQuestion_0 = runtime.ForwardResponseMessage
|
||||
forward_Qgdzs_CustomAnswerQuestion_0 = runtime.ForwardResponseMessage
|
||||
forward_Qgdzs_RandomGetQuestion_0 = runtime.ForwardResponseMessage
|
||||
forward_Qgdzs_RandomAnswerQuestion_0 = runtime.ForwardResponseMessage
|
||||
forward_Qgdzs_GetAllCategory_0 = runtime.ForwardResponseMessage
|
||||
|
||||
@@ -24,6 +24,8 @@ const _ = grpc.SupportPackageIsVersion7
|
||||
type QgdzsClient interface {
|
||||
// 生成题目
|
||||
GenerateQuestion(ctx context.Context, in *GenerateQuestionReq, opts ...grpc.CallOption) (*GenerateQuestionResp, error)
|
||||
// 自定义问答
|
||||
CustomAnswerQuestion(ctx context.Context, in *CustomAnswerQuestionReq, opts ...grpc.CallOption) (*CustomAnswerQuestionResp, error)
|
||||
// ---------- 随机答题 ----------
|
||||
// 获取题目
|
||||
RandomGetQuestion(ctx context.Context, in *RandomGetQuestionReq, opts ...grpc.CallOption) (*RandomGetQuestionResp, error)
|
||||
@@ -70,6 +72,15 @@ func (c *qgdzsClient) GenerateQuestion(ctx context.Context, in *GenerateQuestion
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *qgdzsClient) CustomAnswerQuestion(ctx context.Context, in *CustomAnswerQuestionReq, opts ...grpc.CallOption) (*CustomAnswerQuestionResp, error) {
|
||||
out := new(CustomAnswerQuestionResp)
|
||||
err := c.cc.Invoke(ctx, "/Qgdzs/CustomAnswerQuestion", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *qgdzsClient) RandomGetQuestion(ctx context.Context, in *RandomGetQuestionReq, opts ...grpc.CallOption) (*RandomGetQuestionResp, error) {
|
||||
out := new(RandomGetQuestionResp)
|
||||
err := c.cc.Invoke(ctx, "/Qgdzs/RandomGetQuestion", in, out, opts...)
|
||||
@@ -175,6 +186,8 @@ func (c *qgdzsClient) GetPoint(ctx context.Context, in *GetPointReq, opts ...grp
|
||||
type QgdzsServer interface {
|
||||
// 生成题目
|
||||
GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error)
|
||||
// 自定义问答
|
||||
CustomAnswerQuestion(context.Context, *CustomAnswerQuestionReq) (*CustomAnswerQuestionResp, error)
|
||||
// ---------- 随机答题 ----------
|
||||
// 获取题目
|
||||
RandomGetQuestion(context.Context, *RandomGetQuestionReq) (*RandomGetQuestionResp, error)
|
||||
@@ -212,6 +225,9 @@ type UnimplementedQgdzsServer struct {
|
||||
func (UnimplementedQgdzsServer) GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GenerateQuestion not implemented")
|
||||
}
|
||||
func (UnimplementedQgdzsServer) CustomAnswerQuestion(context.Context, *CustomAnswerQuestionReq) (*CustomAnswerQuestionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CustomAnswerQuestion not implemented")
|
||||
}
|
||||
func (UnimplementedQgdzsServer) RandomGetQuestion(context.Context, *RandomGetQuestionReq) (*RandomGetQuestionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RandomGetQuestion not implemented")
|
||||
}
|
||||
@@ -276,6 +292,24 @@ func _Qgdzs_GenerateQuestion_Handler(srv interface{}, ctx context.Context, dec f
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Qgdzs_CustomAnswerQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CustomAnswerQuestionReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QgdzsServer).CustomAnswerQuestion(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Qgdzs/CustomAnswerQuestion",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QgdzsServer).CustomAnswerQuestion(ctx, req.(*CustomAnswerQuestionReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Qgdzs_RandomGetQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RandomGetQuestionReq)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -485,6 +519,10 @@ var Qgdzs_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "GenerateQuestion",
|
||||
Handler: _Qgdzs_GenerateQuestion_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CustomAnswerQuestion",
|
||||
Handler: _Qgdzs_CustomAnswerQuestion_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RandomGetQuestion",
|
||||
Handler: _Qgdzs_RandomGetQuestion_Handler,
|
||||
|
||||
@@ -7,6 +7,8 @@ import "google/api/annotations.proto";
|
||||
service Qgdzs {
|
||||
// 生成题目
|
||||
rpc GenerateQuestion(GenerateQuestionReq) returns (GenerateQuestionResp) {option (google.api.http) = {post: "/qgdzs/auth/generate_question" body: "*"};}
|
||||
// 自定义问答
|
||||
rpc CustomAnswerQuestion(CustomAnswerQuestionReq) returns (CustomAnswerQuestionResp) {option (google.api.http) = {post: "/qgdzs/auth/custom_answer" body: "*"};}
|
||||
|
||||
// ---------- 随机答题 ----------
|
||||
// 获取题目
|
||||
@@ -48,6 +50,14 @@ message GenerateQuestionReq {
|
||||
message GenerateQuestionResp {
|
||||
}
|
||||
|
||||
// ---------- CustomAnswerQuestion ----------
|
||||
message CustomAnswerQuestionReq {
|
||||
string Question = 1 [json_name = "question"]; // 问题
|
||||
}
|
||||
message CustomAnswerQuestionResp {
|
||||
string Answer = 1 [json_name = "answer"]; // 答案
|
||||
}
|
||||
|
||||
// ---------- RandomGetQuestion ----------
|
||||
message RandomGetQuestionReq {
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "git.hlsq.asia/mmorpg/service-common/proto/ss/sspb";
|
||||
import "ss_common.proto";
|
||||
|
||||
enum MessageID {
|
||||
MESSAGE_ID_INVALID = 0;
|
||||
MESSAGE_ID_KICK_OUT = 1; // 服务器踢人
|
||||
MESSAGE_ID_QUEUE_UP = 2; // 排队中
|
||||
MESSAGE_ID_LOGIN_SUCCESS = 3; // 登录成功
|
||||
MESSAGE_ID_ENTER_INSTANCE = 101; // 进入副本
|
||||
MESSAGE_ID_ACTION = 102; // 指令
|
||||
MESSAGE_ID_POSITION = 103; // 位置更新
|
||||
}
|
||||
|
||||
message Message {
|
||||
MessageID ID = 1;
|
||||
bytes Payload = 2;
|
||||
}
|
||||
12
Proto/SocketServer/sources/qgdzs.proto
Normal file
12
Proto/SocketServer/sources/qgdzs.proto
Normal file
@@ -0,0 +1,12 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "git.hlsq.asia/mmorpg/service-common/proto/ss/sspb";
|
||||
import "ss_common.proto";
|
||||
|
||||
// MESSAGE_ID_QGDZS_START_QUICKLY
|
||||
message C2S_StartQuickly {
|
||||
int32 InstanceID = 1;
|
||||
}
|
||||
message S2C_StartQuickly {
|
||||
PositionInfo Info = 1;
|
||||
}
|
||||
@@ -1,3 +1,21 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "git.hlsq.asia/mmorpg/service-common/proto/ss/sscommon";
|
||||
option go_package = "git.hlsq.asia/mmorpg/service-common/proto/ss/sscommon";
|
||||
|
||||
enum MessageID {
|
||||
MESSAGE_ID_INVALID = 0;
|
||||
MESSAGE_ID_KICK_OUT = 1; // 服务器踢人
|
||||
MESSAGE_ID_QUEUE_UP = 2; // 排队中
|
||||
MESSAGE_ID_LOGIN_SUCCESS = 3; // 登录成功
|
||||
|
||||
MESSAGE_ID_ENTER_INSTANCE = 101; // 进入副本
|
||||
MESSAGE_ID_ACTION = 102; // 指令
|
||||
MESSAGE_ID_POSITION = 103; // 位置更新
|
||||
|
||||
MESSAGE_ID_QGDZS_START_QUICKLY = 201; // 奇怪的知识 - 开启一局快速答题
|
||||
}
|
||||
|
||||
message Message {
|
||||
MessageID ID = 1;
|
||||
bytes Payload = 2;
|
||||
}
|
||||
Reference in New Issue
Block a user