ok
This commit is contained in:
28
proto/answer.proto
Normal file
28
proto/answer.proto
Normal file
@@ -0,0 +1,28 @@
|
||||
syntax = "proto3";
|
||||
package survey;
|
||||
option go_package = ".;survey";
|
||||
import "blocks.proto";
|
||||
|
||||
// 问卷服务 - 答卷管理
|
||||
service Answer {
|
||||
rpc Submit (SubmitAnswerRequest) returns (StatusReply);
|
||||
rpc BySurvey (IdentRequest) returns (ListAnswerReply);
|
||||
}
|
||||
|
||||
message SubmitAnswerRequest {
|
||||
string survey_id = 1;
|
||||
string owner_id = 2; // 答题者ID
|
||||
repeated AnswerItem answer = 3; // 答题
|
||||
string ip_address = 4;
|
||||
string user_agent = 5;
|
||||
}
|
||||
|
||||
message AnswerItem {
|
||||
string question_id = 1;
|
||||
repeated string answer = 2;
|
||||
}
|
||||
|
||||
message ListAnswerReply {
|
||||
repeated AnswerItem data = 1;
|
||||
int64 count = 2;
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
syntax = "proto3";
|
||||
package content;
|
||||
option go_package = "./;content";
|
||||
package survey;
|
||||
option go_package = ".;survey";
|
||||
|
||||
|
||||
message Empty{
|
||||
}
|
||||
|
||||
message FetchRequest {
|
||||
int64 page_no=1; // 页数
|
||||
@@ -30,5 +34,52 @@ message StatusReply{
|
||||
int64 timeseq=4; // 响应时间序列
|
||||
}
|
||||
|
||||
message Empty{
|
||||
|
||||
// 问卷基本信息
|
||||
message SurveyItem {
|
||||
string id = 1; // 问卷ID
|
||||
string title = 2; // 问卷标题
|
||||
string description = 3; // 问卷描述
|
||||
string creator_id = 4; // 创建者ID
|
||||
string start_time = 5; // 开始时间
|
||||
string end_time = 6; // 结束时间
|
||||
bool is_active = 7; // 是否激活
|
||||
bool is_anonymous = 8; // 是否匿名
|
||||
repeated QuestionItem questions = 9; // 问题列表
|
||||
repeated string tags = 10; // 标签
|
||||
string style_config = 11; // 样式配置(JSON)
|
||||
}
|
||||
|
||||
// 问题类型
|
||||
enum QuestionType {
|
||||
SINGLE_CHOICE = 0; // 单选题
|
||||
MULTIPLE_CHOICE = 1; // 多选题
|
||||
TEXT = 2; // 文本题
|
||||
SCALE = 3; // 量表题
|
||||
RANKING = 4; // 排序题
|
||||
DATE = 5; // 日期题
|
||||
}
|
||||
|
||||
// 问题定义
|
||||
message QuestionItem {
|
||||
string id = 1; // 问题ID
|
||||
string survey_id = 2; // 所属问卷ID
|
||||
string title = 3; // 问题标题
|
||||
string description = 4; // 问题描述
|
||||
QuestionType type = 5; // 问题类型
|
||||
bool is_required = 6; // 是否必答
|
||||
repeated Option options = 7; // 选项(适用于选择题)
|
||||
int32 min_selections = 8; // 最少选择数(多选题)
|
||||
int32 max_selections = 9; // 最多选择数(多选题)
|
||||
int32 order = 10; // 问题顺序
|
||||
string placeholder = 11; // 输入提示(文本题)
|
||||
}
|
||||
|
||||
// 问题选项
|
||||
message Option {
|
||||
string id = 1; // 选项ID
|
||||
string text = 2; // 选项文本
|
||||
int32 order = 3; // 选项顺序
|
||||
string image_url = 4; // 选项图片
|
||||
int32 score = 5; // 选项分数(适用于量表)
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package content;
|
||||
option go_package = "./;content";
|
||||
import "blocks.proto";
|
||||
|
||||
// 系统分类
|
||||
service Category {
|
||||
//分类列表
|
||||
rpc CategoryList (Empty) returns (CategoryListReply) {};
|
||||
rpc AddCategory (AddCategoryRequest) returns (AddCategoryResponse) {};
|
||||
rpc ModifyCategory (ModifyCategoryRequest) returns (Empty) {};
|
||||
rpc DeleteCategory (DeleteCategoryRequest) returns (Empty) {};
|
||||
}
|
||||
|
||||
// 无限极分类
|
||||
message CategoryItem{
|
||||
string identity = 1;
|
||||
string parent_identity = 2; // 为空表示顶级分类
|
||||
string title = 3;
|
||||
string cover_path = 4;
|
||||
string intro=5;
|
||||
string created_at = 6;
|
||||
string updated_at = 7;
|
||||
repeated CategoryItem data = 8;
|
||||
}
|
||||
|
||||
message CategoryListReply {
|
||||
repeated CategoryItem data = 1;
|
||||
int64 count = 2;
|
||||
}
|
||||
|
||||
message AddCategoryResponse{
|
||||
string identity = 1; // 新增数据的唯一码
|
||||
}
|
||||
|
||||
message AddCategoryRequest{
|
||||
string identity = 1; //
|
||||
string parent_identity = 2; // 为空表示顶级分类
|
||||
string title = 3;
|
||||
string cover_path = 4;
|
||||
string intro=5;
|
||||
string created_at = 6;
|
||||
string updated_at = 7;
|
||||
repeated CategoryItem data = 8;
|
||||
}
|
||||
message ModifyCategoryRequest{
|
||||
string identity = 1; //
|
||||
string parent_identity = 2; // 为空表示顶级分类
|
||||
string title = 3;
|
||||
string cover_path = 4;
|
||||
string intro=5;
|
||||
string created_at = 6;
|
||||
string updated_at = 7;
|
||||
repeated CategoryItem data = 8;
|
||||
}
|
||||
|
||||
message DeleteCategoryRequest{
|
||||
string identity = 1; //
|
||||
}
|
||||
133
proto/post.proto
133
proto/post.proto
@@ -1,133 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package content;
|
||||
option go_package = "./;content";
|
||||
import "blocks.proto";
|
||||
|
||||
// 正文
|
||||
service Post{
|
||||
//文章列表
|
||||
rpc PostList(PostListRequest) returns (PostListReply) {};
|
||||
|
||||
//获取文章详情
|
||||
rpc GetPost (GetPostRequest) returns (PostItem) {};
|
||||
|
||||
//发布文章
|
||||
rpc AddPost(PostItem) returns (StatusReply) {};
|
||||
|
||||
//修改文章
|
||||
rpc ModifyPost(PostItem) returns (StatusReply) {};
|
||||
|
||||
//删除文章
|
||||
rpc DeletePost(IdentRequest) returns (StatusReply) {};
|
||||
|
||||
// 文章点赞处理
|
||||
rpc IncrPostLike(PostOpIdentityRequest) returns (StatusReply) {};
|
||||
rpc DescPostLike(PostOpIdentityRequest) returns (StatusReply) {};
|
||||
|
||||
// 文章点踩处理
|
||||
rpc IncrPostUnlike(PostOpIdentityRequest) returns (StatusReply) {};
|
||||
rpc DescPostUnlike(PostOpIdentityRequest) returns (StatusReply) {};
|
||||
|
||||
//评论列表
|
||||
rpc CommentList(CommentListRequest) returns (CommentListResponse) {};
|
||||
|
||||
//发布评论
|
||||
rpc AddComment(CommentItem) returns (StatusReply) {};
|
||||
|
||||
//修改评论
|
||||
rpc ModifyComment(CommentItem) returns (StatusReply) {};
|
||||
|
||||
//删除评论
|
||||
rpc DeleteComment(DeleteCommentRequest) returns (StatusReply) {};
|
||||
|
||||
// 评论点赞处理
|
||||
rpc IncrCommentLike(CommentOpIdentityRequest) returns (StatusReply) {};
|
||||
rpc DescCommentLike(CommentOpIdentityRequest) returns (StatusReply) {};
|
||||
|
||||
// 评论点踩处理
|
||||
rpc IncrCommentUnlike(CommentOpIdentityRequest) returns (StatusReply) {};
|
||||
rpc DescCommentUnlike(CommentOpIdentityRequest) returns (StatusReply) {};
|
||||
}
|
||||
message DeleteCommentRequest{
|
||||
string identity = 1; // 需要删除的评论的唯一标识
|
||||
string post_identity = 2; // 文章唯一标识
|
||||
}
|
||||
message PostItem{
|
||||
string identity = 1; // 文章唯一标识
|
||||
int64 passport_id =2; // 作者ID
|
||||
string passport_identity =3; // 作者唯一标识
|
||||
repeated string category_identity_list = 4; //所属分类Identity 列表
|
||||
repeated string tags_identity_list = 5; // 标签集
|
||||
string title = 6;
|
||||
string cover_path = 7; //封面
|
||||
string author = 8;
|
||||
string content = 9;
|
||||
string target_url = 10;// 跳转目标地址
|
||||
string source_url = 11; // 文章来源地址
|
||||
int64 hits = 12; //点击量
|
||||
repeated string accessory = 13; //附件列表
|
||||
bool has_accessory = 14;//是否有附件,默认没有
|
||||
string created_at=15;
|
||||
string updated_at=16;
|
||||
string description = 17;//简介
|
||||
int64 like_hits = 18; //点赞量
|
||||
int64 unlike_hits = 19; //点踩量
|
||||
int64 comment_hits = 20; //评论量
|
||||
int32 type = 22;// 用户自定义文章类型
|
||||
string rights=23; //权限
|
||||
}
|
||||
|
||||
|
||||
message PostListRequest{
|
||||
int64 page = 1; // 页码,默认第一页
|
||||
int64 size = 2; // 单页显示数量,默认10,最多50
|
||||
string author_identity = 3; //发布者唯一标识,可选
|
||||
string category_identity = 4; // 文章类型,可选
|
||||
string keyword = 5;// 根据文章名称模糊查找
|
||||
int32 type = 6;// 根据用户自定义文章类型过滤,可选,默认0,全部查找
|
||||
|
||||
}
|
||||
message PostListReply{
|
||||
repeated PostItem data = 1;
|
||||
int64 count = 2;
|
||||
}
|
||||
|
||||
message GetPostRequest {
|
||||
string identity = 1; // 必传
|
||||
string author_identity = 2; // 必传
|
||||
}
|
||||
|
||||
message CommentItem {
|
||||
string identity = 1;
|
||||
string Post_identity = 2;
|
||||
string parent_identity = 3;
|
||||
string content = 4;
|
||||
string reply_identity = 5;// 回复者唯一 标识
|
||||
string created_at = 6;
|
||||
string updated_at = 7;
|
||||
repeated CommentItem list = 8;//回复列表
|
||||
int64 like_hits = 9; //点赞量
|
||||
int64 unlike_hits = 10; //点踩量
|
||||
int64 comment_hits = 11; //评论量
|
||||
}
|
||||
|
||||
message CommentListRequest{
|
||||
string Post_identity = 1;//必填
|
||||
int64 page = 2; // 页码,默认第一页
|
||||
int64 size = 3; // 单页显示数量,默认10,最多50
|
||||
}
|
||||
|
||||
message CommentListResponse{
|
||||
repeated CommentItem list =1;
|
||||
int64 count = 2;
|
||||
}
|
||||
|
||||
message PostOpIdentityRequest{
|
||||
string post_identity = 1; //必传
|
||||
string op_identity = 2; // 必传
|
||||
}
|
||||
|
||||
message CommentOpIdentityRequest{
|
||||
string comment_identity = 1; //必填
|
||||
string op_identity = 2;//必填
|
||||
}
|
||||
23
proto/question.proto
Normal file
23
proto/question.proto
Normal file
@@ -0,0 +1,23 @@
|
||||
syntax = "proto3";
|
||||
package survey;
|
||||
option go_package = ".;survey";
|
||||
import "blocks.proto";
|
||||
|
||||
// 问卷服务 - 问题管理
|
||||
service Question {
|
||||
rpc Add (QuestionItem) returns (StatusReply);
|
||||
rpc Update (QuestionItem) returns (StatusReply);
|
||||
rpc Delete (IdentRequest) returns (StatusReply);
|
||||
rpc Fetch (FetchRequest) returns (ListQuestionReply);
|
||||
rpc BySurvey (BySurveyRequest) returns (ListQuestionReply);
|
||||
}
|
||||
|
||||
message BySurveyRequest {
|
||||
string survey_id = 1;
|
||||
repeated string question_ids = 2; // 按顺序排列的问题ID
|
||||
}
|
||||
|
||||
message ListQuestionReply {
|
||||
repeated QuestionItem data = 1;
|
||||
int64 count = 2;
|
||||
}
|
||||
15
proto/report.proto
Normal file
15
proto/report.proto
Normal file
@@ -0,0 +1,15 @@
|
||||
syntax = "proto3";
|
||||
package survey;
|
||||
option go_package = ".;survey";
|
||||
import "blocks.proto";
|
||||
|
||||
// 问卷服务 - 统计分析
|
||||
service Report {
|
||||
rpc GetSurveyStats (IdentRequest) returns (SurveyStats);
|
||||
}
|
||||
|
||||
message SurveyStats {
|
||||
string survey_id = 1;
|
||||
int32 response_count = 2;
|
||||
map<string, int64> question_stats = 3; // key为question_id
|
||||
}
|
||||
27
proto/share.proto
Normal file
27
proto/share.proto
Normal file
@@ -0,0 +1,27 @@
|
||||
syntax = "proto3";
|
||||
package survey;
|
||||
option go_package = ".;survey";
|
||||
import "blocks.proto";
|
||||
|
||||
// 问卷服务 - 分享管理
|
||||
service Share {
|
||||
rpc Create (IdentRequest) returns (StatusReply);
|
||||
rpc Fetch (FetchRequest) returns (ListShareReply);
|
||||
rpc SetStatus (StatusReply) returns (StatusReply);
|
||||
}
|
||||
|
||||
message ListShareReply {
|
||||
repeated ShareItem data = 1;
|
||||
int64 count = 2;
|
||||
}
|
||||
|
||||
// 分享链接
|
||||
message ShareItem {
|
||||
string id = 1; // 分享ID
|
||||
string survey_id = 2; // 问卷ID
|
||||
string url = 3; // 分享URL
|
||||
string creator_id = 4; // 创建者ID
|
||||
int64 expires_at = 6; // 过期时间
|
||||
int32 max_responses = 7; // 最大回答数(0表示不限)
|
||||
bool is_active = 8; // 是否激活
|
||||
}
|
||||
18
proto/survey.proto
Normal file
18
proto/survey.proto
Normal file
@@ -0,0 +1,18 @@
|
||||
syntax = "proto3";
|
||||
package survey;
|
||||
option go_package = ".;survey";
|
||||
import "blocks.proto";
|
||||
|
||||
// 问卷服务 - 问卷管理
|
||||
service Survey {
|
||||
rpc Create (SurveyItem) returns (StatusReply);
|
||||
rpc Get (IdentRequest) returns (SurveyItem);
|
||||
rpc Update (SurveyItem) returns (StatusReply);
|
||||
rpc Delete (IdentRequest) returns (StatusReply);
|
||||
rpc Fetch (FetchRequest) returns (ListSurveyReply);
|
||||
}
|
||||
|
||||
message ListSurveyReply {
|
||||
repeated SurveyItem data = 1;
|
||||
int64 count = 2;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package content;
|
||||
option go_package = "./;content";
|
||||
import "blocks.proto";
|
||||
|
||||
// 标签
|
||||
service Tags {
|
||||
//标签列表
|
||||
rpc TagsList (IdentRequest) returns (TagsListReply) {};
|
||||
|
||||
//创建标签
|
||||
rpc AddTags(TagsItem) returns (StatusReply) {};
|
||||
|
||||
//修改标签
|
||||
rpc ModifyTags(TagsItem) returns (StatusReply) {};
|
||||
|
||||
//删除标签
|
||||
rpc DeleteTags(IdentRequest) returns (StatusReply) {};
|
||||
}
|
||||
|
||||
// 无限极标签
|
||||
message TagsItem{
|
||||
string identity = 1;
|
||||
string parent_identity = 2; // 为空表示顶级主题
|
||||
string title = 3;
|
||||
string cover_path = 4;
|
||||
string intro=5;
|
||||
repeated TagsItem list = 9;
|
||||
}
|
||||
|
||||
message TagsListReply {
|
||||
repeated TagsItem list = 1;
|
||||
int64 count = 2;
|
||||
}
|
||||
Reference in New Issue
Block a user