feat usn 类型改成int64

This commit is contained in:
2026-01-30 14:48:38 +08:00
parent 7eae358996
commit 30864dbc40
29 changed files with 3032 additions and 854 deletions

View File

@@ -54,7 +54,7 @@
},
"/qgdzs/auth/get_record": {
"post": {
"summary": "获取答题记录",
"summary": "---------- 答题记录 ----------\n获取答题记录",
"operationId": "Qgdzs_GetRecord",
"responses": {
"200": {
@@ -79,15 +79,15 @@
]
}
},
"/qgdzs/open/answer_question": {
"/qgdzs/open/category/answer": {
"post": {
"summary": "回答题目",
"operationId": "Qgdzs_AnswerQuestion",
"operationId": "Qgdzs_CategoryAnswerQuestion",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/AnswerQuestionResp"
"$ref": "#/definitions/CategoryAnswerQuestionResp"
}
}
},
@@ -97,7 +97,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/AnswerQuestionReq"
"$ref": "#/definitions/CategoryAnswerQuestionReq"
}
}
],
@@ -106,9 +106,9 @@
]
}
},
"/qgdzs/open/get_all_category": {
"/qgdzs/open/category/get_category": {
"post": {
"summary": "获取所有类目",
"summary": "---------- 类目答题 ----------\n获取所有类目",
"operationId": "Qgdzs_GetAllCategory",
"responses": {
"200": {
@@ -133,15 +133,15 @@
]
}
},
"/qgdzs/open/get_question": {
"/qgdzs/open/category/question": {
"post": {
"summary": "获取题目",
"operationId": "Qgdzs_GetQuestion",
"operationId": "Qgdzs_CategoryGetQuestion",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/GetQuestionResp"
"$ref": "#/definitions/CategoryGetQuestionResp"
}
}
},
@@ -151,7 +151,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/GetQuestionReq"
"$ref": "#/definitions/CategoryGetQuestionReq"
}
}
],
@@ -187,6 +187,114 @@
]
}
},
"/qgdzs/open/quickly/answer": {
"post": {
"summary": "回答题目",
"operationId": "Qgdzs_QuicklyAnswerQuestion",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/QuicklyAnswerQuestionResp"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/QuicklyAnswerQuestionReq"
}
}
],
"tags": [
"Qgdzs"
]
}
},
"/qgdzs/open/quickly/question": {
"post": {
"summary": "---------- 快速答题 ----------\n获取题目",
"operationId": "Qgdzs_QuicklyGetQuestion",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/QuicklyGetQuestionResp"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/QuicklyGetQuestionReq"
}
}
],
"tags": [
"Qgdzs"
]
}
},
"/qgdzs/open/random/answer": {
"post": {
"summary": "回答题目",
"operationId": "Qgdzs_RandomAnswerQuestion",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/RandomAnswerQuestionResp"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/RandomAnswerQuestionReq"
}
}
],
"tags": [
"Qgdzs"
]
}
},
"/qgdzs/open/random/question": {
"post": {
"summary": "---------- 随机答题 ----------\n获取题目",
"operationId": "Qgdzs_RandomGetQuestion",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/RandomGetQuestionResp"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/RandomGetQuestionReq"
}
}
],
"tags": [
"Qgdzs"
]
}
},
"/user/auth/info": {
"post": {
"summary": "获取用户信息",
@@ -219,14 +327,16 @@
"ActionResp": {
"type": "object"
},
"AnswerQuestionReq": {
"CategoryAnswerQuestionReq": {
"type": "object",
"properties": {
"usn": {
"type": "string"
"type": "string",
"format": "int64"
},
"sn": {
"type": "string",
"format": "int64",
"title": "题目唯一标识"
},
"answer": {
@@ -234,9 +344,9 @@
"title": "答案"
}
},
"title": "---------- AnswerQuestion ----------"
"title": "---------- CategoryAnswerQuestion ----------"
},
"AnswerQuestionResp": {
"CategoryAnswerQuestionResp": {
"type": "object",
"properties": {
"answer": {
@@ -249,15 +359,58 @@
}
}
},
"CategoryGetQuestionReq": {
"type": "object",
"properties": {
"category_sn": {
"type": "string",
"format": "int64",
"title": "类目唯一标识"
}
},
"title": "---------- CategoryGetQuestion ----------"
},
"CategoryGetQuestionResp": {
"type": "object",
"properties": {
"sn": {
"type": "string",
"format": "int64",
"title": "题目唯一标识"
},
"question": {
"type": "string",
"title": "题干"
},
"options": {
"type": "array",
"items": {
"type": "string"
},
"title": "选项"
},
"category": {
"type": "string",
"title": "题目类型"
},
"difficulty": {
"type": "integer",
"format": "int32",
"title": "难度"
}
}
},
"EnterResp": {
"type": "object",
"properties": {
"SceneSID": {
"type": "string",
"format": "int64",
"title": "场景服务ID"
},
"UniqueNo": {
"type": "string",
"format": "int64",
"title": "副本唯一编号"
},
"MessageID": {
@@ -291,6 +444,7 @@
"properties": {
"sn": {
"type": "string",
"format": "int64",
"title": "唯一标识"
},
"category": {
@@ -321,6 +475,7 @@
"properties": {
"question_sn": {
"type": "string",
"format": "int64",
"title": "题目唯一标识"
}
},
@@ -355,50 +510,12 @@
}
}
},
"GetQuestionReq": {
"type": "object",
"properties": {
"category_sn": {
"type": "string",
"title": "类目唯一标识"
}
},
"title": "---------- GetQuestion ----------"
},
"GetQuestionResp": {
"type": "object",
"properties": {
"sn": {
"type": "string",
"title": "题目唯一标识"
},
"question": {
"type": "string",
"title": "题干"
},
"options": {
"type": "array",
"items": {
"type": "string"
},
"title": "选项"
},
"category": {
"type": "string",
"title": "题目类型"
},
"difficulty": {
"type": "integer",
"format": "int32",
"title": "难度"
}
}
},
"GetRecordItem": {
"type": "object",
"properties": {
"question_sn": {
"type": "string",
"format": "int64",
"title": "题目唯一标识"
},
"question": {
@@ -433,7 +550,8 @@
"type": "object",
"properties": {
"usn": {
"type": "string"
"type": "string",
"format": "int64"
},
"page": {
"type": "integer",
@@ -468,7 +586,8 @@
"type": "object",
"properties": {
"usn": {
"type": "string"
"type": "string",
"format": "int64"
}
},
"title": "---------- GetUserInfo ----------"
@@ -477,7 +596,8 @@
"type": "object",
"properties": {
"usn": {
"type": "string"
"type": "string",
"format": "int64"
},
"name": {
"type": "string"
@@ -495,6 +615,7 @@
"properties": {
"usn": {
"type": "string",
"format": "int64",
"title": "用户ID"
},
"name": {
@@ -503,6 +624,138 @@
}
}
},
"QuicklyAnswerQuestionReq": {
"type": "object",
"properties": {
"usn": {
"type": "string",
"format": "int64"
},
"sn": {
"type": "string",
"format": "int64",
"title": "题目唯一标识"
},
"answer": {
"type": "string",
"title": "答案"
}
},
"title": "---------- QuicklyAnswerQuestion ----------"
},
"QuicklyAnswerQuestionResp": {
"type": "object",
"properties": {
"answer": {
"type": "string",
"title": "答案"
},
"explanation": {
"type": "string",
"title": "解析"
}
}
},
"QuicklyGetQuestionReq": {
"type": "object",
"title": "---------- QuicklyGetQuestion ----------"
},
"QuicklyGetQuestionResp": {
"type": "object",
"properties": {
"sn": {
"type": "string",
"format": "int64",
"title": "题目唯一标识"
},
"question": {
"type": "string",
"title": "题干"
},
"options": {
"type": "array",
"items": {
"type": "string"
},
"title": "选项"
},
"category": {
"type": "string",
"title": "题目类型"
},
"difficulty": {
"type": "integer",
"format": "int32",
"title": "难度"
}
}
},
"RandomAnswerQuestionReq": {
"type": "object",
"properties": {
"usn": {
"type": "string",
"format": "int64"
},
"sn": {
"type": "string",
"format": "int64",
"title": "题目唯一标识"
},
"answer": {
"type": "string",
"title": "答案"
}
},
"title": "---------- RandomAnswerQuestion ----------"
},
"RandomAnswerQuestionResp": {
"type": "object",
"properties": {
"answer": {
"type": "string",
"title": "答案"
},
"explanation": {
"type": "string",
"title": "解析"
}
}
},
"RandomGetQuestionReq": {
"type": "object",
"title": "---------- RandomGetQuestion ----------"
},
"RandomGetQuestionResp": {
"type": "object",
"properties": {
"sn": {
"type": "string",
"format": "int64",
"title": "题目唯一标识"
},
"question": {
"type": "string",
"title": "题干"
},
"options": {
"type": "array",
"items": {
"type": "string"
},
"title": "选项"
},
"category": {
"type": "string",
"title": "题目类型"
},
"difficulty": {
"type": "integer",
"format": "int32",
"title": "难度"
}
}
},
"ToClientResp": {
"type": "object"
},
@@ -511,6 +764,7 @@
"properties": {
"usn": {
"type": "string",
"format": "int64",
"title": "用户ID"
},
"name": {

View File

@@ -26,7 +26,7 @@ type ToClientReq struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
USN string `protobuf:"bytes,1,opt,name=USN,proto3" json:"USN,omitempty"`
USN int64 `protobuf:"varint,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() string {
func (x *ToClientReq) GetUSN() int64 {
if x != nil {
return x.USN
}
return ""
return 0
}
func (x *ToClientReq) GetMessageID() int32 {
@@ -127,7 +127,7 @@ type KickUserReq struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
USN string `protobuf:"bytes,1,opt,name=USN,proto3" json:"USN,omitempty"`
USN int64 `protobuf:"varint,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() string {
func (x *KickUserReq) GetUSN() int64 {
if x != nil {
return x.USN
}
return ""
return 0
}
type KickUserResp struct {
@@ -214,13 +214,13 @@ var file_service_gateway_proto_rawDesc = []byte{
0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x72, 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, 0x09, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73,
0x20, 0x01, 0x28, 0x03, 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, 0x09, 0x52, 0x03, 0x55,
0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 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,

View File

@@ -59,75 +59,51 @@ func local_request_Qgdzs_GenerateQuestion_0(ctx context.Context, marshaler runti
return msg, metadata, err
}
func request_Qgdzs_GetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
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 GetQuestionReq
protoReq RandomGetQuestionReq
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))
msg, err := client.RandomGetQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Qgdzs_GetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
func local_request_Qgdzs_RandomGetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq GetQuestionReq
protoReq RandomGetQuestionReq
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)
msg, err := server.RandomGetQuestion(ctx, &protoReq)
return msg, metadata, err
}
func request_Qgdzs_GetQuestionInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
func request_Qgdzs_RandomAnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq GetQuestionInfoReq
protoReq RandomAnswerQuestionReq
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.GetQuestionInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
msg, err := client.RandomAnswerQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Qgdzs_GetQuestionInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
func local_request_Qgdzs_RandomAnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq GetQuestionInfoReq
protoReq RandomAnswerQuestionReq
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.GetQuestionInfo(ctx, &protoReq)
return msg, metadata, err
}
func request_Qgdzs_AnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, 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_Qgdzs_AnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, 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)
msg, err := server.RandomAnswerQuestion(ctx, &protoReq)
return msg, metadata, err
}
@@ -155,6 +131,102 @@ func local_request_Qgdzs_GetAllCategory_0(ctx context.Context, marshaler runtime
return msg, metadata, err
}
func request_Qgdzs_CategoryGetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq CategoryGetQuestionReq
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.CategoryGetQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Qgdzs_CategoryGetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq CategoryGetQuestionReq
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.CategoryGetQuestion(ctx, &protoReq)
return msg, metadata, err
}
func request_Qgdzs_CategoryAnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq CategoryAnswerQuestionReq
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.CategoryAnswerQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Qgdzs_CategoryAnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq CategoryAnswerQuestionReq
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.CategoryAnswerQuestion(ctx, &protoReq)
return msg, metadata, err
}
func request_Qgdzs_QuicklyGetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq QuicklyGetQuestionReq
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.QuicklyGetQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Qgdzs_QuicklyGetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq QuicklyGetQuestionReq
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.QuicklyGetQuestion(ctx, &protoReq)
return msg, metadata, err
}
func request_Qgdzs_QuicklyAnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq QuicklyAnswerQuestionReq
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.QuicklyAnswerQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Qgdzs_QuicklyAnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq QuicklyAnswerQuestionReq
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.QuicklyAnswerQuestion(ctx, &protoReq)
return msg, metadata, err
}
func request_Qgdzs_GetRecord_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq GetRecordReq
@@ -179,6 +251,30 @@ func local_request_Qgdzs_GetRecord_0(ctx context.Context, marshaler runtime.Mars
return msg, metadata, err
}
func request_Qgdzs_GetQuestionInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq GetQuestionInfoReq
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.GetQuestionInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Qgdzs_GetQuestionInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq GetQuestionInfoReq
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.GetQuestionInfo(ctx, &protoReq)
return msg, metadata, err
}
// RegisterQgdzsHandlerServer registers the http handlers for service Qgdzs to "mux".
// UnaryRPC :call QgdzsServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@@ -205,65 +301,45 @@ 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_GetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
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()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/GetQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/get_question"))
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/RandomGetQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/random/question"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Qgdzs_GetQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams)
resp, md, err := local_request_Qgdzs_RandomGetQuestion_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_GetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
forward_Qgdzs_RandomGetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Qgdzs_GetQuestionInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle(http.MethodPost, pattern_Qgdzs_RandomAnswerQuestion_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/GetQuestionInfo", runtime.WithHTTPPathPattern("/qgdzs/open/get_question_info"))
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/RandomAnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/random/answer"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Qgdzs_GetQuestionInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams)
resp, md, err := local_request_Qgdzs_RandomAnswerQuestion_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_GetQuestionInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Qgdzs_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, "/.Qgdzs/AnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/answer_question"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Qgdzs_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_Qgdzs_AnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
forward_Qgdzs_RandomAnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Qgdzs_GetAllCategory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
@@ -271,7 +347,7 @@ func RegisterQgdzsHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/GetAllCategory", runtime.WithHTTPPathPattern("/qgdzs/open/get_all_category"))
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/GetAllCategory", runtime.WithHTTPPathPattern("/qgdzs/open/category/get_category"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -285,6 +361,86 @@ func RegisterQgdzsHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
}
forward_Qgdzs_GetAllCategory_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Qgdzs_CategoryGetQuestion_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/CategoryGetQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/category/question"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Qgdzs_CategoryGetQuestion_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_CategoryGetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Qgdzs_CategoryAnswerQuestion_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/CategoryAnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/category/answer"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Qgdzs_CategoryAnswerQuestion_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_CategoryAnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Qgdzs_QuicklyGetQuestion_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/QuicklyGetQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/quickly/question"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Qgdzs_QuicklyGetQuestion_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_QuicklyGetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Qgdzs_QuicklyAnswerQuestion_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/QuicklyAnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/quickly/answer"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Qgdzs_QuicklyAnswerQuestion_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_QuicklyAnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Qgdzs_GetRecord_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -305,6 +461,26 @@ func RegisterQgdzsHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
}
forward_Qgdzs_GetRecord_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Qgdzs_GetQuestionInfo_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/GetQuestionInfo", runtime.WithHTTPPathPattern("/qgdzs/open/get_question_info"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Qgdzs_GetQuestionInfo_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_GetQuestionInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@@ -362,62 +538,45 @@ 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_GetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
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()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/GetQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/get_question"))
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/RandomGetQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/random/question"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Qgdzs_GetQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
resp, md, err := request_Qgdzs_RandomGetQuestion_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_GetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
forward_Qgdzs_RandomGetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Qgdzs_GetQuestionInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle(http.MethodPost, pattern_Qgdzs_RandomAnswerQuestion_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/GetQuestionInfo", runtime.WithHTTPPathPattern("/qgdzs/open/get_question_info"))
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/RandomAnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/random/answer"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Qgdzs_GetQuestionInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams)
resp, md, err := request_Qgdzs_RandomAnswerQuestion_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_GetQuestionInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Qgdzs_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, "/.Qgdzs/AnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/answer_question"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Qgdzs_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_Qgdzs_AnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
forward_Qgdzs_RandomAnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Qgdzs_GetAllCategory_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/GetAllCategory", runtime.WithHTTPPathPattern("/qgdzs/open/get_all_category"))
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/GetAllCategory", runtime.WithHTTPPathPattern("/qgdzs/open/category/get_category"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -430,6 +589,74 @@ func RegisterQgdzsHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
}
forward_Qgdzs_GetAllCategory_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Qgdzs_CategoryGetQuestion_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/CategoryGetQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/category/question"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Qgdzs_CategoryGetQuestion_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_CategoryGetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Qgdzs_CategoryAnswerQuestion_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/CategoryAnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/category/answer"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Qgdzs_CategoryAnswerQuestion_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_CategoryAnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Qgdzs_QuicklyGetQuestion_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/QuicklyGetQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/quickly/question"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Qgdzs_QuicklyGetQuestion_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_QuicklyGetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Qgdzs_QuicklyAnswerQuestion_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/QuicklyAnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/quickly/answer"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Qgdzs_QuicklyAnswerQuestion_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_QuicklyAnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Qgdzs_GetRecord_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -447,23 +674,48 @@ func RegisterQgdzsHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
}
forward_Qgdzs_GetRecord_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Qgdzs_GetQuestionInfo_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/GetQuestionInfo", runtime.WithHTTPPathPattern("/qgdzs/open/get_question_info"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Qgdzs_GetQuestionInfo_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_GetQuestionInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Qgdzs_GenerateQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qgdzs", "auth", "generate_question"}, ""))
pattern_Qgdzs_GetQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qgdzs", "open", "get_question"}, ""))
pattern_Qgdzs_GetQuestionInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qgdzs", "open", "get_question_info"}, ""))
pattern_Qgdzs_AnswerQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qgdzs", "open", "answer_question"}, ""))
pattern_Qgdzs_GetAllCategory_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qgdzs", "open", "get_all_category"}, ""))
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"}, ""))
pattern_Qgdzs_CategoryGetQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "category", "question"}, ""))
pattern_Qgdzs_CategoryAnswerQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "category", "answer"}, ""))
pattern_Qgdzs_QuicklyGetQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "quickly", "question"}, ""))
pattern_Qgdzs_QuicklyAnswerQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "quickly", "answer"}, ""))
pattern_Qgdzs_GetRecord_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qgdzs", "auth", "get_record"}, ""))
pattern_Qgdzs_GetQuestionInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qgdzs", "open", "get_question_info"}, ""))
)
var (
forward_Qgdzs_GenerateQuestion_0 = runtime.ForwardResponseMessage
forward_Qgdzs_GetQuestion_0 = runtime.ForwardResponseMessage
forward_Qgdzs_GetQuestionInfo_0 = runtime.ForwardResponseMessage
forward_Qgdzs_AnswerQuestion_0 = runtime.ForwardResponseMessage
forward_Qgdzs_RandomGetQuestion_0 = runtime.ForwardResponseMessage
forward_Qgdzs_RandomAnswerQuestion_0 = runtime.ForwardResponseMessage
forward_Qgdzs_GetAllCategory_0 = runtime.ForwardResponseMessage
forward_Qgdzs_CategoryGetQuestion_0 = runtime.ForwardResponseMessage
forward_Qgdzs_CategoryAnswerQuestion_0 = runtime.ForwardResponseMessage
forward_Qgdzs_QuicklyGetQuestion_0 = runtime.ForwardResponseMessage
forward_Qgdzs_QuicklyAnswerQuestion_0 = runtime.ForwardResponseMessage
forward_Qgdzs_GetRecord_0 = runtime.ForwardResponseMessage
forward_Qgdzs_GetQuestionInfo_0 = runtime.ForwardResponseMessage
)

