153 lines
6.3 KiB
Protocol Buffer
153 lines
6.3 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 RandomGetQuestion(RandomGetQuestionReq) returns (RandomGetQuestionResp) {option (google.api.http) = {post: "/qgdzs/open/random/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/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 GetQuestionInfo(GetQuestionInfoReq) returns (GetQuestionInfoResp) {option (google.api.http) = {post: "/qgdzs/open/get_question_info" body: "*"};}
|
|
}
|
|
|
|
// ---------- GenerateQuestion ----------
|
|
message GenerateQuestionReq {
|
|
int32 Num = 1 [json_name = "num"]; // 生成数量
|
|
}
|
|
message GenerateQuestionResp {
|
|
}
|
|
|
|
// ---------- RandomGetQuestion ----------
|
|
message RandomGetQuestionReq {
|
|
}
|
|
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"]; // 难度
|
|
}
|
|
|
|
// ---------- RandomAnswerQuestion ----------
|
|
message RandomAnswerQuestionReq {
|
|
int64 USN = 1 [json_name = "usn"];
|
|
int64 Sn = 2 [json_name = "sn"]; // 题目唯一标识
|
|
string Answer = 3 [json_name = "answer"]; // 答案
|
|
}
|
|
message RandomAnswerQuestionResp {
|
|
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 {
|
|
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 {
|
|
int64 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 {
|
|
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"]; // 题目类型
|
|
string QuestionAnswer = 5 [json_name = "question_answer"]; // 题目答案
|
|
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"]; // 解析
|
|
} |