123 lines
3.9 KiB
Protocol Buffer
123 lines
3.9 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
option go_package = "git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb";
|
|
import "rs_common.proto";
|
|
import "google/api/annotations.proto";
|
|
|
|
service Qgdzs {
|
|
// 生成题目
|
|
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 AnswerQuestion(AnswerQuestionReq) returns (AnswerQuestionResp) {
|
|
option (google.api.http) = {
|
|
post: "/qgdzs/open/answer_question"
|
|
body: "*"
|
|
};
|
|
}
|
|
// 获取所有类目
|
|
rpc GetAllCategory(GetAllCategoryReq) returns (GetAllCategoryResp) {
|
|
option (google.api.http) = {
|
|
post: "/qgdzs/open/get_all_category"
|
|
body: "*"
|
|
};
|
|
}
|
|
// 获取答题记录
|
|
rpc GetRecord(GetRecordReq) returns (GetRecordResp) {
|
|
option (google.api.http) = {
|
|
post: "/qgdzs/auth/get_record"
|
|
body: "*"
|
|
};
|
|
}
|
|
}
|
|
|
|
// ---------- GenerateQuestion ----------
|
|
message GenerateQuestionReq {
|
|
int32 Num = 1 [json_name = "num"]; // 生成数量
|
|
}
|
|
message GenerateQuestionResp {
|
|
}
|
|
|
|
// ---------- GetQuestion ----------
|
|
message GetQuestionReq {
|
|
string CategorySn = 1 [json_name = "category_sn"]; // 类目唯一标识
|
|
}
|
|
message GetQuestionResp {
|
|
string 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"]; // 题目唯一标识
|
|
string Answer = 3 [json_name = "answer"]; // 答案
|
|
}
|
|
message AnswerQuestionResp {
|
|
string Answer = 1 [json_name = "answer"]; // 答案
|
|
string Explanation = 2 [json_name = "explanation"]; // 解析
|
|
}
|
|
|
|
// ---------- GetAllCategory ----------
|
|
message GetAllCategoryReq {
|
|
}
|
|
message GetAllCategoryResp {
|
|
repeated GetAllCategoryItem Categories = 1 [json_name = "categories"]; // 类目
|
|
}
|
|
message GetAllCategoryItem {
|
|
string Sn = 1 [json_name = "sn"]; // 唯一标识
|
|
string Category = 2 [json_name = "category"]; // 类目
|
|
}
|
|
|
|
// ---------- GetRecord ----------
|
|
message GetRecordReq {
|
|
string USN = 1 [json_name = "usn"];
|
|
int32 Page = 2 [json_name = "page"];
|
|
int32 PageSize = 3 [json_name = "page_size"];
|
|
}
|
|
message GetRecordResp {
|
|
int32 Count = 1 [json_name = "count"]; // 总数
|
|
repeated GetRecordItem Records = 2 [json_name = "records"]; // 记录
|
|
}
|
|
message GetRecordItem {
|
|
string QuestionSn = 1 [json_name = "question_sn"]; // 题目唯一标识
|
|
string Question = 2 [json_name = "question"]; // 题干
|
|
int32 Difficulty = 3 [json_name = "difficulty"]; // 难度
|
|
string Category = 4 [json_name = "category"]; // 题目类型
|
|
string QuestionAnswer = 5 [json_name = "question_answer"]; // 题目答案
|
|
string Answer = 6 [json_name = "answer"]; // 用户答案
|
|
int64 CreateTime = 7 [json_name = "create_time"]; // 创建时间
|
|
} |