View File

@@ -24,16 +24,28 @@ const _ = grpc.SupportPackageIsVersion7
type QgdzsClient interface {
// 生成题目
GenerateQuestion(ctx context.Context, in *GenerateQuestionReq, opts ...grpc.CallOption) (*GenerateQuestionResp, error)
// ---------- 随机答题 ----------
// 获取题目
GetQuestion(ctx context.Context, in *GetQuestionReq, opts ...grpc.CallOption) (*GetQuestionResp, error)
// 获取具体的题目
GetQuestionInfo(ctx context.Context, in *GetQuestionInfoReq, opts ...grpc.CallOption) (*GetQuestionInfoResp, error)
RandomGetQuestion(ctx context.Context, in *RandomGetQuestionReq, opts ...grpc.CallOption) (*RandomGetQuestionResp, error)
// 回答题目
AnswerQuestion(ctx context.Context, in *AnswerQuestionReq, opts ...grpc.CallOption) (*AnswerQuestionResp, error)
RandomAnswerQuestion(ctx context.Context, in *RandomAnswerQuestionReq, opts ...grpc.CallOption) (*RandomAnswerQuestionResp, error)
// ---------- 类目答题 ----------
// 获取所有类目
GetAllCategory(ctx context.Context, in *GetAllCategoryReq, opts ...grpc.CallOption) (*GetAllCategoryResp, error)
// 获取题目
CategoryGetQuestion(ctx context.Context, in *CategoryGetQuestionReq, opts ...grpc.CallOption) (*CategoryGetQuestionResp, error)
// 回答题目
CategoryAnswerQuestion(ctx context.Context, in *CategoryAnswerQuestionReq, opts ...grpc.CallOption) (*CategoryAnswerQuestionResp, error)
// ---------- 快速答题 ----------
// 获取题目
QuicklyGetQuestion(ctx context.Context, in *QuicklyGetQuestionReq, opts ...grpc.CallOption) (*QuicklyGetQuestionResp, error)
// 回答题目
QuicklyAnswerQuestion(ctx context.Context, in *QuicklyAnswerQuestionReq, opts ...grpc.CallOption) (*QuicklyAnswerQuestionResp, error)
// ---------- 答题记录 ----------
// 获取答题记录
GetRecord(ctx context.Context, in *GetRecordReq, opts ...grpc.CallOption) (*GetRecordResp, error)
// 获取具体的题目
GetQuestionInfo(ctx context.Context, in *GetQuestionInfoReq, opts ...grpc.CallOption) (*GetQuestionInfoResp, error)
}
type qgdzsClient struct {
@@ -53,27 +65,18 @@ func (c *qgdzsClient) GenerateQuestion(ctx context.Context, in *GenerateQuestion
return out, nil
}
func (c *qgdzsClient) GetQuestion(ctx context.Context, in *GetQuestionReq, opts ...grpc.CallOption) (*GetQuestionResp, error) {
out := new(GetQuestionResp)
err := c.cc.Invoke(ctx, "/Qgdzs/GetQuestion", in, out, opts...)
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...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *qgdzsClient) GetQuestionInfo(ctx context.Context, in *GetQuestionInfoReq, opts ...grpc.CallOption) (*GetQuestionInfoResp, error) {
out := new(GetQuestionInfoResp)
err := c.cc.Invoke(ctx, "/Qgdzs/GetQuestionInfo", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *qgdzsClient) AnswerQuestion(ctx context.Context, in *AnswerQuestionReq, opts ...grpc.CallOption) (*AnswerQuestionResp, error) {
out := new(AnswerQuestionResp)
err := c.cc.Invoke(ctx, "/Qgdzs/AnswerQuestion", in, out, opts...)
func (c *qgdzsClient) RandomAnswerQuestion(ctx context.Context, in *RandomAnswerQuestionReq, opts ...grpc.CallOption) (*RandomAnswerQuestionResp, error) {
out := new(RandomAnswerQuestionResp)
err := c.cc.Invoke(ctx, "/Qgdzs/RandomAnswerQuestion", in, out, opts...)
if err != nil {
return nil, err
}
@@ -89,6 +92,42 @@ func (c *qgdzsClient) GetAllCategory(ctx context.Context, in *GetAllCategoryReq,
return out, nil
}
func (c *qgdzsClient) CategoryGetQuestion(ctx context.Context, in *CategoryGetQuestionReq, opts ...grpc.CallOption) (*CategoryGetQuestionResp, error) {
out := new(CategoryGetQuestionResp)
err := c.cc.Invoke(ctx, "/Qgdzs/CategoryGetQuestion", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *qgdzsClient) CategoryAnswerQuestion(ctx context.Context, in *CategoryAnswerQuestionReq, opts ...grpc.CallOption) (*CategoryAnswerQuestionResp, error) {
out := new(CategoryAnswerQuestionResp)
err := c.cc.Invoke(ctx, "/Qgdzs/CategoryAnswerQuestion", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *qgdzsClient) QuicklyGetQuestion(ctx context.Context, in *QuicklyGetQuestionReq, opts ...grpc.CallOption) (*QuicklyGetQuestionResp, error) {
out := new(QuicklyGetQuestionResp)
err := c.cc.Invoke(ctx, "/Qgdzs/QuicklyGetQuestion", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *qgdzsClient) QuicklyAnswerQuestion(ctx context.Context, in *QuicklyAnswerQuestionReq, opts ...grpc.CallOption) (*QuicklyAnswerQuestionResp, error) {
out := new(QuicklyAnswerQuestionResp)
err := c.cc.Invoke(ctx, "/Qgdzs/QuicklyAnswerQuestion", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *qgdzsClient) GetRecord(ctx context.Context, in *GetRecordReq, opts ...grpc.CallOption) (*GetRecordResp, error) {
out := new(GetRecordResp)
err := c.cc.Invoke(ctx, "/Qgdzs/GetRecord", in, out, opts...)
@@ -98,22 +137,43 @@ func (c *qgdzsClient) GetRecord(ctx context.Context, in *GetRecordReq, opts ...g
return out, nil
}
func (c *qgdzsClient) GetQuestionInfo(ctx context.Context, in *GetQuestionInfoReq, opts ...grpc.CallOption) (*GetQuestionInfoResp, error) {
out := new(GetQuestionInfoResp)
err := c.cc.Invoke(ctx, "/Qgdzs/GetQuestionInfo", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QgdzsServer is the server API for Qgdzs service.
// All implementations must embed UnimplementedQgdzsServer
// for forward compatibility
type QgdzsServer interface {
// 生成题目
GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error)
// ---------- 随机答题 ----------
// 获取题目
GetQuestion(context.Context, *GetQuestionReq) (*GetQuestionResp, error)
// 获取具体的题目
GetQuestionInfo(context.Context, *GetQuestionInfoReq) (*GetQuestionInfoResp, error)
RandomGetQuestion(context.Context, *RandomGetQuestionReq) (*RandomGetQuestionResp, error)
// 回答题目
AnswerQuestion(context.Context, *AnswerQuestionReq) (*AnswerQuestionResp, error)
RandomAnswerQuestion(context.Context, *RandomAnswerQuestionReq) (*RandomAnswerQuestionResp, error)
// ---------- 类目答题 ----------
// 获取所有类目
GetAllCategory(context.Context, *GetAllCategoryReq) (*GetAllCategoryResp, error)
// 获取题目
CategoryGetQuestion(context.Context, *CategoryGetQuestionReq) (*CategoryGetQuestionResp, error)
// 回答题目
CategoryAnswerQuestion(context.Context, *CategoryAnswerQuestionReq) (*CategoryAnswerQuestionResp, error)
// ---------- 快速答题 ----------
// 获取题目
QuicklyGetQuestion(context.Context, *QuicklyGetQuestionReq) (*QuicklyGetQuestionResp, error)
// 回答题目
QuicklyAnswerQuestion(context.Context, *QuicklyAnswerQuestionReq) (*QuicklyAnswerQuestionResp, error)
// ---------- 答题记录 ----------
// 获取答题记录
GetRecord(context.Context, *GetRecordReq) (*GetRecordResp, error)
// 获取具体的题目
GetQuestionInfo(context.Context, *GetQuestionInfoReq) (*GetQuestionInfoResp, error)
mustEmbedUnimplementedQgdzsServer()
}
@@ -124,21 +184,33 @@ type UnimplementedQgdzsServer struct {
func (UnimplementedQgdzsServer) GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GenerateQuestion not implemented")
}
func (UnimplementedQgdzsServer) GetQuestion(context.Context, *GetQuestionReq) (*GetQuestionResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetQuestion not implemented")
func (UnimplementedQgdzsServer) RandomGetQuestion(context.Context, *RandomGetQuestionReq) (*RandomGetQuestionResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method RandomGetQuestion not implemented")
}
func (UnimplementedQgdzsServer) GetQuestionInfo(context.Context, *GetQuestionInfoReq) (*GetQuestionInfoResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetQuestionInfo not implemented")
}
func (UnimplementedQgdzsServer) AnswerQuestion(context.Context, *AnswerQuestionReq) (*AnswerQuestionResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method AnswerQuestion not implemented")
func (UnimplementedQgdzsServer) RandomAnswerQuestion(context.Context, *RandomAnswerQuestionReq) (*RandomAnswerQuestionResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method RandomAnswerQuestion not implemented")
}
func (UnimplementedQgdzsServer) GetAllCategory(context.Context, *GetAllCategoryReq) (*GetAllCategoryResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetAllCategory not implemented")
}
func (UnimplementedQgdzsServer) CategoryGetQuestion(context.Context, *CategoryGetQuestionReq) (*CategoryGetQuestionResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method CategoryGetQuestion not implemented")
}
func (UnimplementedQgdzsServer) CategoryAnswerQuestion(context.Context, *CategoryAnswerQuestionReq) (*CategoryAnswerQuestionResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method CategoryAnswerQuestion not implemented")
}
func (UnimplementedQgdzsServer) QuicklyGetQuestion(context.Context, *QuicklyGetQuestionReq) (*QuicklyGetQuestionResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method QuicklyGetQuestion not implemented")
}
func (UnimplementedQgdzsServer) QuicklyAnswerQuestion(context.Context, *QuicklyAnswerQuestionReq) (*QuicklyAnswerQuestionResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method QuicklyAnswerQuestion not implemented")
}
func (UnimplementedQgdzsServer) GetRecord(context.Context, *GetRecordReq) (*GetRecordResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetRecord not implemented")
}
func (UnimplementedQgdzsServer) GetQuestionInfo(context.Context, *GetQuestionInfoReq) (*GetQuestionInfoResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetQuestionInfo not implemented")
}
func (UnimplementedQgdzsServer) mustEmbedUnimplementedQgdzsServer() {}
// UnsafeQgdzsServer may be embedded to opt out of forward compatibility for this service.
@@ -170,56 +242,38 @@ func _Qgdzs_GenerateQuestion_Handler(srv interface{}, ctx context.Context, dec f
return interceptor(ctx, in, info, handler)
}
func _Qgdzs_GetQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetQuestionReq)
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 {
return nil, err
}
if interceptor == nil {
return srv.(QgdzsServer).GetQuestion(ctx, in)
return srv.(QgdzsServer).RandomGetQuestion(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Qgdzs/GetQuestion",
FullMethod: "/Qgdzs/RandomGetQuestion",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QgdzsServer).GetQuestion(ctx, req.(*GetQuestionReq))
return srv.(QgdzsServer).RandomGetQuestion(ctx, req.(*RandomGetQuestionReq))
}
return interceptor(ctx, in, info, handler)
}
func _Qgdzs_GetQuestionInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetQuestionInfoReq)
func _Qgdzs_RandomAnswerQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RandomAnswerQuestionReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QgdzsServer).GetQuestionInfo(ctx, in)
return srv.(QgdzsServer).RandomAnswerQuestion(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Qgdzs/GetQuestionInfo",
FullMethod: "/Qgdzs/RandomAnswerQuestion",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QgdzsServer).GetQuestionInfo(ctx, req.(*GetQuestionInfoReq))
}
return interceptor(ctx, in, info, handler)
}
func _Qgdzs_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.(QgdzsServer).AnswerQuestion(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Qgdzs/AnswerQuestion",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QgdzsServer).AnswerQuestion(ctx, req.(*AnswerQuestionReq))
return srv.(QgdzsServer).RandomAnswerQuestion(ctx, req.(*RandomAnswerQuestionReq))
}
return interceptor(ctx, in, info, handler)
}
@@ -242,6 +296,78 @@ func _Qgdzs_GetAllCategory_Handler(srv interface{}, ctx context.Context, dec fun
return interceptor(ctx, in, info, handler)
}
func _Qgdzs_CategoryGetQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CategoryGetQuestionReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QgdzsServer).CategoryGetQuestion(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Qgdzs/CategoryGetQuestion",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QgdzsServer).CategoryGetQuestion(ctx, req.(*CategoryGetQuestionReq))
}
return interceptor(ctx, in, info, handler)
}
func _Qgdzs_CategoryAnswerQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CategoryAnswerQuestionReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QgdzsServer).CategoryAnswerQuestion(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Qgdzs/CategoryAnswerQuestion",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QgdzsServer).CategoryAnswerQuestion(ctx, req.(*CategoryAnswerQuestionReq))
}
return interceptor(ctx, in, info, handler)
}
func _Qgdzs_QuicklyGetQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QuicklyGetQuestionReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QgdzsServer).QuicklyGetQuestion(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Qgdzs/QuicklyGetQuestion",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QgdzsServer).QuicklyGetQuestion(ctx, req.(*QuicklyGetQuestionReq))
}
return interceptor(ctx, in, info, handler)
}
func _Qgdzs_QuicklyAnswerQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QuicklyAnswerQuestionReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QgdzsServer).QuicklyAnswerQuestion(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Qgdzs/QuicklyAnswerQuestion",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QgdzsServer).QuicklyAnswerQuestion(ctx, req.(*QuicklyAnswerQuestionReq))
}
return interceptor(ctx, in, info, handler)
}
func _Qgdzs_GetRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetRecordReq)
if err := dec(in); err != nil {
@@ -260,6 +386,24 @@ func _Qgdzs_GetRecord_Handler(srv interface{}, ctx context.Context, dec func(int
return interceptor(ctx, in, info, handler)
}
func _Qgdzs_GetQuestionInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetQuestionInfoReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QgdzsServer).GetQuestionInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Qgdzs/GetQuestionInfo",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QgdzsServer).GetQuestionInfo(ctx, req.(*GetQuestionInfoReq))
}
return interceptor(ctx, in, info, handler)
}
// Qgdzs_ServiceDesc is the grpc.ServiceDesc for Qgdzs service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -272,25 +416,41 @@ var Qgdzs_ServiceDesc = grpc.ServiceDesc{
Handler: _Qgdzs_GenerateQuestion_Handler,
},
{
MethodName: "GetQuestion",
Handler: _Qgdzs_GetQuestion_Handler,
MethodName: "RandomGetQuestion",
Handler: _Qgdzs_RandomGetQuestion_Handler,
},
{
MethodName: "GetQuestionInfo",
Handler: _Qgdzs_GetQuestionInfo_Handler,
},
{
MethodName: "AnswerQuestion",
Handler: _Qgdzs_AnswerQuestion_Handler,
MethodName: "RandomAnswerQuestion",
Handler: _Qgdzs_RandomAnswerQuestion_Handler,
},
{
MethodName: "GetAllCategory",
Handler: _Qgdzs_GetAllCategory_Handler,
},
{
MethodName: "CategoryGetQuestion",
Handler: _Qgdzs_CategoryGetQuestion_Handler,
},
{
MethodName: "CategoryAnswerQuestion",
Handler: _Qgdzs_CategoryAnswerQuestion_Handler,
},
{
MethodName: "QuicklyGetQuestion",
Handler: _Qgdzs_QuicklyGetQuestion_Handler,
},
{
MethodName: "QuicklyAnswerQuestion",
Handler: _Qgdzs_QuicklyAnswerQuestion_Handler,
},
{
MethodName: "GetRecord",
Handler: _Qgdzs_GetRecord_Handler,
},
{
MethodName: "GetQuestionInfo",
Handler: _Qgdzs_GetQuestionInfo_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "service_qgdzs.proto",

View File

@@ -26,8 +26,8 @@ type EnterReq struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
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
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
}
@@ -63,18 +63,18 @@ func (*EnterReq) Descriptor() ([]byte, []int) {
return file_service_scene_proto_rawDescGZIP(), []int{0}
}
func (x *EnterReq) GetUSN() string {
func (x *EnterReq) GetUSN() int64 {
if x != nil {
return x.USN
}
return ""
return 0
}
func (x *EnterReq) GetGatewaySID() string {
func (x *EnterReq) GetGatewaySID() int64 {
if x != nil {
return x.GatewaySID
}
return ""
return 0
}
func (x *EnterReq) GetInstanceID() int32 {
@@ -89,8 +89,8 @@ type EnterResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
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"` // 副本唯一编号
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"` // 副本唯一编号
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() string {
func (x *EnterResp) GetSceneSID() int64 {
if x != nil {
return x.SceneSID
}
return ""
return 0
}
func (x *EnterResp) GetUniqueNo() string {
func (x *EnterResp) GetUniqueNo() int64 {
if x != nil {
return x.UniqueNo
}
return ""
return 0
}
func (x *EnterResp) GetMessageID() int32 {
@@ -160,8 +160,8 @@ type LeaveReq struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
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"` // 副本唯一编号
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"` // 副本唯一编号
}
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() string {
func (x *LeaveReq) GetUSN() int64 {
if x != nil {
return x.USN
}
return ""
return 0
}
func (x *LeaveReq) GetUniqueNo() string {
func (x *LeaveReq) GetUniqueNo() int64 {
if x != nil {
return x.UniqueNo
}
return ""
return 0
}
type LeaveResp struct {
@@ -253,8 +253,8 @@ type ActionReq struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
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
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 缩放)
@@ -293,18 +293,18 @@ func (*ActionReq) Descriptor() ([]byte, []int) {
return file_service_scene_proto_rawDescGZIP(), []int{4}
}
func (x *ActionReq) GetUniqueNo() string {
func (x *ActionReq) GetUniqueNo() int64 {
if x != nil {
return x.UniqueNo
}
return ""
return 0
}
func (x *ActionReq) GetUSN() string {
func (x *ActionReq) GetUSN() int64 {
if x != nil {
return x.USN
}
return ""
return 0
}
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, 0x72, 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, 0x09, 0x52,
0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
0x03, 0x55, 0x53, 0x4e, 0x12, 0x1e, 0x0a, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53,
0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61,
0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 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, 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,
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,
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, 0x09, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12,
0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x55, 0x53, 0x4e, 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, 0x22, 0x0b, 0x0a, 0x09, 0x4c,
0x03, 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, 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,
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,
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,

View File

@@ -83,7 +83,7 @@ type PhoneLoginResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` // 用户ID
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"` // 用户名
}
@@ -119,11 +119,11 @@ func (*PhoneLoginResp) Descriptor() ([]byte, []int) {
return file_service_user_proto_rawDescGZIP(), []int{1}
}
func (x *PhoneLoginResp) GetUSN() string {
func (x *PhoneLoginResp) GetUSN() int64 {
if x != nil {
return x.USN
}
return ""
return 0
}
func (x *PhoneLoginResp) GetName() string {
@@ -186,7 +186,7 @@ type WxMiniLoginResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` // 用户ID
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"` // 用户名
}
@@ -222,11 +222,11 @@ func (*WxMiniLoginResp) Descriptor() ([]byte, []int) {
return file_service_user_proto_rawDescGZIP(), []int{3}
}
func (x *WxMiniLoginResp) GetUSN() string {
func (x *WxMiniLoginResp) GetUSN() int64 {
if x != nil {
return x.USN
}
return ""
return 0
}
func (x *WxMiniLoginResp) GetName() string {
@@ -242,7 +242,7 @@ type GetUserInfoReq struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
}
func (x *GetUserInfoReq) Reset() {
@@ -277,11 +277,11 @@ func (*GetUserInfoReq) Descriptor() ([]byte, []int) {
return file_service_user_proto_rawDescGZIP(), []int{4}
}
func (x *GetUserInfoReq) GetUSN() string {
func (x *GetUserInfoReq) GetUSN() int64 {
if x != nil {
return x.USN
}
return ""
return 0
}
type GetUserInfoResp struct {
@@ -289,7 +289,7 @@ type GetUserInfoResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
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"`
}
@@ -325,11 +325,11 @@ func (*GetUserInfoResp) Descriptor() ([]byte, []int) {
return file_service_user_proto_rawDescGZIP(), []int{5}
}
func (x *GetUserInfoResp) GetUSN() string {
func (x *GetUserInfoResp) GetUSN() int64 {
if x != nil {
return x.USN
}
return ""
return 0
}
func (x *GetUserInfoResp) GetName() string {
@@ -351,19 +351,19 @@ var file_service_user_proto_rawDesc = []byte{
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, 0x36,
0x0a, 0x0e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 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,
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, 0x24, 0x0a, 0x0e, 0x57, 0x78, 0x4d, 0x69, 0x6e, 0x69,
0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x37, 0x0a, 0x0f,
0x57, 0x78, 0x4d, 0x69, 0x6e, 0x69, 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,
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, 0x09, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x22, 0x37, 0x0a, 0x0f, 0x47, 0x65, 0x74,
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, 0x09, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x12,
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, 0xb9, 0x01, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x2f, 0x0a, 0x0a, 0x50,
0x68, 0x6f, 0x6e, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x0e, 0x2e, 0x50, 0x68, 0x6f, 0x6e,

View File

@@ -10,7 +10,7 @@ service Gateway {
}
message ToClientReq {
string USN = 1;
int64 USN = 1;
int32 MessageID = 2;
bytes Payload = 3;
}
@@ -19,7 +19,7 @@ message ToClientResp {
}
message KickUserReq {
string USN = 1;
int64 USN = 1;
}
message KickUserResp {

View File

@@ -6,47 +6,33 @@ import "google/api/annotations.proto";
service Qgdzs {
// 生成题目
rpc GenerateQuestion(GenerateQuestionReq) returns (GenerateQuestionResp) {
option (google.api.http) = {
post: "/qgdzs/auth/generate_question"
body: "*"
};
}
rpc GenerateQuestion(GenerateQuestionReq) returns (GenerateQuestionResp) {option (google.api.http) = {post: "/qgdzs/auth/generate_question" body: "*"};}
// ---------- 随机答题 ----------
// 获取题目
rpc GetQuestion(GetQuestionReq) returns (GetQuestionResp) {
option (google.api.http) = {
post: "/qgdzs/open/get_question"
body: "*"
};
}
// 获取具体的题目
rpc GetQuestionInfo(GetQuestionInfoReq) returns (GetQuestionInfoResp) {
option (google.api.http) = {
post: "/qgdzs/open/get_question_info"
body: "*"
};
}
rpc RandomGetQuestion(RandomGetQuestionReq) returns (RandomGetQuestionResp) {option (google.api.http) = {post: "/qgdzs/open/random/question" body: "*"};}
// 回答题目
rpc AnswerQuestion(AnswerQuestionReq) returns (AnswerQuestionResp) {
option (google.api.http) = {
post: "/qgdzs/open/answer_question"
body: "*"
};
}
rpc RandomAnswerQuestion(RandomAnswerQuestionReq) returns (RandomAnswerQuestionResp) {option (google.api.http) = {post: "/qgdzs/open/random/answer" body: "*"};}
// ---------- 类目答题 ----------
// 获取所有类目
rpc GetAllCategory(GetAllCategoryReq) returns (GetAllCategoryResp) {
option (google.api.http) = {
post: "/qgdzs/open/get_all_category"
body: "*"
};
}
rpc GetAllCategory(GetAllCategoryReq) returns (GetAllCategoryResp) {option (google.api.http) = {post: "/qgdzs/open/category/get_category" body: "*"};}
// 获取题目
rpc CategoryGetQuestion(CategoryGetQuestionReq) returns (CategoryGetQuestionResp) {option (google.api.http) = {post: "/qgdzs/open/category/question" body: "*"};}
// 回答题目
rpc CategoryAnswerQuestion(CategoryAnswerQuestionReq) returns (CategoryAnswerQuestionResp) {option (google.api.http) = {post: "/qgdzs/open/category/answer" body: "*"};}
// ---------- 快速答题 ----------
// 获取题目
rpc QuicklyGetQuestion(QuicklyGetQuestionReq) returns (QuicklyGetQuestionResp) {option (google.api.http) = {post: "/qgdzs/open/quickly/question" body: "*"};}
// 回答题目
rpc QuicklyAnswerQuestion(QuicklyAnswerQuestionReq) returns (QuicklyAnswerQuestionResp) {option (google.api.http) = {post: "/qgdzs/open/quickly/answer" body: "*"};}
// ---------- 答题记录 ----------
// 获取答题记录
rpc GetRecord(GetRecordReq) returns (GetRecordResp) {
option (google.api.http) = {
post: "/qgdzs/auth/get_record"
body: "*"
};
}
rpc GetRecord(GetRecordReq) returns (GetRecordResp) {option (google.api.http) = {post: "/qgdzs/auth/get_record" body: "*"};}
// 获取具体的题目
rpc GetQuestionInfo(GetQuestionInfoReq) returns (GetQuestionInfoResp) {option (google.api.http) = {post: "/qgdzs/open/get_question_info" body: "*"};}
}
// ---------- GenerateQuestion ----------
@@ -56,37 +42,24 @@ message GenerateQuestionReq {
message GenerateQuestionResp {
}
// ---------- GetQuestion ----------
message GetQuestionReq {
string CategorySn = 1 [json_name = "category_sn"]; // 类目唯一标识
// ---------- RandomGetQuestion ----------
message RandomGetQuestionReq {
}
message GetQuestionResp {
string Sn = 1 [json_name = "sn"]; // 题目唯一标识
message RandomGetQuestionResp {
int64 Sn = 1 [json_name = "sn"]; // 题目唯一标识
string Question = 2 [json_name = "question"]; // 题干
repeated string Options = 3 [json_name = "options"]; // 选项
string Category = 4 [json_name = "category"]; // 题目类型
int32 Difficulty = 5 [json_name = "difficulty"]; // 难度
}
// ---------- GetQuestionInfo ----------
message GetQuestionInfoReq {
string QuestionSn = 1 [json_name = "question_sn"]; // 题目唯一标识
}
message GetQuestionInfoResp {
string Question = 1 [json_name = "question"]; // 题干
repeated string Options = 2 [json_name = "options"]; // 选项
string Category = 3 [json_name = "category"]; // 类目
int32 Difficulty = 4 [json_name = "difficulty"]; // 难度
string Explanation = 5 [json_name = "explanation"]; // 解析
}
// ---------- AnswerQuestion ----------
message AnswerQuestionReq {
string USN = 1 [json_name = "usn"];
string Sn = 2 [json_name = "sn"]; // 题目唯一标识
// ---------- RandomAnswerQuestion ----------
message RandomAnswerQuestionReq {
int64 USN = 1 [json_name = "usn"];
int64 Sn = 2 [json_name = "sn"]; // 题目唯一标识
string Answer = 3 [json_name = "answer"]; // 答案
}
message AnswerQuestionResp {
message RandomAnswerQuestionResp {
string Answer = 1 [json_name = "answer"]; // 答案
string Explanation = 2 [json_name = "explanation"]; // 解析
}
@@ -98,13 +71,58 @@ message GetAllCategoryResp {
repeated GetAllCategoryItem Categories = 1 [json_name = "categories"]; // 类目
}
message GetAllCategoryItem {
string Sn = 1 [json_name = "sn"]; // 唯一标识
int64 Sn = 1 [json_name = "sn"]; // 唯一标识
string Category = 2 [json_name = "category"]; // 类目
}
// ---------- CategoryGetQuestion ----------
message CategoryGetQuestionReq {
int64 CategorySn = 1 [json_name = "category_sn"]; // 类目唯一标识
}
message CategoryGetQuestionResp {
int64 Sn = 1 [json_name = "sn"]; // 题目唯一标识
string Question = 2 [json_name = "question"]; // 题干
repeated string Options = 3 [json_name = "options"]; // 选项
string Category = 4 [json_name = "category"]; // 题目类型
int32 Difficulty = 5 [json_name = "difficulty"]; // 难度
}
// ---------- CategoryAnswerQuestion ----------
message CategoryAnswerQuestionReq {
int64 USN = 1 [json_name = "usn"];
int64 Sn = 2 [json_name = "sn"]; // 题目唯一标识
string Answer = 3 [json_name = "answer"]; // 答案
}
message CategoryAnswerQuestionResp {
string Answer = 1 [json_name = "answer"]; // 答案
string Explanation = 2 [json_name = "explanation"]; // 解析
}
// ---------- QuicklyGetQuestion ----------
message QuicklyGetQuestionReq {
}
message QuicklyGetQuestionResp {
int64 Sn = 1 [json_name = "sn"]; // 题目唯一标识
string Question = 2 [json_name = "question"]; // 题干
repeated string Options = 3 [json_name = "options"]; // 选项
string Category = 4 [json_name = "category"]; // 题目类型
int32 Difficulty = 5 [json_name = "difficulty"]; // 难度
}
// ---------- QuicklyAnswerQuestion ----------
message QuicklyAnswerQuestionReq {
int64 USN = 1 [json_name = "usn"];
int64 Sn = 2 [json_name = "sn"]; // 题目唯一标识
string Answer = 3 [json_name = "answer"]; // 答案
}
message QuicklyAnswerQuestionResp {
string Answer = 1 [json_name = "answer"]; // 答案
string Explanation = 2 [json_name = "explanation"]; // 解析
}
// ---------- GetRecord ----------
message GetRecordReq {
string USN = 1 [json_name = "usn"];
int64 USN = 1 [json_name = "usn"];
int32 Page = 2 [json_name = "page"];
int32 PageSize = 3 [json_name = "page_size"];
}
@@ -113,7 +131,7 @@ message GetRecordResp {
repeated GetRecordItem Records = 2 [json_name = "records"]; // 记录
}
message GetRecordItem {
string QuestionSn = 1 [json_name = "question_sn"]; // 题目唯一标识
int64 QuestionSn = 1 [json_name = "question_sn"]; // 题目唯一标识
string Question = 2 [json_name = "question"]; // 题干
int32 Difficulty = 3 [json_name = "difficulty"]; // 难度
string Category = 4 [json_name = "category"]; // 题目类型
@@ -121,3 +139,15 @@ message GetRecordItem {
string Answer = 6 [json_name = "answer"]; // 用户答案
int64 CreateTime = 7 [json_name = "create_time"]; // 创建时间
}
// ---------- GetQuestionInfo ----------
message GetQuestionInfoReq {
int64 QuestionSn = 1 [json_name = "question_sn"]; // 题目唯一标识
}
message GetQuestionInfoResp {
string Question = 1 [json_name = "question"]; // 题干
repeated string Options = 2 [json_name = "options"]; // 选项
string Category = 3 [json_name = "category"]; // 类目
int32 Difficulty = 4 [json_name = "difficulty"]; // 难度
string Explanation = 5 [json_name = "explanation"]; // 解析
}

View File

@@ -10,29 +10,29 @@ service Scene {
}
message EnterReq {
string USN = 1; // 用户ID
string GatewaySID = 2; // 网关服务ID
int64 USN = 1; // 用户ID
int64 GatewaySID = 2; // 网关服务ID
int32 InstanceID = 3; // 副本ID
}
message EnterResp {
string SceneSID = 1; // 场景服务ID
string UniqueNo = 2; // 副本唯一编号
int64 SceneSID = 1; // 场景服务ID
int64 UniqueNo = 2; // 副本唯一编号
int32 MessageID = 3; // 发送给客户端的消息ID
bytes Payload = 4; // 消息负载
}
message LeaveReq {
string USN = 1; // 用户ID
string UniqueNo = 2; // 副本唯一编号
int64 USN = 1; // 用户ID
int64 UniqueNo = 2; // 副本唯一编号
}
message LeaveResp {
}
message ActionReq {
string UniqueNo = 1; // 副本唯一编号
string USN = 2; // 用户ID
int64 UniqueNo = 1; // 副本唯一编号
int64 USN = 2; // 用户ID
int32 Action = 3; // 指令ID
sint32 DirX = 4; // 移动-X方向×1000 缩放)
sint32 DirY = 5; // 移动-Y方向×1000 缩放)

View File

@@ -8,12 +8,7 @@ service User {
rpc PhoneLogin(PhoneLoginReq) returns (PhoneLoginResp) {}
rpc WxMiniLogin(WxMiniLoginReq) returns (WxMiniLoginResp) {}
// 获取用户信息
rpc GetUserInfo(GetUserInfoReq) returns (GetUserInfoResp) {
option (google.api.http) = {
post: "/user/auth/info"
body: "*"
};
}
rpc GetUserInfo(GetUserInfoReq) returns (GetUserInfoResp) {option (google.api.http) = {post: "/user/auth/info" body: "*"};}
}
// ---------- PhoneLogin ----------
@@ -22,7 +17,7 @@ message PhoneLoginReq {
string Code = 2 [json_name = "code"]; // 验证码
}
message PhoneLoginResp {
string USN = 1 [json_name = "usn"]; // 用户ID
int64 USN = 1 [json_name = "usn"]; // 用户ID
string Name = 2 [json_name = "name"]; // 用户名
}
@@ -31,15 +26,15 @@ message WxMiniLoginReq {
string Code = 1 [json_name = "code"]; // 微信小程序登录凭证
}
message WxMiniLoginResp {
string USN = 1 [json_name = "usn"]; // 用户ID
int64 USN = 1 [json_name = "usn"]; // 用户ID
string Name = 2 [json_name = "name"]; // 用户名
}
// ---------- GetUserInfo ----------
message GetUserInfoReq {
string USN = 1 [json_name = "usn"];
int64 USN = 1 [json_name = "usn"];
}
message GetUserInfoResp {
string USN = 1 [json_name = "usn"];
int64 USN = 1 [json_name = "usn"];
string Name = 2 [json_name = "name"];
}

View File

@@ -28,7 +28,7 @@ public static partial class ActionReflection {
"bhIQCghTZXF1ZW5jZRgBIAEoDRIRCglUaW1lc3RhbXAYAiABKAMSGQoGQWN0",
"aW9uGAMgASgOMgkuQWN0aW9uSUQSDAoERGlyWBgEIAEoERIMCgREaXJZGAUg",
"ASgREg8KB1NraWxsSUQYBiABKAUiMQoMUG9zaXRpb25JbmZvEgsKA1VTThgB",
"IAEoCRIJCgFYGAIgASgREgkKAVkYAyABKBEiKwoMUzJDX1Bvc2l0aW9uEhsK",
"IAEoAxIJCgFYGAIgASgREgkKAVkYAyABKBEiKwoMUzJDX1Bvc2l0aW9uEhsK",
"BEluZm8YASADKAsyDS5Qb3NpdGlvbkluZm8qSwoIQWN0aW9uSUQSFQoRQUNU",
"SU9OX0lEX0lOVkFMSUQQABISCg5BQ1RJT05fSURfTU9WRRABEhQKEEFDVElP",
"Tl9JRF9BVFRBQ0sQAkI0WjJnaXQuaGxzcS5hc2lhL21tb3JwZy9zZXJ2aWNl",
@@ -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 string uSN_ = "";
private long uSN_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string USN {
public long USN {
get { return uSN_; }
set {
uSN_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
uSN_ = 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.Length != 0) hash ^= USN.GetHashCode();
if (USN != 0L) 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.Length != 0) {
output.WriteRawTag(10);
output.WriteString(USN);
if (USN != 0L) {
output.WriteRawTag(8);
output.WriteInt64(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.Length != 0) {
output.WriteRawTag(10);
output.WriteString(USN);
if (USN != 0L) {
output.WriteRawTag(8);
output.WriteInt64(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.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(USN);
if (USN != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(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.Length != 0) {
if (other.USN != 0L) {
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 10: {
USN = input.ReadString();
case 8: {
USN = input.ReadInt64();
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 10: {
USN = input.ReadString();
case 8: {
USN = input.ReadInt64();
break;
}
case 16: {

View File

@@ -259,7 +259,7 @@ type PositionInfo struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
USN string `protobuf:"bytes,1,opt,name=USN,proto3" json:"USN,omitempty"`
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"`
}
@@ -296,11 +296,11 @@ func (*PositionInfo) Descriptor() ([]byte, []int) {
return file_action_proto_rawDescGZIP(), []int{3}
}
func (x *PositionInfo) GetUSN() string {
func (x *PositionInfo) GetUSN() int64 {
if x != nil {
return x.USN
}
return ""
return 0
}
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, 0x09, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, 0x0c, 0x0a, 0x01,
0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 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,

View File

@@ -28,7 +28,7 @@ message C2S_Action {
// MESSAGE_ID_POSITION
message PositionInfo {
string USN = 1;
int64 USN = 1;
sint32 X = 2;
sint32 Y = 3;
}

View File

@@ -0,0 +1,10 @@
services:
dnsmasq:
image: 4km3/dnsmasq:2.90-r3-alpine-3.22.2
container_name: dnsmasq
restart: unless-stopped
ports:
- "53:53/udp"
- "53:53/tcp"
volumes:
- ./dnsmasq/dnsmasq.conf:/etc/dnsmasq.conf

View File

@@ -10,11 +10,11 @@ param(
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') {
if ($c -match '\bSn\s+int64\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`"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}"
$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}"
Set-Content $_.FullName ($c.TrimEnd() + $hook) -Encoding UTF8
}
}

View File

@@ -16,7 +16,7 @@ const TableNameCategory = "categories"
// Category mapped from table <categories>
type Category struct {
ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
Sn string `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号
Sn int64 `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号
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"`
@@ -30,8 +30,8 @@ func (*Category) TableName() string {
// Auto sn
func (m *Category) BeforeCreate(_ *gorm.DB) error {
if m.Sn == "" {
m.Sn = utils.SnowflakeInstance().Generate().String()
if m.Sn == 0 {
m.Sn = utils.SnowflakeInstance().Generate().Int64()
}
return nil
}

View File

@@ -0,0 +1,38 @@
// 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"
"git.hlsq.asia/mmorpg/service-common/utils"
"gorm.io/gorm"
)
const TableNamePointCard = "point_card"
// PointCard mapped from table <point_card>
type PointCard struct {
ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
Sn int64 `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号
UserSn int64 `gorm:"column:user_sn;not null;comment:用户-唯一编号" json:"user_sn"` // 用户-唯一编号
Point int64 `gorm:"column:point;not null;comment:积分" json:"point"` // 积分
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 PointCard's table name
func (*PointCard) TableName() string {
return TableNamePointCard
}
// Auto sn
func (m *PointCard) BeforeCreate(_ *gorm.DB) error {
if m.Sn == 0 {
m.Sn = utils.SnowflakeInstance().Generate().Int64()
}
return nil
}

View File

@@ -0,0 +1,46 @@
// 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"
"git.hlsq.asia/mmorpg/service-common/utils"
"gorm.io/gorm"
)
const TableNamePointRecord = "point_records"
// PointRecord mapped from table <point_records>
type PointRecord struct {
ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
Sn int64 `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号
UserSn int64 `gorm:"column:user_sn;not null;comment:用户-唯一编号" json:"user_sn"` // 用户-唯一编号
/*
来源:
0. 未知
1. 随机答题
2. 类目答题
3. 限时答题
*/
Source int32 `gorm:"column:source;not null;comment:来源:\n0. 未知\n1. 随机答题\n2. 类目答题\n3. 限时答题" json:"source"`
Point int64 `gorm:"column:point;not null;comment:积分" json:"point"` // 积分
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 PointRecord's table name
func (*PointRecord) TableName() string {
return TableNamePointRecord
}
// Auto sn
func (m *PointRecord) BeforeCreate(_ *gorm.DB) error {
if m.Sn == 0 {
m.Sn = utils.SnowflakeInstance().Generate().Int64()
}
return nil
}

View File

@@ -16,13 +16,13 @@ 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"` // 业务唯一编号
Sn int64 `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
CategorySn string `gorm:"column:category_sn;not null;comment:分类-唯一编号" json:"category_sn"` // 分类-唯一编号
CategorySn int64 `gorm:"column:category_sn;not null;comment:分类-唯一编号" json:"category_sn"` // 分类-唯一编号
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"`
@@ -35,8 +35,8 @@ func (*Question) TableName() string {
// Auto sn
func (m *Question) BeforeCreate(_ *gorm.DB) error {
if m.Sn == "" {
m.Sn = utils.SnowflakeInstance().Generate().String()
if m.Sn == 0 {
m.Sn = utils.SnowflakeInstance().Generate().Int64()
}
return nil
}

View File

@@ -16,9 +16,9 @@ const TableNameRecord = "records"
// Record mapped from table <records>
type Record struct {
ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
Sn string `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号
UserSn string `gorm:"column:user_sn;not null;comment:用户-唯一编号" json:"user_sn"` // 用户-唯一编号
QuestionSn string `gorm:"column:question_sn;not null;comment:题目-唯一编号" json:"question_sn"` // 题目-唯一编号
Sn int64 `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号
UserSn int64 `gorm:"column:user_sn;not null;comment:用户-唯一编号" json:"user_sn"` // 用户-唯一编号
QuestionSn int64 `gorm:"column:question_sn;not null;comment:题目-唯一编号" json:"question_sn"` // 题目-唯一编号
Answer string `gorm:"column:answer;not null;comment:答案" json:"answer"` // 答案
IsCorrect int32 `gorm:"column:is_correct;not null;comment:是否正确 0 否 1 是" json:"is_correct"` // 是否正确 0 否 1 是
CreatedAt time.Time `gorm:"column:created_at;not null" json:"created_at"`
@@ -33,8 +33,8 @@ func (*Record) TableName() string {
// Auto sn
func (m *Record) BeforeCreate(_ *gorm.DB) error {
if m.Sn == "" {
m.Sn = utils.SnowflakeInstance().Generate().String()
if m.Sn == 0 {
m.Sn = utils.SnowflakeInstance().Generate().Int64()
}
return nil
}

View File

@@ -28,7 +28,7 @@ func newCategory(db *gorm.DB, opts ...gen.DOOption) category {
tableName := _category.categoryDo.TableName()
_category.ALL = field.NewAsterisk(tableName)
_category.ID = field.NewUint64(tableName, "id")
_category.Sn = field.NewString(tableName, "sn")
_category.Sn = field.NewInt64(tableName, "sn")
_category.Category = field.NewString(tableName, "category")
_category.CreatedAt = field.NewTime(tableName, "created_at")
_category.UpdatedAt = field.NewTime(tableName, "updated_at")
@@ -44,7 +44,7 @@ type category struct {
ALL field.Asterisk
ID field.Uint64
Sn field.String // 业务唯一编号
Sn field.Int64 // 业务唯一编号
Category field.String // 分类
CreatedAt field.Time
UpdatedAt field.Time
@@ -66,7 +66,7 @@ func (c category) As(alias string) *category {
func (c *category) updateTableName(table string) *category {
c.ALL = field.NewAsterisk(table)
c.ID = field.NewUint64(table, "id")
c.Sn = field.NewString(table, "sn")
c.Sn = field.NewInt64(table, "sn")
c.Category = field.NewString(table, "category")
c.CreatedAt = field.NewTime(table, "created_at")
c.UpdatedAt = field.NewTime(table, "updated_at")

View File

@@ -19,6 +19,8 @@ func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
return &Query{
db: db,
Category: newCategory(db, opts...),
PointCard: newPointCard(db, opts...),
PointRecord: newPointRecord(db, opts...),
Question: newQuestion(db, opts...),
Record: newRecord(db, opts...),
}
@@ -28,6 +30,8 @@ type Query struct {
db *gorm.DB
Category category
PointCard pointCard
PointRecord pointRecord
Question question
Record record
}
@@ -38,6 +42,8 @@ func (q *Query) clone(db *gorm.DB) *Query {
return &Query{
db: db,
Category: q.Category.clone(db),
PointCard: q.PointCard.clone(db),
PointRecord: q.PointRecord.clone(db),
Question: q.Question.clone(db),
Record: q.Record.clone(db),
}
@@ -55,6 +61,8 @@ func (q *Query) ReplaceDB(db *gorm.DB) *Query {
return &Query{
db: db,
Category: q.Category.replaceDB(db),
PointCard: q.PointCard.replaceDB(db),
PointRecord: q.PointRecord.replaceDB(db),
Question: q.Question.replaceDB(db),
Record: q.Record.replaceDB(db),
}
@@ -62,6 +70,8 @@ func (q *Query) ReplaceDB(db *gorm.DB) *Query {
type queryCtx struct {
Category *categoryDo
PointCard *pointCardDo
PointRecord *pointRecordDo
Question *questionDo
Record *recordDo
}
@@ -69,6 +79,8 @@ type queryCtx struct {
func (q *Query) WithContext(ctx context.Context) *queryCtx {
return &queryCtx{
Category: q.Category.WithContext(ctx),
PointCard: q.PointCard.WithContext(ctx),
PointRecord: q.PointRecord.WithContext(ctx),
Question: q.Question.WithContext(ctx),
Record: q.Record.WithContext(ctx),
}

View File

@@ -0,0 +1,353 @@
// 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/qgdzs_db/model"
)
func newPointCard(db *gorm.DB, opts ...gen.DOOption) pointCard {
_pointCard := pointCard{}
_pointCard.pointCardDo.UseDB(db, opts...)
_pointCard.pointCardDo.UseModel(&model.PointCard{})
tableName := _pointCard.pointCardDo.TableName()
_pointCard.ALL = field.NewAsterisk(tableName)
_pointCard.ID = field.NewUint64(tableName, "id")
_pointCard.Sn = field.NewInt64(tableName, "sn")
_pointCard.UserSn = field.NewInt64(tableName, "user_sn")
_pointCard.Point = field.NewInt64(tableName, "point")
_pointCard.CreatedAt = field.NewTime(tableName, "created_at")
_pointCard.UpdatedAt = field.NewTime(tableName, "updated_at")
_pointCard.DeletedAt = field.NewField(tableName, "deleted_at")
_pointCard.fillFieldMap()
return _pointCard
}
type pointCard struct {
pointCardDo pointCardDo
ALL field.Asterisk
ID field.Uint64
Sn field.Int64 // 业务唯一编号
UserSn field.Int64 // 用户-唯一编号
Point field.Int64 // 积分
CreatedAt field.Time
UpdatedAt field.Time
DeletedAt field.Field
fieldMap map[string]field.Expr
}
func (p pointCard) Table(newTableName string) *pointCard {
p.pointCardDo.UseTable(newTableName)
return p.updateTableName(newTableName)
}
func (p pointCard) As(alias string) *pointCard {
p.pointCardDo.DO = *(p.pointCardDo.As(alias).(*gen.DO))
return p.updateTableName(alias)
}
func (p *pointCard) updateTableName(table string) *pointCard {
p.ALL = field.NewAsterisk(table)
p.ID = field.NewUint64(table, "id")
p.Sn = field.NewInt64(table, "sn")
p.UserSn = field.NewInt64(table, "user_sn")
p.Point = field.NewInt64(table, "point")
p.CreatedAt = field.NewTime(table, "created_at")
p.UpdatedAt = field.NewTime(table, "updated_at")
p.DeletedAt = field.NewField(table, "deleted_at")
p.fillFieldMap()
return p
}
func (p *pointCard) WithContext(ctx context.Context) *pointCardDo {
return p.pointCardDo.WithContext(ctx)
}
func (p pointCard) TableName() string { return p.pointCardDo.TableName() }
func (p pointCard) Alias() string { return p.pointCardDo.Alias() }
func (p pointCard) Columns(cols ...field.Expr) gen.Columns { return p.pointCardDo.Columns(cols...) }
func (p *pointCard) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
_f, ok := p.fieldMap[fieldName]
if !ok || _f == nil {
return nil, false
}
_oe, ok := _f.(field.OrderExpr)
return _oe, ok
}
func (p *pointCard) fillFieldMap() {
p.fieldMap = make(map[string]field.Expr, 7)
p.fieldMap["id"] = p.ID
p.fieldMap["sn"] = p.Sn
p.fieldMap["user_sn"] = p.UserSn
p.fieldMap["point"] = p.Point
p.fieldMap["created_at"] = p.CreatedAt
p.fieldMap["updated_at"] = p.UpdatedAt
p.fieldMap["deleted_at"] = p.DeletedAt
}
func (p pointCard) clone(db *gorm.DB) pointCard {
p.pointCardDo.ReplaceConnPool(db.Statement.ConnPool)
return p
}
func (p pointCard) replaceDB(db *gorm.DB) pointCard {
p.pointCardDo.ReplaceDB(db)
return p
}
type pointCardDo struct{ gen.DO }
func (p pointCardDo) Debug() *pointCardDo {
return p.withDO(p.DO.Debug())
}
func (p pointCardDo) WithContext(ctx context.Context) *pointCardDo {
return p.withDO(p.DO.WithContext(ctx))
}
func (p pointCardDo) ReadDB() *pointCardDo {
return p.Clauses(dbresolver.Read)
}
func (p pointCardDo) WriteDB() *pointCardDo {
return p.Clauses(dbresolver.Write)
}
func (p pointCardDo) Session(config *gorm.Session) *pointCardDo {
return p.withDO(p.DO.Session(config))
}
func (p pointCardDo) Clauses(conds ...clause.Expression) *pointCardDo {
return p.withDO(p.DO.Clauses(conds...))
}
func (p pointCardDo) Returning(value interface{}, columns ...string) *pointCardDo {
return p.withDO(p.DO.Returning(value, columns...))
}
func (p pointCardDo) Not(conds ...gen.Condition) *pointCardDo {
return p.withDO(p.DO.Not(conds...))
}
func (p pointCardDo) Or(conds ...gen.Condition) *pointCardDo {
return p.withDO(p.DO.Or(conds...))
}
func (p pointCardDo) Select(conds ...field.Expr) *pointCardDo {
return p.withDO(p.DO.Select(conds...))
}
func (p pointCardDo) Where(conds ...gen.Condition) *pointCardDo {
return p.withDO(p.DO.Where(conds...))
}
func (p pointCardDo) Order(conds ...field.Expr) *pointCardDo {
return p.withDO(p.DO.Order(conds...))
}
func (p pointCardDo) Distinct(cols ...field.Expr) *pointCardDo {
return p.withDO(p.DO.Distinct(cols...))
}
func (p pointCardDo) Omit(cols ...field.Expr) *pointCardDo {
return p.withDO(p.DO.Omit(cols...))
}
func (p pointCardDo) Join(table schema.Tabler, on ...field.Expr) *pointCardDo {
return p.withDO(p.DO.Join(table, on...))
}
func (p pointCardDo) LeftJoin(table schema.Tabler, on ...field.Expr) *pointCardDo {
return p.withDO(p.DO.LeftJoin(table, on...))
}
func (p pointCardDo) RightJoin(table schema.Tabler, on ...field.Expr) *pointCardDo {
return p.withDO(p.DO.RightJoin(table, on...))
}
func (p pointCardDo) Group(cols ...field.Expr) *pointCardDo {
return p.withDO(p.DO.Group(cols...))
}
func (p pointCardDo) Having(conds ...gen.Condition) *pointCardDo {
return p.withDO(p.DO.Having(conds...))
}
func (p pointCardDo) Limit(limit int) *pointCardDo {
return p.withDO(p.DO.Limit(limit))
}
func (p pointCardDo) Offset(offset int) *pointCardDo {
return p.withDO(p.DO.Offset(offset))
}
func (p pointCardDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *pointCardDo {
return p.withDO(p.DO.Scopes(funcs...))
}
func (p pointCardDo) Unscoped() *pointCardDo {
return p.withDO(p.DO.Unscoped())
}
func (p pointCardDo) Create(values ...*model.PointCard) error {
if len(values) == 0 {
return nil
}
return p.DO.Create(values)
}
func (p pointCardDo) CreateInBatches(values []*model.PointCard, batchSize int) error {
return p.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 (p pointCardDo) Save(values ...*model.PointCard) error {
if len(values) == 0 {
return nil
}
return p.DO.Save(values)
}
func (p pointCardDo) First() (*model.PointCard, error) {
if result, err := p.DO.First(); err != nil {
return nil, err
} else {
return result.(*model.PointCard), nil
}
}
func (p pointCardDo) Take() (*model.PointCard, error) {
if result, err := p.DO.Take(); err != nil {
return nil, err
} else {
return result.(*model.PointCard), nil
}
}
func (p pointCardDo) Last() (*model.PointCard, error) {
if result, err := p.DO.Last(); err != nil {
return nil, err
} else {
return result.(*model.PointCard), nil
}
}
func (p pointCardDo) Find() ([]*model.PointCard, error) {
result, err := p.DO.Find()
return result.([]*model.PointCard), err
}
func (p pointCardDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.PointCard, err error) {
buf := make([]*model.PointCard, 0, batchSize)
err = p.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 (p pointCardDo) FindInBatches(result *[]*model.PointCard, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return p.DO.FindInBatches(result, batchSize, fc)
}
func (p pointCardDo) Attrs(attrs ...field.AssignExpr) *pointCardDo {
return p.withDO(p.DO.Attrs(attrs...))
}
func (p pointCardDo) Assign(attrs ...field.AssignExpr) *pointCardDo {
return p.withDO(p.DO.Assign(attrs...))
}
func (p pointCardDo) Joins(fields ...field.RelationField) *pointCardDo {
for _, _f := range fields {
p = *p.withDO(p.DO.Joins(_f))
}
return &p
}
func (p pointCardDo) Preload(fields ...field.RelationField) *pointCardDo {
for _, _f := range fields {
p = *p.withDO(p.DO.Preload(_f))
}
return &p
}
func (p pointCardDo) FirstOrInit() (*model.PointCard, error) {
if result, err := p.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*model.PointCard), nil
}
}
func (p pointCardDo) FirstOrCreate() (*model.PointCard, error) {
if result, err := p.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*model.PointCard), nil
}
}
func (p pointCardDo) FindByPage(offset int, limit int) (result []*model.PointCard, count int64, err error) {
result, err = p.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 = p.Offset(-1).Limit(-1).Count()
return
}
func (p pointCardDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
count, err = p.Count()
if err != nil {
return
}
err = p.Offset(offset).Limit(limit).Scan(result)
return
}
func (p pointCardDo) Scan(result interface{}) (err error) {
return p.DO.Scan(result)
}
func (p pointCardDo) Delete(models ...*model.PointCard) (result gen.ResultInfo, err error) {
return p.DO.Delete(models)
}
func (p *pointCardDo) withDO(do gen.Dao) *pointCardDo {
p.DO = *do.(*gen.DO)
return p
}

View File

@@ -0,0 +1,364 @@
// 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/qgdzs_db/model"
)
func newPointRecord(db *gorm.DB, opts ...gen.DOOption) pointRecord {
_pointRecord := pointRecord{}
_pointRecord.pointRecordDo.UseDB(db, opts...)
_pointRecord.pointRecordDo.UseModel(&model.PointRecord{})
tableName := _pointRecord.pointRecordDo.TableName()
_pointRecord.ALL = field.NewAsterisk(tableName)
_pointRecord.ID = field.NewUint64(tableName, "id")
_pointRecord.Sn = field.NewInt64(tableName, "sn")
_pointRecord.UserSn = field.NewInt64(tableName, "user_sn")
_pointRecord.Source = field.NewInt32(tableName, "source")
_pointRecord.Point = field.NewInt64(tableName, "point")
_pointRecord.CreatedAt = field.NewTime(tableName, "created_at")
_pointRecord.UpdatedAt = field.NewTime(tableName, "updated_at")
_pointRecord.DeletedAt = field.NewField(tableName, "deleted_at")
_pointRecord.fillFieldMap()
return _pointRecord
}
type pointRecord struct {
pointRecordDo pointRecordDo
ALL field.Asterisk
ID field.Uint64
Sn field.Int64 // 业务唯一编号
UserSn field.Int64 // 用户-唯一编号
/*
来源:
0. 未知
1. 随机答题
2. 类目答题
3. 限时答题
*/
Source field.Int32
Point field.Int64 // 积分
CreatedAt field.Time
UpdatedAt field.Time
DeletedAt field.Field
fieldMap map[string]field.Expr
}
func (p pointRecord) Table(newTableName string) *pointRecord {
p.pointRecordDo.UseTable(newTableName)
return p.updateTableName(newTableName)
}
func (p pointRecord) As(alias string) *pointRecord {
p.pointRecordDo.DO = *(p.pointRecordDo.As(alias).(*gen.DO))
return p.updateTableName(alias)
}
func (p *pointRecord) updateTableName(table string) *pointRecord {
p.ALL = field.NewAsterisk(table)
p.ID = field.NewUint64(table, "id")
p.Sn = field.NewInt64(table, "sn")
p.UserSn = field.NewInt64(table, "user_sn")
p.Source = field.NewInt32(table, "source")
p.Point = field.NewInt64(table, "point")
p.CreatedAt = field.NewTime(table, "created_at")
p.UpdatedAt = field.NewTime(table, "updated_at")
p.DeletedAt = field.NewField(table, "deleted_at")
p.fillFieldMap()
return p
}
func (p *pointRecord) WithContext(ctx context.Context) *pointRecordDo {
return p.pointRecordDo.WithContext(ctx)
}
func (p pointRecord) TableName() string { return p.pointRecordDo.TableName() }
func (p pointRecord) Alias() string { return p.pointRecordDo.Alias() }
func (p pointRecord) Columns(cols ...field.Expr) gen.Columns { return p.pointRecordDo.Columns(cols...) }
func (p *pointRecord) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
_f, ok := p.fieldMap[fieldName]
if !ok || _f == nil {
return nil, false
}
_oe, ok := _f.(field.OrderExpr)
return _oe, ok
}
func (p *pointRecord) fillFieldMap() {
p.fieldMap = make(map[string]field.Expr, 8)
p.fieldMap["id"] = p.ID
p.fieldMap["sn"] = p.Sn
p.fieldMap["user_sn"] = p.UserSn
p.fieldMap["source"] = p.Source
p.fieldMap["point"] = p.Point
p.fieldMap["created_at"] = p.CreatedAt
p.fieldMap["updated_at"] = p.UpdatedAt
p.fieldMap["deleted_at"] = p.DeletedAt
}
func (p pointRecord) clone(db *gorm.DB) pointRecord {
p.pointRecordDo.ReplaceConnPool(db.Statement.ConnPool)
return p
}
func (p pointRecord) replaceDB(db *gorm.DB) pointRecord {
p.pointRecordDo.ReplaceDB(db)
return p
}
type pointRecordDo struct{ gen.DO }
func (p pointRecordDo) Debug() *pointRecordDo {
return p.withDO(p.DO.Debug())
}
func (p pointRecordDo) WithContext(ctx context.Context) *pointRecordDo {
return p.withDO(p.DO.WithContext(ctx))
}
func (p pointRecordDo) ReadDB() *pointRecordDo {
return p.Clauses(dbresolver.Read)
}
func (p pointRecordDo) WriteDB() *pointRecordDo {
return p.Clauses(dbresolver.Write)
}
func (p pointRecordDo) Session(config *gorm.Session) *pointRecordDo {
return p.withDO(p.DO.Session(config))
}
func (p pointRecordDo) Clauses(conds ...clause.Expression) *pointRecordDo {
return p.withDO(p.DO.Clauses(conds...))
}
func (p pointRecordDo) Returning(value interface{}, columns ...string) *pointRecordDo {
return p.withDO(p.DO.Returning(value, columns...))
}
func (p pointRecordDo) Not(conds ...gen.Condition) *pointRecordDo {
return p.withDO(p.DO.Not(conds...))
}
func (p pointRecordDo) Or(conds ...gen.Condition) *pointRecordDo {
return p.withDO(p.DO.Or(conds...))
}
func (p pointRecordDo) Select(conds ...field.Expr) *pointRecordDo {
return p.withDO(p.DO.Select(conds...))
}
func (p pointRecordDo) Where(conds ...gen.Condition) *pointRecordDo {
return p.withDO(p.DO.Where(conds...))
}
func (p pointRecordDo) Order(conds ...field.Expr) *pointRecordDo {
return p.withDO(p.DO.Order(conds...))
}
func (p pointRecordDo) Distinct(cols ...field.Expr) *pointRecordDo {
return p.withDO(p.DO.Distinct(cols...))
}
func (p pointRecordDo) Omit(cols ...field.Expr) *pointRecordDo {
return p.withDO(p.DO.Omit(cols...))
}
func (p pointRecordDo) Join(table schema.Tabler, on ...field.Expr) *pointRecordDo {
return p.withDO(p.DO.Join(table, on...))
}
func (p pointRecordDo) LeftJoin(table schema.Tabler, on ...field.Expr) *pointRecordDo {
return p.withDO(p.DO.LeftJoin(table, on...))
}
func (p pointRecordDo) RightJoin(table schema.Tabler, on ...field.Expr) *pointRecordDo {
return p.withDO(p.DO.RightJoin(table, on...))
}
func (p pointRecordDo) Group(cols ...field.Expr) *pointRecordDo {
return p.withDO(p.DO.Group(cols...))
}
func (p pointRecordDo) Having(conds ...gen.Condition) *pointRecordDo {
return p.withDO(p.DO.Having(conds...))
}
func (p pointRecordDo) Limit(limit int) *pointRecordDo {
return p.withDO(p.DO.Limit(limit))
}
func (p pointRecordDo) Offset(offset int) *pointRecordDo {
return p.withDO(p.DO.Offset(offset))
}
func (p pointRecordDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *pointRecordDo {
return p.withDO(p.DO.Scopes(funcs...))
}
func (p pointRecordDo) Unscoped() *pointRecordDo {
return p.withDO(p.DO.Unscoped())
}
func (p pointRecordDo) Create(values ...*model.PointRecord) error {
if len(values) == 0 {
return nil
}
return p.DO.Create(values)
}
func (p pointRecordDo) CreateInBatches(values []*model.PointRecord, batchSize int) error {
return p.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 (p pointRecordDo) Save(values ...*model.PointRecord) error {
if len(values) == 0 {
return nil
}
return p.DO.Save(values)
}
func (p pointRecordDo) First() (*model.PointRecord, error) {
if result, err := p.DO.First(); err != nil {
return nil, err
} else {
return result.(*model.PointRecord), nil
}
}
func (p pointRecordDo) Take() (*model.PointRecord, error) {
if result, err := p.DO.Take(); err != nil {
return nil, err
} else {
return result.(*model.PointRecord), nil
}
}
func (p pointRecordDo) Last() (*model.PointRecord, error) {
if result, err := p.DO.Last(); err != nil {
return nil, err
} else {
return result.(*model.PointRecord), nil
}
}
func (p pointRecordDo) Find() ([]*model.PointRecord, error) {
result, err := p.DO.Find()
return result.([]*model.PointRecord), err
}
func (p pointRecordDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.PointRecord, err error) {
buf := make([]*model.PointRecord, 0, batchSize)
err = p.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 (p pointRecordDo) FindInBatches(result *[]*model.PointRecord, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return p.DO.FindInBatches(result, batchSize, fc)
}
func (p pointRecordDo) Attrs(attrs ...field.AssignExpr) *pointRecordDo {
return p.withDO(p.DO.Attrs(attrs...))
}
func (p pointRecordDo) Assign(attrs ...field.AssignExpr) *pointRecordDo {
return p.withDO(p.DO.Assign(attrs...))
}
func (p pointRecordDo) Joins(fields ...field.RelationField) *pointRecordDo {
for _, _f := range fields {
p = *p.withDO(p.DO.Joins(_f))
}
return &p
}
func (p pointRecordDo) Preload(fields ...field.RelationField) *pointRecordDo {
for _, _f := range fields {
p = *p.withDO(p.DO.Preload(_f))
}
return &p
}
func (p pointRecordDo) FirstOrInit() (*model.PointRecord, error) {
if result, err := p.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*model.PointRecord), nil
}
}
func (p pointRecordDo) FirstOrCreate() (*model.PointRecord, error) {
if result, err := p.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*model.PointRecord), nil
}
}
func (p pointRecordDo) FindByPage(offset int, limit int) (result []*model.PointRecord, count int64, err error) {
result, err = p.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 = p.Offset(-1).Limit(-1).Count()
return
}
func (p pointRecordDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
count, err = p.Count()
if err != nil {
return
}
err = p.Offset(offset).Limit(limit).Scan(result)
return
}
func (p pointRecordDo) Scan(result interface{}) (err error) {
return p.DO.Scan(result)
}
func (p pointRecordDo) Delete(models ...*model.PointRecord) (result gen.ResultInfo, err error) {
return p.DO.Delete(models)
}
func (p *pointRecordDo) withDO(do gen.Dao) *pointRecordDo {
p.DO = *do.(*gen.DO)
return p
}

View File

@@ -28,13 +28,13 @@ func newQuestion(db *gorm.DB, opts ...gen.DOOption) question {
tableName := _question.questionDo.TableName()
_question.ALL = field.NewAsterisk(tableName)
_question.ID = field.NewUint64(tableName, "id")
_question.Sn = field.NewString(tableName, "sn")
_question.Sn = field.NewInt64(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.CategorySn = field.NewString(tableName, "category_sn")
_question.CategorySn = field.NewInt64(tableName, "category_sn")
_question.CreatedAt = field.NewTime(tableName, "created_at")
_question.UpdatedAt = field.NewTime(tableName, "updated_at")
_question.DeletedAt = field.NewField(tableName, "deleted_at")
@@ -49,13 +49,13 @@ type question struct {
ALL field.Asterisk
ID field.Uint64
Sn field.String // 业务唯一编号
Sn field.Int64 // 业务唯一编号
Question field.String // 题干
Options field.String // 选项
Answer field.String // 答案
Explanation field.String // 解析
Difficulty field.Int32 // 难度分 0 - 100
CategorySn field.String // 分类-唯一编号
CategorySn field.Int64 // 分类-唯一编号
CreatedAt field.Time
UpdatedAt field.Time
DeletedAt field.Field
@@ -76,13 +76,13 @@ func (q question) As(alias string) *question {
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.Sn = field.NewInt64(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.CategorySn = field.NewString(table, "category_sn")
q.CategorySn = field.NewInt64(table, "category_sn")
q.CreatedAt = field.NewTime(table, "created_at")
q.UpdatedAt = field.NewTime(table, "updated_at")
q.DeletedAt = field.NewField(table, "deleted_at")

View File

@@ -28,9 +28,9 @@ func newRecord(db *gorm.DB, opts ...gen.DOOption) record {
tableName := _record.recordDo.TableName()
_record.ALL = field.NewAsterisk(tableName)
_record.ID = field.NewUint64(tableName, "id")
_record.Sn = field.NewString(tableName, "sn")
_record.UserSn = field.NewString(tableName, "user_sn")
_record.QuestionSn = field.NewString(tableName, "question_sn")
_record.Sn = field.NewInt64(tableName, "sn")
_record.UserSn = field.NewInt64(tableName, "user_sn")
_record.QuestionSn = field.NewInt64(tableName, "question_sn")
_record.Answer = field.NewString(tableName, "answer")
_record.IsCorrect = field.NewInt32(tableName, "is_correct")
_record.CreatedAt = field.NewTime(tableName, "created_at")
@@ -47,9 +47,9 @@ type record struct {
ALL field.Asterisk
ID field.Uint64
Sn field.String // 业务唯一编号
UserSn field.String // 用户-唯一编号
QuestionSn field.String // 题目-唯一编号
Sn field.Int64 // 业务唯一编号
UserSn field.Int64 // 用户-唯一编号
QuestionSn field.Int64 // 题目-唯一编号
Answer field.String // 答案
IsCorrect field.Int32 // 是否正确 0 否 1 是
CreatedAt field.Time
@@ -72,9 +72,9 @@ func (r record) As(alias string) *record {
func (r *record) updateTableName(table string) *record {
r.ALL = field.NewAsterisk(table)
r.ID = field.NewUint64(table, "id")
r.Sn = field.NewString(table, "sn")
r.UserSn = field.NewString(table, "user_sn")
r.QuestionSn = field.NewString(table, "question_sn")
r.Sn = field.NewInt64(table, "sn")
r.UserSn = field.NewInt64(table, "user_sn")
r.QuestionSn = field.NewInt64(table, "question_sn")
r.Answer = field.NewString(table, "answer")
r.IsCorrect = field.NewInt32(table, "is_correct")
r.CreatedAt = field.NewTime(table, "created_at")

View File

@@ -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 string `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号
Sn int64 `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号
Name string `gorm:"column:name;not null" json:"name"`
Phone string `gorm:"column:phone" json:"phone"`
WxUnionID string `gorm:"column:wx_union_id;comment:微信用户唯一标识" json:"wx_union_id"` // 微信用户唯一标识
@@ -33,8 +33,8 @@ func (*User) TableName() string {
// Auto sn
func (m *User) BeforeCreate(_ *gorm.DB) error {
if m.Sn == "" {
m.Sn = utils.SnowflakeInstance().Generate().String()
if m.Sn == 0 {
m.Sn = utils.SnowflakeInstance().Generate().Int64()
}
return nil
}

View File

@@ -28,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.NewString(tableName, "sn")
_user.Sn = field.NewInt64(tableName, "sn")
_user.Name = field.NewString(tableName, "name")
_user.Phone = field.NewString(tableName, "phone")
_user.WxUnionID = field.NewString(tableName, "wx_union_id")
@@ -47,7 +47,7 @@ type user struct {
ALL field.Asterisk
ID field.Uint64
Sn field.String // 业务唯一编号
Sn field.Int64 // 业务唯一编号
Name field.String
Phone field.String
WxUnionID field.String // 微信用户唯一标识
@@ -72,7 +72,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.NewString(table, "sn")
u.Sn = field.NewInt64(table, "sn")
u.Name = field.NewString(table, "name")
u.Phone = field.NewString(table, "phone")
u.WxUnionID = field.NewString(table, "wx_union_id")